Posts

Showing posts with the label tensor

TensorRT

🧠 When to Use TensorRT Use TensorRT only for inference , not for training or fine-tuning. It provides: Lower latency Faster throughput Reduced memory footprint ⚙️ Requirements To use TensorRT: GPU with Tensor Cores (Volta, Turing, Ampere, etc.) ONNX model format (you need to export your model to ONNX first) Install: pip install nvidia-pyindex pip install tensorrt 🔥 Hugging Face + TensorRT You can export HuggingFace models using transformers.onnx : transformers-cli env # check installation transformers onnx --model=codellama/CodeLlama-7B-Instruct-hf --feature=causal-lm ./onnx/ Then optimize it via TensorRT with onnxruntime or trtexec . ⚠️ Kaggle Note Kaggle does not support TensorRT , as it lacks: root access for TensorRT driver-level installations required NVIDIA runtime permissions ✅ Use Locally or on Cloud (AWS/GCP/Colab Pro+ with CUDA support) Let me know if you want a step-by-step ONNX → TensorRT pipeline . To run inference with...

TensorRT-Specific LLM Optimizations for Jetson (NVIDIA Edge AI)

  🚀 TensorRT-Specific LLM Optimizations for Jetson (NVIDIA Edge AI) TensorRT is NVIDIA’s deep learning optimizer that dramatically improves inference speed for LLMs on Jetson devices . It enables: ✅ Faster inference (2-4x speedup) with lower latency. ✅ Lower power consumption on edge devices. ✅ Optimized memory usage for LLMs. 1️⃣ Install TensorRT & Dependencies First, install TensorRT on your Jetson Orin/Nano : sudo apt update sudo apt install -y nvidia-cuda-toolkit tensorrt python3-libnvinfer Confirm installation: dpkg -l | grep TensorRT 2️⃣ Convert LLM to TensorRT Engine TensorRT requires models in ONNX format before optimization. Convert GGUF/Quantized Model → ONNX First, convert your LLaMA/Mistral model to ONNX format: python convert_to_onnx.py --model model.gguf --output model.onnx (Use onnx_exporter.py from Hugging Face if needed.) 3️⃣ Optimize ONNX with TensorRT Use trtexec to compile the ONNX model into a TensorRT engine: trtexec --onnx=mo...