Views
No views yet
trtllm-build to produce an engine for inference.| Item | Value |
|---|---|
| Base model | Llama-3.2-3B-Instruct |
| Framework | TensorRT-LLM (checkpoint format) |
| Weight quantization | INT4 AWQ |
| KV cache | INT8 |
| Producer | TensorRT-LLM v0.18.0 convert_checkpoint.py (modelopt 0.25.0) |
| Architecture | LlamaForCausalLM (decoder-only) |
1sudo apt install git-lfs
2git lfs install
3sudo apt-get update && sudo apt-get -y install python3.12 python3-pip
4
5pip3 install tensorrt_llm==0.18.0 --extra-index-url https://pypi.nvidia.com
6pip3 install datasets==3.6.0
7pip3 install "onnx>=1.12,<1.20"1git clone -b v0.18.0 https://github.com/NVIDIA/TensorRT-LLM.git
2git clone https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct1python3 TensorRT-LLM/examples/llama/convert_checkpoint.py \
2 --model_dir ./Llama-3.2-3B-Instruct \
3 --output_dir ./llama-3.2-3B-instruct-trtllm-ckpt-wq_int4_awq-kv_int8 \
4 --dtype float16 \
5 --use_weight_only \
6 --weight_only_precision int4_awq \
7 --int8_kv_cache--calib_dataset <path_or_name>, e.g. a local parquet dir or pileval.)--output_dir will contain config.json and rank0.safetensors; that is the checkpoint in this repo.1cd ./llama-3.2-3B-instruct-trtllm-ckpt-wq_int4_awq-kv_int8
2
3# Create the repo first if it does not exist
4huggingface-cli repo create rungalileo/llama-3.2-3B-instruct-trtllm-ckpt-wq_int4_awq-kv_int8 --repo-type model
5
6# Upload everything in the current directory to the repo
7huggingface-cli upload rungalileo/llama-3.2-3B-instruct-trtllm-ckpt-wq_int4_awq-kv_int8 . --repo-type modeltensorrt_llm installed:1# Clone this repo or download from HF
2git clone https://huggingface.co/rungalileo/llama-3.2-3B-instruct-trtllm-ckpt-wq_int4_awq-kv_int8
3cd llama-3.2-3B-instruct-trtllm-ckpt-wq_int4_awq-kv_int8
4
5# Build TensorRT-LLM engine (adjust max_batch_size / max_seq_len as needed)
6trtllm-build --checkpoint_dir . --output_dir ./engine \
7 --max_batch_size 1 --max_input_len 512 --max_seq_len 1024trtllm-serve (need tokenizer from the base model, e.g. meta-llama/Llama-3.2-3B-Instruct):1trtllm-serve ./engine --tokenizer meta-llama/Llama-3.2-3B-Instruct --port 8000
2# Then call OpenAI-compatible API at http://localhost:8000/v1/completionsconfig.json – TensorRT-LLM model configrank0.safetensors – Rank 0 weights (single-GPU)