Text Generation
Transformers
Safetensors
qwen3
feature-extraction
dflash
speculative-decoding
block-diffusion
draft-model
efficiency
qwen
diffusion-language-model
custom_code
text-generation-inference
Instructions to use z-lab/Qwen3-Coder-Next-DFlash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use z-lab/Qwen3-Coder-Next-DFlash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="z-lab/Qwen3-Coder-Next-DFlash", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("z-lab/Qwen3-Coder-Next-DFlash", trust_remote_code=True) model = AutoModel.from_pretrained("z-lab/Qwen3-Coder-Next-DFlash", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use z-lab/Qwen3-Coder-Next-DFlash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "z-lab/Qwen3-Coder-Next-DFlash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "z-lab/Qwen3-Coder-Next-DFlash", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/z-lab/Qwen3-Coder-Next-DFlash
- SGLang
How to use z-lab/Qwen3-Coder-Next-DFlash 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 "z-lab/Qwen3-Coder-Next-DFlash" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "z-lab/Qwen3-Coder-Next-DFlash", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "z-lab/Qwen3-Coder-Next-DFlash" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "z-lab/Qwen3-Coder-Next-DFlash", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use z-lab/Qwen3-Coder-Next-DFlash with Docker Model Runner:
docker model run hf.co/z-lab/Qwen3-Coder-Next-DFlash
Update README.md
Browse files
README.md
CHANGED
|
@@ -26,18 +26,33 @@ tags:
|
|
| 26 |
|
| 27 |
### Installation
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
```bash
|
| 30 |
uv pip install "git+https://github.com/sgl-project/sglang.git@refs/pull/20547/head#subdirectory=python"
|
| 31 |
```
|
| 32 |
|
| 33 |
### Launch Server
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
|
|
|
| 37 |
```bash
|
| 38 |
-
|
| 39 |
-
export
|
| 40 |
-
export
|
|
|
|
| 41 |
|
| 42 |
python -m sglang.launch_server \
|
| 43 |
--model-path Qwen/Qwen3-Coder-Next \
|
|
@@ -50,7 +65,6 @@ python -m sglang.launch_server \
|
|
| 50 |
--mamba-scheduler-strategy extra_buffer \
|
| 51 |
--trust-remote-code
|
| 52 |
```
|
| 53 |
-
|
| 54 |
> **Tip:** For long-context or agentic workloads, add `--speculative-dflash-draft-window-size WINDOW_SIZE` to enable sliding-window attention for the drafter.
|
| 55 |
|
| 56 |
### Usage
|
|
@@ -68,10 +82,6 @@ response = client.chat.completions.create(
|
|
| 68 |
print(response.choices[0].message.content)
|
| 69 |
```
|
| 70 |
|
| 71 |
-
### vLLM
|
| 72 |
-
|
| 73 |
-
Community-contributed support is available. See PRs [#36847](https://github.com/vllm-project/vllm/pull/36847) and [#36767](https://github.com/vllm-project/vllm/pull/36767) for details.
|
| 74 |
-
|
| 75 |
## Acceptance Length
|
| 76 |
|
| 77 |
- Max new tokens: 4096
|
|
|
|
| 26 |
|
| 27 |
### Installation
|
| 28 |
|
| 29 |
+
vLLM:
|
| 30 |
+
```bash
|
| 31 |
+
uv pip install vllm
|
| 32 |
+
uv pip install -U vllm --torch-backend=auto --extra-index-url https://wheels.vllm.ai/nightly
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
SGLang:
|
| 36 |
```bash
|
| 37 |
uv pip install "git+https://github.com/sgl-project/sglang.git@refs/pull/20547/head#subdirectory=python"
|
| 38 |
```
|
| 39 |
|
| 40 |
### Launch Server
|
| 41 |
|
| 42 |
+
vLLM:
|
| 43 |
+
```bash
|
| 44 |
+
vllm serve Qwen/Qwen3-Coder-Next \
|
| 45 |
+
--speculative-config '{"method": "dflash", "model": "z-lab/Qwen3-Coder-Next-DFlash", "num_speculative_tokens": 15}' \
|
| 46 |
+
--attention-backend flash_attn \
|
| 47 |
+
--max-num-batched-tokens 32768
|
| 48 |
+
```
|
| 49 |
|
| 50 |
+
SGLang:
|
| 51 |
```bash
|
| 52 |
+
# Optional: enable schedule overlapping (experimental, may not be stable)
|
| 53 |
+
# export SGLANG_ENABLE_SPEC_V2=1
|
| 54 |
+
# export SGLANG_ENABLE_DFLASH_SPEC_V2=1
|
| 55 |
+
# export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1
|
| 56 |
|
| 57 |
python -m sglang.launch_server \
|
| 58 |
--model-path Qwen/Qwen3-Coder-Next \
|
|
|
|
| 65 |
--mamba-scheduler-strategy extra_buffer \
|
| 66 |
--trust-remote-code
|
| 67 |
```
|
|
|
|
| 68 |
> **Tip:** For long-context or agentic workloads, add `--speculative-dflash-draft-window-size WINDOW_SIZE` to enable sliding-window attention for the drafter.
|
| 69 |
|
| 70 |
### Usage
|
|
|
|
| 82 |
print(response.choices[0].message.content)
|
| 83 |
```
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
## Acceptance Length
|
| 86 |
|
| 87 |
- Max new tokens: 4096
|