commit 7b2e622b4510585c25c1677cbf4bfe197963cafe Author: ModelHub XC Date: Thu Jul 2 06:52:12 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: RedHatAI/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a8 Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..52373fe --- /dev/null +++ b/.gitattributes @@ -0,0 +1,36 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +tokenizer.json filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..48dfacf --- /dev/null +++ b/README.md @@ -0,0 +1,782 @@ +--- +license: mit +tags: +- deepseek +- int8 +- vllm +- llmcompressor +base_model: deepseek-ai/DeepSeek-R1-Distill-Qwen-14B +library_name: transformers +--- + +# DeepSeek-R1-Distill-Qwen-14B-quantized.w8a8 + +## Model Overview +- **Model Architecture:** Qwen2ForCausalLM + - **Input:** Text + - **Output:** Text +- **Model Optimizations:** + - **Weight quantization:** INT8 + - **Activation quantization:** INT8 +- **Release Date:** 2/4/2025 +- **Version:** 1.0 +- **Model Developers:** Neural Magic + +Quantized version of [DeepSeek-R1-Distill-Qwen-14B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B). + + +### Model Optimizations + +This model was obtained by quantizing the weights and activations of [DeepSeek-R1-Distill-Qwen-14B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B) to INT8 data type. +This optimization reduces the number of bits used to represent weights and activations from 16 to 8, reducing GPU memory requirements (by approximately 50%) and increasing matrix-multiply compute throughput (by approximately 2x). +Weight quantization also reduces disk size requirements by approximately 50%. + +Only the weights and activations of the linear operators within transformers blocks are quantized. +Weights are quantized using a symmetric per-channel scheme, whereas quantizations are quantized using a symmetric per-token scheme. +The [GPTQ](https://arxiv.org/abs/2210.17323) algorithm is applied for quantization, as implemented in the [llm-compressor](https://github.com/vllm-project/llm-compressor) library. + + +## Use with vLLM + +This model can be deployed efficiently using the [vLLM](https://docs.vllm.ai/en/latest/) backend, as shown in the example below. + +```python +from transformers import AutoTokenizer +from vllm import LLM, SamplingParams + +number_gpus = 1 +model_name = "neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a8" + +tokenizer = AutoTokenizer.from_pretrained(model_name) +sampling_params = SamplingParams(temperature=0.6, max_tokens=256, stop_token_ids=[tokenizer.eos_token_id]) +llm = LLM(model=model_name, tensor_parallel_size=number_gpus, trust_remote_code=True) + +messages_list = [ + [{"role": "user", "content": "Who are you? Please respond in pirate speak!"}], +] + +prompt_token_ids = [tokenizer.apply_chat_template(messages, add_generation_prompt=True) for messages in messages_list] + +outputs = llm.generate(prompt_token_ids=prompt_token_ids, sampling_params=sampling_params) + +generated_text = [output.outputs[0].text for output in outputs] +print(generated_text) +``` + +vLLM also supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details. + +## Creation + +This model was created with [llm-compressor](https://github.com/vllm-project/llm-compressor) by running the code snippet below. + + +```python +from transformers import AutoModelForCausalLM, AutoTokenizer +from llmcompressor.modifiers.quantization import QuantizationModifier +from llmcompressor.modifiers.smoothquant import SmoothQuantModifier +from llmcompressor.transformers import oneshot + +# Load model +model_stub = "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B" +model_name = model_stub.split("/")[-1] + +num_samples = 1024 +max_seq_len = 8192 + +tokenizer = AutoTokenizer.from_pretrained(model_stub) + +model = AutoModelForCausalLM.from_pretrained( + model_stub, + device_map="auto", + torch_dtype="auto", +) + +def preprocess_fn(example): + return {"text": tokenizer.apply_chat_template(example["messages"], add_generation_prompt=False, tokenize=False)} + +ds = load_dataset("neuralmagic/LLM_compression_calibration", split="train") +ds = ds.map(preprocess_fn) + +# Configure the quantization algorithm and scheme +recipe = [ + SmoothQuantModifier(smoothing_strength=0.8), + QuantizationModifier( + targets="Linear", + scheme="W8A8", + ignore=["lm_head"], + dampening_frac=0.1, + ), +] + +# Apply quantization +oneshot( + model=model, + dataset=ds, + recipe=recipe, + max_seq_length=max_seq_len, + num_calibration_samples=num_samples, +) + +# Save to disk in compressed-tensors format +save_path = model_name + "-quantized.w8a8 +model.save_pretrained(save_path) +tokenizer.save_pretrained(save_path) +print(f"Model and tokenizer saved to: {save_path}") +``` + +## Evaluation + +The model was evaluated on OpenLLM Leaderboard [V1](https://huggingface.co/spaces/open-llm-leaderboard-old/open_llm_leaderboard) and [V2](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard#/), using the following commands: + +OpenLLM Leaderboard V1: +``` +lm_eval \ + --model vllm \ + --model_args pretrained="neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a8",dtype=auto,max_model_len=4096,tensor_parallel_size=1,enable_chunked_prefill=True \ + --tasks openllm \ + --write_out \ + --batch_size auto \ + --output_path output_dir \ + --show_config +``` + +OpenLLM Leaderboard V2: +``` +lm_eval \ + --model vllm \ + --model_args pretrained="neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a8",dtype=auto,max_model_len=4096,tensor_parallel_size=1,enable_chunked_prefill=True \ + --apply_chat_template \ + --fewshot_as_multiturn \ + --tasks leaderboard \ + --write_out \ + --batch_size auto \ + --output_path output_dir \ + --show_config +``` + +### Accuracy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategoryMetricdeepseek-ai/DeepSeek-R1-Distill-Qwen-14Bneuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a8Recovery
ReasoningAIME 2024 (pass@1)66.6766.3199.46%
MATH-500 (pass@1)94.6694.68100.02%
GPQA Diamond (pass@1)59.3558.3298.26%
Average Score73.5673.199.37%
OpenLLM V1ARC-Challenge (Acc-Norm, 25-shot)58.7957.8598.4%
GSM8K (Strict-Match, 5-shot)87.0487.79100.9%
HellaSwag (Acc-Norm, 10-shot)81.5181.0499.4%
MMLU (Acc, 5-shot)74.4674.2699.7%
TruthfulQA (MC2, 0-shot)54.7754.94100.3%
Winogrande (Acc, 5-shot)69.3870.48101.6%
Average Score70.9971.06100.1%
OpenLLM V2IFEval (Inst Level Strict Acc, 0-shot)42.1141.6298.6%
BBH (Acc-Norm, 3-shot)13.7314.29---
Math-Hard (Exact-Match, 4-shot)0.000.00---
GPQA (Acc-Norm, 0-shot)35.0737.22106.2%
MUSR (Acc-Norm, 0-shot)45.1443.5696.5%
MMLU-Pro (Acc, 5-shot)34.8633.6396.5%
Average Score34.2134.1299.7%
CodingHumanEval (pass@1)78.9078.4099.4%
HumanEval (pass@10)89.8090.10100.3%
HumanEval+ (pass@10)72.6072.4099.7%
HumanEval+ (pass@10)84.9084.90100.0%
+ +## Inference Performance + + +This model achieves up to 1.6x speedup in both single-stream and multi-stream asynchronous deployment, depending on hardware and use-case scenario. +The following performance benchmarks were conducted with [vLLM](https://docs.vllm.ai/en/latest/) version 0.7.2, and [GuideLLM](https://github.com/neuralmagic/guidellm). + +
+Benchmarking Command + +``` +guidellm --model neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a8 --target "http://localhost:8000/v1" --data-type emulated --data "prompt_tokens=,generated_tokens=" --max seconds 360 --backend aiohttp_server +``` +
+ +### Single-stream performance (measured with vLLM version 0.7.2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Instruction Following
256 / 128
Multi-turn Chat
512 / 256
Docstring Generation
768 / 128
RAG
1024 / 128
Code Completion
256 / 1024
Code Fixing
1024 / 1024
Large Summarization
4096 / 512
Large RAG
10240 / 1536
HardwareModelAverage cost reductionLatency (s)QPDLatency (s)QPDLatency (s)QPDLatency (s)QPDLatency (s)QPDLatency (s)QPDLatency (s)QPDLatency (s)QPD
A6000x1deepseek-ai/DeepSeek-R1-Distill-Qwen-14B---5.483710.74195.58135.680542.210742.810522.919771.763
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a81.593.313456.76733.413153.5129626.517026.816814.531048.393
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w4a162.512.022754.011272.220722.3194515.329415.92839.945636.6123
A100x1deepseek-ai/DeepSeek-R1-Distill-Qwen-14B---2.67655.23832.77462.773220.89721.29511.317936.755
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a81.341.910723.85331.910451.9103214.813615.21328.124839.651
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w4a161.931.216272.58101.315301.414749.720810.21975.834837.653
H100x1deepseek-ai/DeepSeek-R1-Distill-Qwen-14B---1.66723.33341.76621.765212.88513.0847.015525.243
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-FP8-dynamic1.331.29252.34671.29081.28969.31189.51155.221023.946
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w4a161.371.29442.34741.29311.29079.11219.21195.121422.549
+ +**Use case profiles: prompt tokens / generation tokens + +**QPD: Queries per dollar, based on on-demand cost at [Lambda Labs](https://lambdalabs.com/service/gpu-cloud) (observed on 2/18/2025). + + +### Multi-stream asynchronous performance (measured with vLLM version 0.7.2) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Instruction Following
256 / 128
Multi-turn Chat
512 / 256
Docstring Generation
768 / 128
RAG
1024 / 128
Code Completion
256 / 1024
Code Fixing
1024 / 1024
Large Summarization
4096 / 512
Large RAG
10240 / 1536
HardwareModelAverage cost reductionMaximum throughput (QPS)QPDMaximum throughput (QPS)QPDMaximum throughput (QPS)QPDMaximum throughput (QPS)QPDMaximum throughput (QPS)QPDMaximum throughput (QPS)QPDMaximum throughput (QPS)QPDMaximum throughput (QPS)QPD
A6000x1deepseek-ai/DeepSeek-R1-Distill-Qwen-14B---13.7307855.5123276.5145175.1114392.044341.329820.614620.2371
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a81.4421.4481818.2184219.8220517.8174622.862811.737581.023350.2419
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w4a160.9812.7285405.7127965.4122183.784012.555831.329870.714890.2368
A100x1deepseek-ai/DeepSeek-R1-Distill-Qwen-14B---15.6313067.1141927.7154356.0119712.448781.632980.918620.2355
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w8a81.3120.8419079.31872410.5210438.4168863.059751.939171.224810.2464
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w4a160.9414.0281466.5130426.5129875.1101942.652691.529250.918490.2382
H100x1deepseek-ai/DeepSeek-R1-Distill-Qwen-14B---31.43440414.11548216.61814913.3145724.750992.628491.920600.3347
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-FP8-dynamic1.3140.94472918.52026022.12416518.1197795.762463.436812.527460.4474
neuralmagic/DeepSeek-R1-Distill-Qwen-14B-quantized.w4a161.1233.33638715.01645317.61924114.2155764.650343.032922.224120.4481
+ +**Use case profiles: prompt tokens / generation tokens + +**QPS: Queries per second. + +**QPD: Queries per dollar, based on on-demand cost at [Lambda Labs](https://lambdalabs.com/service/gpu-cloud) (observed on 2/18/2025). diff --git a/config.json b/config.json new file mode 100644 index 0000000..8252459 --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7e375be6515d901db874f4857cfd8c68a1f64f96c9814972b318de1282ea046 +size 16260 diff --git a/configuration.json b/configuration.json new file mode 100644 index 0000000..bbeeda1 --- /dev/null +++ b/configuration.json @@ -0,0 +1 @@ +{"framework": "pytorch", "task": "text-generation", "allow_remote": true} \ No newline at end of file diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..f40ad03 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,9 @@ +{ + "_from_model_config": true, + "bos_token_id": 151646, + "do_sample": true, + "eos_token_id": 151643, + "temperature": 0.6, + "top_p": 0.95, + "transformers_version": "4.48.0" +} diff --git a/model-00001-of-00004.safetensors b/model-00001-of-00004.safetensors new file mode 100644 index 0000000..0102470 --- /dev/null +++ b/model-00001-of-00004.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:062bead12da833edb2fd0122beb0d6c77d7e769d043f54ff76ecde4bf0da6558 +size 4995436856 diff --git a/model-00002-of-00004.safetensors b/model-00002-of-00004.safetensors new file mode 100644 index 0000000..55eff80 --- /dev/null +++ b/model-00002-of-00004.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef72a16238b353844cff9e4314d11d2744ec33c793f4321556a121ac6e817059 +size 4956808544 diff --git a/model-00003-of-00004.safetensors b/model-00003-of-00004.safetensors new file mode 100644 index 0000000..4f0c044 --- /dev/null +++ b/model-00003-of-00004.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6273444e56023f75564968b5a0604220c81c9a6bb315b4b33d7dc267c22812b +size 4823057400 diff --git a/model-00004-of-00004.safetensors b/model-00004-of-00004.safetensors new file mode 100644 index 0000000..5c49022 --- /dev/null +++ b/model-00004-of-00004.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86de18dbfacc651b42c3828fd70aadbce3f2e3cb9ba8bc27b2c38634caa033d4 +size 1557135488 diff --git a/model.safetensors.index.json b/model.safetensors.index.json new file mode 100644 index 0000000..b659e40 --- /dev/null +++ b/model.safetensors.index.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5c3536ebf41d514dd2f0cf89fa423a1d4cbe999917a4a0666632a852fd3a321 +size 76778 diff --git a/recipe.yaml b/recipe.yaml new file mode 100644 index 0000000..6d75bc2 --- /dev/null +++ b/recipe.yaml @@ -0,0 +1,21 @@ +quant_stage: + quant_modifiers: + SmoothQuantModifier: + smoothing_strength: 0.8 + mappings: + - - ['re:.*q_proj', 're:.*k_proj', 're:.*v_proj'] + - re:.*input_layernorm + - - ['re:.*gate_proj', 're:.*up_proj'] + - re:.*post_attention_layernorm + - - ['re:.*down_proj'] + - re:.*up_proj + GPTQModifier: + sequential_update: true + dampening_frac: 0.1 + ignore: [lm_head] + config_groups: + group_0: + targets: [Linear] + weights: {num_bits: 8, type: int, symmetric: true, strategy: channel, observer: mse} + input_activations: {num_bits: 8, type: int, symmetric: true, strategy: token, dynamic: true, + observer: memoryless} diff --git a/special_tokens_map.json b/special_tokens_map.json new file mode 100644 index 0000000..1d385d6 --- /dev/null +++ b/special_tokens_map.json @@ -0,0 +1,23 @@ +{ + "bos_token": { + "content": "<|begin▁of▁sentence|>", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + }, + "eos_token": { + "content": "<|end▁of▁sentence|>", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + }, + "pad_token": { + "content": "<|end▁of▁sentence|>", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + } +} diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..8e71bf3 --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88145e3c3249adc2546ede277e9819d6e405e19072456e4b521cbc724bd60773 +size 7031660 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..1046e6c --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ac8c85fb242563c2260baec0909debd69d718af6a0b3d90e6cab62b4d341cd5 +size 3071