PY-AI-Dev commited on
Commit
8bd13df
·
verified ·
1 Parent(s): eb84954

Add FP8 (dynamic) quantization for Nanbeige4.2-3B-DSpark

Browse files
README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ base_model: Nanbeige/Nanbeige4.2-3B-DSpark
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
+ # Nanbeige4.2-3B-DSpark — FP8 (dynamic)
16
+
17
+ FP8 quantization of [Nanbeige/Nanbeige4.2-3B-DSpark](https://huggingface.co/Nanbeige/Nanbeige4.2-3B-DSpark), 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: 1.7 GB → Quantized: 2.8 GB.
27
+
28
+ ## Quick Start
29
+
30
+ **vLLM**
31
+ ```bash
32
+ vllm serve liodon-ai/Nanbeige4.2-3B-DSpark-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/Nanbeige4.2-3B-DSpark-FP8
39
+ ```
40
+
41
+ **SGLang**
42
+ ```bash
43
+ python -m sglang.launch_server --model-path liodon-ai/Nanbeige4.2-3B-DSpark-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**: [Nanbeige/Nanbeige4.2-3B-DSpark](https://huggingface.co/Nanbeige/Nanbeige4.2-3B-DSpark)
53
+ - **License**: other
54
+
55
+ ## Citation
56
+
57
+ ```bibtex
58
+ @misc{liodonai_nanbeige4_2_3b_dspark_fp8,
59
+ title = {Nanbeige4.2-3B-DSpark — FP8},
60
+ author = {{Liodon AI}},
61
+ year = {2026},
62
+ howpublished = {\url{https://huggingface.co/liodon-ai/Nanbeige4.2-3B-DSpark-FP8}},
63
+ note = {FP8 (dynamic) quantization of Nanbeige/Nanbeige4.2-3B-DSpark}
64
+ }
65
+ ```
66
+
67
+ ---
68
+ *Quantized by [Liodon AI](https://huggingface.co/liodon-ai)*
config.json ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoModel": "dspark.DSparkDraftModel"
9
+ },
10
+ "block_size": 7,
11
+ "bos_token_id": 166100,
12
+ "dflash_config": {
13
+ "attention_mode": "gqa",
14
+ "confidence_head_alpha": 1.0,
15
+ "confidence_head_with_markov": true,
16
+ "enable_confidence_head": true,
17
+ "markov_head_type": "vanilla",
18
+ "markov_rank": 256,
19
+ "mask_token_id": 166143,
20
+ "projector_type": "dspark",
21
+ "target_layer_ids": [
22
+ 1,
23
+ 10,
24
+ 21,
25
+ 32,
26
+ 40
27
+ ]
28
+ },
29
+ "dtype": "bfloat16",
30
+ "eos_token_id": 166101,
31
+ "head_dim": 128,
32
+ "hidden_act": "silu",
33
+ "hidden_size": 3072,
34
+ "initializer_range": 0.02,
35
+ "intermediate_size": 10752,
36
+ "layer_types": [
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention"
42
+ ],
43
+ "markov_head_type": "vanilla",
44
+ "markov_rank": 256,
45
+ "max_position_embeddings": 262144,
46
+ "max_window_layers": 5,
47
+ "model_type": "qwen3",
48
+ "num_attention_heads": 48,
49
+ "num_hidden_layers": 5,
50
+ "num_key_value_heads": 8,
51
+ "num_target_layers": 44,
52
+ "pad_token_id": 0,
53
+ "quantization_config": {
54
+ "config_groups": {
55
+ "group_0": {
56
+ "format": "float-quantized",
57
+ "input_activations": {
58
+ "actorder": null,
59
+ "block_structure": null,
60
+ "dynamic": true,
61
+ "group_size": null,
62
+ "num_bits": 8,
63
+ "observer": null,
64
+ "observer_kwargs": {},
65
+ "scale_dtype": null,
66
+ "strategy": "token",
67
+ "symmetric": true,
68
+ "type": "float",
69
+ "zp_dtype": null
70
+ },
71
+ "output_activations": null,
72
+ "targets": [
73
+ "Linear"
74
+ ],
75
+ "weights": {
76
+ "actorder": null,
77
+ "block_structure": null,
78
+ "dynamic": false,
79
+ "group_size": null,
80
+ "num_bits": 8,
81
+ "observer": "memoryless_minmax",
82
+ "observer_kwargs": {},
83
+ "scale_dtype": null,
84
+ "strategy": "channel",
85
+ "symmetric": true,
86
+ "type": "float",
87
+ "zp_dtype": null
88
+ }
89
+ }
90
+ },
91
+ "format": "float-quantized",
92
+ "global_compression_ratio": null,
93
+ "ignore": [
94
+ "lm_head"
95
+ ],
96
+ "kv_cache_scheme": null,
97
+ "quant_method": "compressed-tensors",
98
+ "quantization_status": "compressed",
99
+ "sparsity_config": {},
100
+ "transform_config": {},
101
+ "version": "0.18.0"
102
+ },
103
+ "rms_norm_eps": 1e-05,
104
+ "rope_parameters": {
105
+ "rope_theta": 70000000,
106
+ "rope_type": "default"
107
+ },
108
+ "sliding_window": null,
109
+ "tie_word_embeddings": false,
110
+ "transformers_version": "5.14.1",
111
+ "use_cache": true,
112
+ "use_sliding_window": false,
113
+ "vocab_size": 166144
114
+ }
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 166100,
4
+ "eos_token_id": 166101,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "5.14.1",
7
+ "use_cache": true
8
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78f5d5c115114a5f1ede1f97f19ba001756cc4e709a9d731c60caa4f0c9a5a60
3
+ size 2757670040
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
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0",
3
+ "truncation": null,
4
+ "padding": null,
5
+ "added_tokens": [
6
+ {
7
+ "id": 0,
8
+ "content": "<|endoftext|>",
9
+ "single_word": false,
10
+ "lstrip": false,
11
+ "rstrip": false,
12
+ "normalized": false,
13
+ "special": true
14
+ }
15
+ ],
16
+ "normalizer": {
17
+ "type": "NFC"
18
+ },
19
+ "pre_tokenizer": {
20
+ "type": "Sequence",
21
+ "pretokenizers": [
22
+ {
23
+ "type": "Split",
24
+ "pattern": {
25
+ "Regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+"
26
+ },
27
+ "behavior": "Isolated",
28
+ "invert": false
29
+ },
30
+ {
31
+ "type": "ByteLevel",
32
+ "add_prefix_space": false,
33
+ "trim_offsets": true,
34
+ "use_regex": false
35
+ }
36
+ ]
37
+ },
38
+ "post_processor": {
39
+ "type": "TemplateProcessing",
40
+ "single": [
41
+ {
42
+ "Sequence": {
43
+ "id": "A",
44
+ "type_id": 0
45
+ }
46
+ }
47
+ ],
48
+ "pair": [
49
+ {
50
+ "Sequence": {
51
+ "id": "A",
52
+ "type_id": 0
53
+ }
54
+ },
55
+ {
56
+ "Sequence": {
57
+ "id": "B",
58
+ "type_id": 1
59
+ }
60
+ }
61
+ ],
62
+ "special_tokens": {}
63
+ },
64
+ "decoder": {
65
+ "type": "ByteLevel",
66
+ "add_prefix_space": true,
67
+ "trim_offsets": true,
68
+ "use_regex": true
69
+ },
70
+ "model": {
71
+ "type": "BPE",
72
+ "dropout": null,
73
+ "unk_token": null,
74
+ "continuing_subword_prefix": "",
75
+ "end_of_word_suffix": "",
76
+ "fuse_unk": false,
77
+ "byte_fallback": false,
78
+ "ignore_merges": false,
79
+ "vocab": {
80
+ "<|endoftext|>": 0
81
+ },
82
+ "merges": []
83
+ }
84
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": null,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "eos_token": "<|endoftext|>",
6
+ "is_local": false,
7
+ "local_files_only": false,
8
+ "model_max_length": 1000000000000000019884624838656,
9
+ "pad_token": "<|endoftext|>",
10
+ "tokenizer_class": "Qwen2Tokenizer",
11
+ "unk_token": "<|endoftext|>"
12
+ }