Text Generation
Transformers
Safetensors
English
deepseek_v2
quantized
int8
w8a8
dynamic-quantization
8-bit precision
llm-compressor
zendnn
compressed-tensors
amd
cpu-inference
conversational
custom_code
text-generation-inference
Instructions to use amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor
- SGLang
How to use amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor with Docker Model Runner:
docker model run hf.co/amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor
|
Download README.md from amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor: direct link, hf CLI and curl.
- Browser
- Download file 5.85 kB
-
https://huggingface.co/amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor/resolve/main/README.md
- Command line
-
hf download hf://amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor/README.md
-
curl -L -o README.md https://huggingface.co/amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor/resolve/main/README.md
5.85 kB
| license: other | |
| license_name: deepseek-license | |
| license_link: LICENSE | |
| base_model: | |
| - deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct | |
| base_model_relation: quantized | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - quantized | |
| - int8 | |
| - w8a8 | |
| - dynamic-quantization | |
| - 8-bit | |
| - llm-compressor | |
| - zendnn | |
| - compressed-tensors | |
| - amd | |
| - cpu-inference | |
| language: | |
| - en | |
| # DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor | |
| ## Model Overview | |
| - **Model Architecture:** DeepseekV2ForCausalLM | |
| - **Input:** Text | |
| - **Output:** Text | |
| - **Source Model:** [DeepSeek-Coder-V2-Lite-Instruct](https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct) | |
| - **Supported Hardware:** AMD EPYC (CPU inference) | |
| - **Preferred Operating System:** Linux | |
| - **Inference Engine:** [vLLM](https://docs.vllm.ai/en/latest/) v0.33.0 | |
| - **Quantization Framework:** [LLM Compressor](https://github.com/vllm-project/llm-compressor) v0.14.0 | |
| - **Quantization Method:** 8-bit Weight, 8-bit Dynamic Activation Quantization (W8A8) | |
| - **Compatible Stack:** | |
| - ZenDNN v6.2.0 | |
| - ZenTorch v2.14.0.3 | |
| - PyTorch v2.14.0+cpu | |
| - Transformers v5.17.0 | |
| - LLM Compressor v0.14.0 | |
| - vLLM v0.33.0 | |
| - **Published with:** LLM Compressor v0.14.0 | |
| This is a quantized version of [DeepSeek-Coder-V2-Lite-Instruct](https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct) created by AMD using LLM Compressor (compressed-tensors) for ZenDNN-optimized CPU inference. | |
| ## Quantization | |
| The model was quantized from [DeepSeek-Coder-V2-Lite-Instruct](https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct) using [LLM Compressor](https://github.com/vllm-project/llm-compressor) via the Round-to-Nearest (RTN) algorithm. This reduces the model weights from 29.3 GiB to 15.0 GiB on disk (~49% reduction). | |
| - **Method:** 8-bit Weight, 8-bit Dynamic Activation Quantization (W8A8) | |
| - **Config:** `compressed-tensors, num_bits=8, type=int, symmetric=true` | |
| - **Weights:** INT8, symmetric, per-channel (static) | |
| - **Activations:** INT8, symmetric, per-token (dynamic) | |
| - **Quantized:** `model.layers.*.mlp.experts.*.up_proj` (1664), `model.layers.*.mlp.experts.*.gate_proj` (1664), `model.layers.*.mlp.experts.*.down_proj` (1664), `model.layers.*.self_attn.q_proj` (27), `model.layers.*.self_attn.kv_a_proj_with_mqa` (27), `model.layers.*.self_attn.kv_b_proj` (27), `model.layers.*.self_attn.o_proj` (27), `model.layers.*.mlp.shared_experts.gate_proj` (26), `model.layers.*.mlp.shared_experts.up_proj` (26), `model.layers.*.mlp.shared_experts.down_proj` (26), `model.layers.*.mlp.gate_proj` (1), `model.layers.*.mlp.up_proj` (1) | |
| - **Kept in BF16:** `lm_head` (1), `embed_tokens`, and the layer norms | |
| ```python | |
| import torch | |
| import transformers | |
| from transformers import AutoConfig, AutoTokenizer | |
| from llmcompressor import oneshot | |
| from llmcompressor.modifiers.quantization import QuantizationModifier | |
| from llmcompressor.utils import load_context | |
| model_id = "deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct" | |
| output_dir = "./DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor" | |
| # Step 1: Load the BF16 model and tokenizer. | |
| model_cls = transformers.AutoModelForCausalLM | |
| with load_context(model_cls): | |
| model = model_cls.from_pretrained(model_id, dtype=torch.bfloat16, trust_remote_code=False) | |
| tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=False) | |
| # Step 2: W8A8 recipe. Round-to-nearest is data-free, so no calibration set is needed. | |
| recipe = QuantizationModifier( | |
| scheme="W8A8", | |
| targets=["Linear"], | |
| ignore=[ | |
| 'lm_head', | |
| 're:.*lm_head', | |
| ], | |
| ) | |
| # Step 3: One-shot quantize. | |
| oneshot(model=model, recipe=recipe) | |
| # Save in compressed-tensors format. | |
| model.save_pretrained(output_dir, save_compressed=True) | |
| tokenizer.save_pretrained(output_dir) | |
| ``` | |
| ## Quick Start | |
| ### Use with vLLM | |
| ```python | |
| from vllm import LLM, SamplingParams | |
| model = LLM( | |
| model="amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor", | |
| dtype="bfloat16", | |
| ) | |
| sampling_params = SamplingParams(temperature=0.7, max_tokens=256) | |
| outputs = model.generate(["Hello, how are you?"], sampling_params) | |
| print(outputs[0].outputs[0].text) | |
| ``` | |
| ### Requirements | |
| ``` | |
| torch==2.14.0+cpu | |
| zentorch==2.14.0.3 | |
| vllm==0.33.0 | |
| llmcompressor==0.14.0 | |
| ``` | |
| ### OpenMP Setup | |
| For optimal performance, set `LD_PRELOAD` with `libomp.so` (LLVM OpenMP) or `libiomp5.so` (Intel OpenMP): | |
| ```bash | |
| # Using LLVM OpenMP (llvmopenmp) | |
| export LD_PRELOAD=$(find /path/to/env -name "libomp.so" | head -1) | |
| # Or using Intel OpenMP (libiomp) | |
| export LD_PRELOAD=$(find /path/to/env -name "libiomp5.so" | head -1) | |
| ``` | |
| > **Note:** Set `LD_PRELOAD` before launching vLLM or any inference script. | |
| ## Evaluation | |
| The model was evaluated against the BF16 (unquantized) baseline on standard benchmarks using [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) with the vLLM engine. | |
| | Benchmark | BF16 Baseline | W8A8 (this model) | Recovery | | |
| | --- | --- | --- | --- | | |
| | GSM8K (5-shot) | 0.5322 | 0.5428 | 101.99% | | |
| ### Evaluation Command | |
| ```bash | |
| lm_eval \ | |
| --model vllm \ | |
| --model_args pretrained=amd/DeepSeek-Coder-V2-Lite-Instruct-w8a8-llmcompressor,dtype=bfloat16 \ | |
| --tasks gsm8k \ | |
| --batch_size auto \ | |
| --trust_remote_code \ | |
| --num_fewshot 5 \ | |
| --apply_chat_template \ | |
| --log_samples \ | |
| --gen_kwargs "max_gen_toks=2048" \ | |
| --output_path . | |
| ``` | |
| ## Limitations | |
| - **Version Lock:** This model is compatible with ZenDNN v6.2.0 / ZenTorch v2.14.0.3 / PyTorch v2.14.0+cpu. It may not load correctly on other versions. | |
| - **CPU Only:** This model is optimized for AMD EPYC CPU inference via ZenDNN. It is not intended for GPU inference. | |
| ## License | |
| This model is distributed under the same license as the source model. See the [LICENSE](./LICENSE) file for details. | |
| Modifications copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved. |