PY-AI-Dev commited on
Commit
69db612
·
verified ·
1 Parent(s): d10086c

Add FP8 (dynamic) quantization for CodeLlama-7b-hf

Browse files
README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ base_model: codellama/CodeLlama-7b-hf
4
+ base_model_relation: quantized
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - fp8
9
+ - compressed-tensors
10
+ - vllm
11
+ - quantized
12
+ quantized_by: liodon-ai
13
+ ---
14
+
15
+ # CodeLlama-7b-hf — FP8 (dynamic)
16
+
17
+ FP8 quantization of [codellama/CodeLlama-7b-hf](https://huggingface.co/codellama/CodeLlama-7b-hf), published by [Liodon AI](https://huggingface.co/liodon-ai).
18
+
19
+ Quantized with [llm-compressor](https://github.com/vllm-project/llm-compressor) using the
20
+ `FP8_DYNAMIC` scheme: weights are cast to FP8 (E4M3) per-channel ahead of time, activations are
21
+ quantized to FP8 dynamically per-token at inference time. No calibration dataset is needed for this
22
+ scheme, so the quantized weights are numerically just a direct cast of the original — no calibration-set
23
+ bias to worry about. `lm_head` is left unquantized (standard practice — negligible size, disproportionate
24
+ quality impact if quantized).
25
+
26
+ Original size: 13.5 GB → Quantized: 7.0 GB.
27
+
28
+ ## Quick Start
29
+
30
+ **vLLM**
31
+ ```bash
32
+ vllm serve liodon-ai/CodeLlama-7b-hf-FP8
33
+ ```
34
+
35
+ **Text Generation Inference (TGI)**
36
+ ```bash
37
+ docker run --gpus all -p 8080:80 ghcr.io/huggingface/text-generation-inference \
38
+ --model-id liodon-ai/CodeLlama-7b-hf-FP8
39
+ ```
40
+
41
+ **SGLang**
42
+ ```bash
43
+ python -m sglang.launch_server --model-path liodon-ai/CodeLlama-7b-hf-FP8
44
+ ```
45
+
46
+ FP8 execution requires an NVIDIA GPU with compute capability ≥ 8.9 (Ada/Hopper/Blackwell — RTX 40-series,
47
+ L4/L40S, H100/H200, B100/B200/GB10). On older GPUs, vLLM/TGI will dequantize to run, which loses the
48
+ speed/memory benefit.
49
+
50
+ ## Source
51
+
52
+ - **Model**: [codellama/CodeLlama-7b-hf](https://huggingface.co/codellama/CodeLlama-7b-hf)
53
+ - **License**: other
54
+
55
+ ## Citation
56
+
57
+ ```bibtex
58
+ @misc{liodonai_codellama_7b_hf_fp8,
59
+ title = {CodeLlama-7b-hf — FP8},
60
+ author = {{Liodon AI}},
61
+ year = {2026},
62
+ howpublished = {\url{https://huggingface.co/liodon-ai/CodeLlama-7b-hf-FP8}},
63
+ note = {FP8 (dynamic) quantization of codellama/CodeLlama-7b-hf}
64
+ }
65
+ ```
66
+
67
+ ---
68
+ *Quantized by [Liodon AI](https://huggingface.co/liodon-ai)*
config.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 2,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 4096,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 11008,
15
+ "max_position_embeddings": 16384,
16
+ "mlp_bias": false,
17
+ "model_type": "llama",
18
+ "num_attention_heads": 32,
19
+ "num_hidden_layers": 32,
20
+ "num_key_value_heads": 32,
21
+ "pad_token_id": null,
22
+ "pretraining_tp": 1,
23
+ "quantization_config": {
24
+ "config_groups": {
25
+ "group_0": {
26
+ "format": "float-quantized",
27
+ "input_activations": {
28
+ "actorder": null,
29
+ "block_structure": null,
30
+ "dynamic": true,
31
+ "group_size": null,
32
+ "num_bits": 8,
33
+ "observer": null,
34
+ "observer_kwargs": {},
35
+ "scale_dtype": null,
36
+ "strategy": "token",
37
+ "symmetric": true,
38
+ "type": "float",
39
+ "zp_dtype": null
40
+ },
41
+ "output_activations": null,
42
+ "targets": [
43
+ "Linear"
44
+ ],
45
+ "weights": {
46
+ "actorder": null,
47
+ "block_structure": null,
48
+ "dynamic": false,
49
+ "group_size": null,
50
+ "num_bits": 8,
51
+ "observer": "memoryless_minmax",
52
+ "observer_kwargs": {},
53
+ "scale_dtype": null,
54
+ "strategy": "channel",
55
+ "symmetric": true,
56
+ "type": "float",
57
+ "zp_dtype": null
58
+ }
59
+ }
60
+ },
61
+ "format": "float-quantized",
62
+ "global_compression_ratio": null,
63
+ "ignore": [
64
+ "lm_head"
65
+ ],
66
+ "kv_cache_scheme": null,
67
+ "quant_method": "compressed-tensors",
68
+ "quantization_status": "compressed",
69
+ "sparsity_config": {},
70
+ "transform_config": {},
71
+ "version": "0.18.0"
72
+ },
73
+ "rms_norm_eps": 1e-05,
74
+ "rope_parameters": {
75
+ "rope_theta": 1000000,
76
+ "rope_type": "default"
77
+ },
78
+ "tie_word_embeddings": false,
79
+ "transformers_version": "5.14.1",
80
+ "use_cache": true,
81
+ "vocab_size": 32016
82
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "5.14.1"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f39ffdce61199e5759152f91a9b35f152890a66d9b9cf8fc62a01215ed853cfc
3
+ size 7003868416
recipe.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ default_stage:
2
+ default_modifiers:
3
+ QuantizationModifier:
4
+ targets: [Linear]
5
+ ignore: [lm_head]
6
+ scheme: FP8_DYNAMIC
7
+ bypass_divisibility_checks: false
8
+ requires_calibration_data: false
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<s>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "</s>",
7
+ "eot_token": "▁<EOT>",
8
+ "extra_special_tokens": [
9
+ "▁<PRE>",
10
+ "▁<MID>",
11
+ "▁<SUF>",
12
+ "▁<EOT>",
13
+ "<FILL_ME>"
14
+ ],
15
+ "fill_token": "<FILL_ME>",
16
+ "is_local": false,
17
+ "legacy": null,
18
+ "local_files_only": false,
19
+ "middle_token": "▁<MID>",
20
+ "model_max_length": 1000000000000000019884624838656,
21
+ "pad_token": null,
22
+ "prefix_token": "▁<PRE>",
23
+ "sp_model_kwargs": {},
24
+ "suffix_token": "▁<SUF>",
25
+ "tokenizer_class": "CodeLlamaTokenizer",
26
+ "unk_token": "<unk>",
27
+ "use_default_system_prompt": false
28
+ }