rungalileo commited on
Commit
9843bf5
·
verified ·
1 Parent(s): bc0b390

Add TRT-LLM W8A8_SQ + INT8_KV checkpoint and detailed model card

Browse files
Files changed (3) hide show
  1. README.md +92 -0
  2. config.json +85 -0
  3. rank0.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3.1
3
+ base_model: meta-llama/Meta-Llama-3.1-8B-Instruct
4
+ library_name: tensorrt_llm
5
+ tags:
6
+ - text-generation
7
+ - tensorrt-llm
8
+ - llama
9
+ - smoothquant
10
+ - int8
11
+ - kv-cache-quantization
12
+ ---
13
+
14
+ # Meta-Llama-3.1-8B-Instruct TensorRT-LLM checkpoint (W8A8 SmoothQuant + INT8 KV)
15
+
16
+ TensorRT-LLM **checkpoint** for **Meta-Llama-3.1-8B-Instruct**, with **W8A8 SmoothQuant** quantization for model compute and **INT8** KV cache. Use with `trtllm-build` to produce an engine for inference.
17
+
18
+ ## Model details
19
+
20
+ | Item | Value |
21
+ |---|---|
22
+ | **Base model** | Meta-Llama-3.1-8B-Instruct |
23
+ | **Framework** | TensorRT-LLM (checkpoint format) |
24
+ | **Weight/activation quantization** | W8A8 SmoothQuant (`W8A8_SQ_PER_CHANNEL_PER_TOKEN_PLUGIN`) |
25
+ | **KV cache** | INT8 |
26
+ | **Producer** | TensorRT-LLM `convert_checkpoint.py` |
27
+ | **Key conversion flags** | `--smoothquant 0.5 --per_token --per_channel --int8_kv_cache` |
28
+ | **Calibration size** | 512 samples (`--calib_size 512`) |
29
+ | **Architecture** | LlamaForCausalLM (decoder-only) |
30
+
31
+ ## Build (how to produce this checkpoint)
32
+
33
+ This checkpoint is produced using the TensorRT-LLM Llama converter with SmoothQuant and INT8 KV cache enabled:
34
+
35
+ ```bash
36
+ python TensorRT-LLM/examples/models/core/llama/convert_checkpoint.py \
37
+ --model_dir /path/to/Meta-Llama-3.1-8B-Instruct \
38
+ --output_dir ./llama-3.1-8b-instruct-trtllm-ckpt-wq_w8a8sq-kv_int8 \
39
+ --dtype float16 \
40
+ --tp_size 1 \
41
+ --smoothquant 0.5 \
42
+ --per_token \
43
+ --per_channel \
44
+ --int8_kv_cache \
45
+ --calib_size 512
46
+ ```
47
+
48
+ ### Environment note
49
+
50
+ In this environment, loading the slow tokenizer path (`use_fast=False`) returns an invalid object for this model. During generation, tokenizer loading is forced to `use_fast=True` at runtime. This only affects tokenizer loading compatibility in the conversion process and does not change the target quantization configuration.
51
+
52
+ ## Output
53
+
54
+ After conversion, `--output_dir` contains:
55
+
56
+ - `config.json` - TensorRT-LLM checkpoint config
57
+ - `rank0.safetensors` - rank-0 checkpoint weights (single-GPU)
58
+
59
+ ## Upload (how to upload to Hugging Face)
60
+
61
+ ```bash
62
+ cd ./llama-3.1-8b-instruct-trtllm-ckpt-wq_w8a8sq-kv_int8
63
+
64
+ huggingface-cli repo create rungalileo/llama-3.1-8b-instruct-trtllm-ckpt-wq_w8a8sq-kv_int8 --repo-type model
65
+ huggingface-cli upload rungalileo/llama-3.1-8b-instruct-trtllm-ckpt-wq_w8a8sq-kv_int8 . --repo-type model
66
+ ```
67
+
68
+ ## How to use
69
+
70
+ ### 1. Build engine
71
+
72
+ ```bash
73
+ git clone https://huggingface.co/rungalileo/llama-3.1-8b-instruct-trtllm-ckpt-wq_w8a8sq-kv_int8
74
+ cd llama-3.1-8b-instruct-trtllm-ckpt-wq_w8a8sq-kv_int8
75
+
76
+ trtllm-build --checkpoint_dir . --output_dir ./engine \
77
+ --max_batch_size 1 --max_input_len 512 --max_seq_len 1024
78
+ ```
79
+
80
+ ### 2. Run inference
81
+
82
+ Use a tokenizer from the base model:
83
+
84
+ ```bash
85
+ trtllm-serve ./engine --tokenizer meta-llama/Meta-Llama-3.1-8B-Instruct --port 8000
86
+ # OpenAI-compatible API: http://localhost:8000/v1/completions
87
+ ```
88
+
89
+ ## References
90
+
91
+ - TensorRT-LLM
92
+ - Meta-Llama-3.1-8B-Instruct
config.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mlp_bias": false,
3
+ "attn_bias": false,
4
+ "rotary_base": 500000.0,
5
+ "rotary_scaling": {
6
+ "factor": 8.0,
7
+ "high_freq_factor": 4.0,
8
+ "low_freq_factor": 1.0,
9
+ "original_max_position_embeddings": 8192,
10
+ "rope_type": "llama3"
11
+ },
12
+ "residual_mlp": false,
13
+ "disable_weight_only_quant_plugin": false,
14
+ "moe": {
15
+ "num_experts": 0,
16
+ "shared_expert_intermediate_size": 0,
17
+ "top_k": 0,
18
+ "normalization_mode": null,
19
+ "sparse_mixer_epsilon": 0.01,
20
+ "tp_mode": 0,
21
+ "device_limited_n_group": 0,
22
+ "device_limited_topk_group": 0,
23
+ "device_limited_routed_scaling_factor": 1.0
24
+ },
25
+ "remove_duplicated_kv_heads": false,
26
+ "fc_after_embed": false,
27
+ "use_input_layernorm_in_first_layer": true,
28
+ "use_last_layernorm": true,
29
+ "layer_idx_offset": 0,
30
+ "embedding_multiplier": 1.0,
31
+ "attention_multiplier": 1.0,
32
+ "residual_multiplier": 1.0,
33
+ "output_multiplier_scale": 1.0,
34
+ "has_partial_lora_mask": false,
35
+ "architecture": "LlamaForCausalLM",
36
+ "dtype": "float16",
37
+ "vocab_size": 128256,
38
+ "hidden_size": 4096,
39
+ "num_hidden_layers": 32,
40
+ "num_attention_heads": 32,
41
+ "hidden_act": "silu",
42
+ "logits_dtype": "float32",
43
+ "norm_epsilon": 1e-05,
44
+ "runtime_defaults": null,
45
+ "position_embedding_type": "rope_gpt_neox",
46
+ "num_key_value_heads": 8,
47
+ "intermediate_size": 14336,
48
+ "max_position_embeddings": 131072,
49
+ "mapping": {
50
+ "world_size": 1,
51
+ "gpus_per_node": 8,
52
+ "cp_size": 1,
53
+ "tp_size": 1,
54
+ "pp_size": 1,
55
+ "moe_tp_size": 1,
56
+ "moe_cluster_size": 1,
57
+ "moe_ep_size": 1,
58
+ "attn_tp_size": 1,
59
+ "attn_cp_size": 1,
60
+ "cp_config": {},
61
+ "auto_parallel": false,
62
+ "enable_attention_dp": false,
63
+ "enable_lm_head_tp_in_adp": false
64
+ },
65
+ "quantization": {
66
+ "quant_algo": "W8A8_SQ_PER_CHANNEL_PER_TOKEN_PLUGIN",
67
+ "kv_cache_quant_algo": "INT8",
68
+ "group_size": 128,
69
+ "smoothquant_val": 0.5,
70
+ "clamp_val": null,
71
+ "use_meta_recipe": false,
72
+ "has_zero_point": false,
73
+ "pre_quant_scale": false,
74
+ "exclude_modules": null,
75
+ "mamba_ssm_cache_dtype": null
76
+ },
77
+ "use_parallel_embedding": false,
78
+ "embedding_sharding_dim": 0,
79
+ "head_size": 128,
80
+ "qk_layernorm": false,
81
+ "rotary_embedding_dim": 128,
82
+ "tie_word_embeddings": false,
83
+ "quant_ckpt_path": null,
84
+ "load_model_on_cpu": false
85
+ }
rank0.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c29d8d1ec8ada985f054c60e20e30a83892c46637fc0c92cd4259a4722a064d
3
+ size 9089128848