Text Generation
Transformers
Safetensors
English
deepseek_v2
quantized
int4
w4a16
weight-only
4-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-w4a16-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-w4a16-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-w4a16-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-w4a16-llmcompressor", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("amd/DeepSeek-Coder-V2-Lite-Instruct-w4a16-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-w4a16-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-w4a16-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-w4a16-llmcompressor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/amd/DeepSeek-Coder-V2-Lite-Instruct-w4a16-llmcompressor
- SGLang
How to use amd/DeepSeek-Coder-V2-Lite-Instruct-w4a16-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-w4a16-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-w4a16-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-w4a16-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-w4a16-llmcompressor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use amd/DeepSeek-Coder-V2-Lite-Instruct-w4a16-llmcompressor with Docker Model Runner:
docker model run hf.co/amd/DeepSeek-Coder-V2-Lite-Instruct-w4a16-llmcompressor
File size: 2,853 Bytes
9c506e5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | {
"model_id": "deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct",
"registry_key": null,
"verified_recipe": false,
"reference_card": null,
"category": null,
"modality": "Text",
"architecture": "DeepseekV2ForCausalLM",
"trust_remote_code": false,
"scheme": "w4a16",
"algorithm": "W4A16: INT4 symmetric group-wise weights (group_size=64), BF16 activations, GPTQ with 128 x 2048 samples from HuggingFaceH4/ultrachat_200k",
"recipe": {
"loader": "causal",
"load_context": true,
"pre_import": null,
"ignore": [
"lm_head",
"re:.*lm_head"
],
"group_size": 64,
"save_processor": false,
"restore_config": false,
"save_mtp": false,
"quantization_format": null,
"calibration": "text",
"sequential_targets": null,
"post_process": null,
"num_samples": 128,
"max_seq_len": 2048,
"dataset": "HuggingFaceH4/ultrachat_200k"
},
"notes": [],
"layers": {
"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,
"model.layers.*.mlp.down_proj": 1
},
"kept_bf16": {
"lm_head": 1
},
"num_quantized": 5181,
"num_kept_bf16": 1,
"fused_expert_tensors_left": 0
},
"source_bytes": 31413626609,
"output_bytes": 8967311096,
"output_dir": "/proj/ai_models/quant_llm-compressor/6.2_testquant/w4a16_genoa/DeepSeek-Coder-V2-Lite-Instruct/DeepSeek-Coder-V2-Lite-Instruct-w4a16-llmcompressor",
"post_process_dir": null,
"smoke_test": "What are we having for dinner?\u201d\n\u201cI don\u2019t know.\u201d\n\u201cWhat do you want?\u201d\n\u201cI don\u2019t know.\u201d\n\u201cWell",
"copied_source_files": [
"configuration_deepseek.py",
"modeling_deepseek.py",
"tokenization_deepseek_fast.py"
],
"shape_dtype_validation": {
"ok": true,
"log": "/proj/ai_models/quant_llm-compressor/6.2_testquant/w4a16_genoa/DeepSeek-Coder-V2-Lite-Instruct/logs/DeepSeek-Coder-V2-Lite-Instruct_w4a16_shape_dtype_validation_20261109_222510.log",
"num_quantized_modules": 5181,
"num_non_quantized_modules": 110,
"errors": []
},
"versions": {
"llmcompressor": "0.14.0",
"compressed-tensors": "0.19.0",
"transformers": "5.17.0",
"torch": "2.13.0+cpu",
"datasets": "5.0.1"
},
"quantization_seconds": 5859.2,
"total_seconds": 6000.6
}
|