Text Generation
Transformers
Safetensors
deepseek_v2
deepseek
mla
Mixture of Experts
nvfp4
fp4
quantized
vllm
conversational
custom_code
text-generation-inference
8-bit precision
compressed-tensors
Instructions to use carlyou/DeepSeek-V2-Lite-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use carlyou/DeepSeek-V2-Lite-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="carlyou/DeepSeek-V2-Lite-NVFP4", 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("carlyou/DeepSeek-V2-Lite-NVFP4", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("carlyou/DeepSeek-V2-Lite-NVFP4", 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 carlyou/DeepSeek-V2-Lite-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "carlyou/DeepSeek-V2-Lite-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "carlyou/DeepSeek-V2-Lite-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/carlyou/DeepSeek-V2-Lite-NVFP4
- SGLang
How to use carlyou/DeepSeek-V2-Lite-NVFP4 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 "carlyou/DeepSeek-V2-Lite-NVFP4" \ --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": "carlyou/DeepSeek-V2-Lite-NVFP4", "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 "carlyou/DeepSeek-V2-Lite-NVFP4" \ --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": "carlyou/DeepSeek-V2-Lite-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use carlyou/DeepSeek-V2-Lite-NVFP4 with Docker Model Runner:
docker model run hf.co/carlyou/DeepSeek-V2-Lite-NVFP4
Add DeepSeek-V2-Lite quantized to NVFP4 via llm-compressor
Browse files
README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: deepseek-license
|
| 4 |
+
license_link: https://github.com/deepseek-ai/DeepSeek-V2/blob/main/LICENSE-MODEL
|
| 5 |
+
base_model: deepseek-ai/DeepSeek-V2-Lite
|
| 6 |
+
library_name: transformers
|
| 7 |
+
tags:
|
| 8 |
+
- deepseek
|
| 9 |
+
- mla
|
| 10 |
+
- moe
|
| 11 |
+
- nvfp4
|
| 12 |
+
- fp4
|
| 13 |
+
- quantized
|
| 14 |
+
- vllm
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
model-index:
|
| 17 |
+
- name: DeepSeek-V2-Lite-NVFP4
|
| 18 |
+
results: []
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# DeepSeek-V2-Lite-NVFP4
|
| 22 |
+
|
| 23 |
+
NVFP4 (W4A4) quantized version of [deepseek-ai/DeepSeek-V2-Lite](https://huggingface.co/deepseek-ai/DeepSeek-V2-Lite), quantized using [llm-compressor](https://github.com/vllm-project/llm-compressor).
|
| 24 |
+
|
| 25 |
+
## Model Details
|
| 26 |
+
|
| 27 |
+
| | |
|
| 28 |
+
|---|---|
|
| 29 |
+
| **Base model** | deepseek-ai/DeepSeek-V2-Lite (15.7B params) |
|
| 30 |
+
| **Architecture** | DeepseekV2ForCausalLM (MLA attention + MoE) |
|
| 31 |
+
| **Quantization** | NVFP4 — 4-bit floating point weights and activations |
|
| 32 |
+
| **Format** | compressed-tensors (nvfp4-pack-quantized) |
|
| 33 |
+
| **Size** | ~8.9 GB (3.5x compression from BF16) |
|
| 34 |
+
| **Group size** | 16 |
|
| 35 |
+
| **Scale dtype** | float8_e4m3fn |
|
| 36 |
+
|
| 37 |
+
## Quantization Details
|
| 38 |
+
|
| 39 |
+
- **Method**: Post-training quantization (PTQ) via `llm-compressor` `oneshot`
|
| 40 |
+
- **Scheme**: NVFP4 — weights and input activations quantized to 4-bit float
|
| 41 |
+
- **Calibration**: 20 samples from [HuggingFaceFW/fineweb-edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu) (sample-10BT)
|
| 42 |
+
- **Ignored layers**: `lm_head` (kept in original precision)
|
| 43 |
+
- **Scales**: per-tensor global scale (FP32) + per-group local scale (FP8, group size 16)
|
| 44 |
+
|
| 45 |
+
## Usage with vLLM
|
| 46 |
+
|
| 47 |
+
Requires a GPU with NVFP4 tensor core support (NVIDIA Blackwell, SM100+).
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
vllm serve carlyou/DeepSeek-V2-Lite-NVFP4 \
|
| 51 |
+
--trust-remote-code \
|
| 52 |
+
--max-model-len 2048
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
from vllm import LLM, SamplingParams
|
| 57 |
+
|
| 58 |
+
llm = LLM(
|
| 59 |
+
model="carlyou/DeepSeek-V2-Lite-NVFP4",
|
| 60 |
+
trust_remote_code=True,
|
| 61 |
+
max_model_len=2048,
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
output = llm.generate("Hello, world!", SamplingParams(max_tokens=128))
|
| 65 |
+
print(output[0].outputs[0].text)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Intended Use
|
| 69 |
+
|
| 70 |
+
This model is primarily intended for benchmarking and testing NVFP4 quantization support in vLLM, particularly MLA attention + quantization fusion patterns on Blackwell GPUs.
|
| 71 |
+
|
| 72 |
+
## Limitations
|
| 73 |
+
|
| 74 |
+
- Requires Blackwell GPU (SM100+) for FP4 tensor core acceleration
|
| 75 |
+
- Quantization may degrade output quality compared to FP8 or BF16 versions
|
| 76 |
+
- Not evaluated on standard benchmarks — use for testing/benchmarking only
|