Text Generation
Transformers
Safetensors
English
Chinese
wedlm
language model
parallel-decoding
conversational
custom_code
Instructions to use tencent/WeDLM-8B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/WeDLM-8B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/WeDLM-8B-Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("tencent/WeDLM-8B-Instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tencent/WeDLM-8B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/WeDLM-8B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tencent/WeDLM-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/WeDLM-8B-Instruct
- SGLang
How to use tencent/WeDLM-8B-Instruct 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 "tencent/WeDLM-8B-Instruct" \ --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": "tencent/WeDLM-8B-Instruct", "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 "tencent/WeDLM-8B-Instruct" \ --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": "tencent/WeDLM-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/WeDLM-8B-Instruct with Docker Model Runner:
docker model run hf.co/tencent/WeDLM-8B-Instruct
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -12,7 +12,7 @@ tags:
|
|
| 12 |
|
| 13 |
# WeDLM-8B-Instruct β
|
| 14 |
|
| 15 |
-
**WeDLM-8B-Instruct** is our flagship instruction-tuned diffusion language model that performs parallel decoding under standard causal attention, fine-tuned from [WeDLM-8B](https://huggingface.co/tencent/WeDLM-8B).
|
| 16 |
|
| 17 |
**Highlights:**
|
| 18 |
- π 3-6Γ faster than vLLM-optimized Qwen3-8B on math reasoning tasks
|
|
@@ -21,7 +21,7 @@ tags:
|
|
| 21 |
|
| 22 |
For the base (pretrained) version, see [WeDLM-8B](https://huggingface.co/tencent/WeDLM-8B-Base), which is based on Qwen3-8B-Base.
|
| 23 |
|
| 24 |
-
π Paper
|
| 25 |
|
| 26 |
## Model Details
|
| 27 |
|
|
@@ -31,14 +31,57 @@ For the base (pretrained) version, see [WeDLM-8B](https://huggingface.co/tencent
|
|
| 31 |
| Parameters | 8B |
|
| 32 |
| Context Length | 32,768 |
|
| 33 |
|
| 34 |
-
##
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
```bash
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
```
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
```python
|
| 43 |
from transformers import AutoTokenizer
|
| 44 |
from wedlm import LLM, SamplingParams
|
|
@@ -129,8 +172,16 @@ Speedup varies by task characteristics (measured against vLLM-optimized Qwen3-8B
|
|
| 129 |
| Code Generation | 2-3Γ | Deterministic syntax |
|
| 130 |
| Open-ended QA | 1.5-2Γ | Higher entropy limits parallelism |
|
| 131 |
|
| 132 |
-
## Citation
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
## License
|
| 136 |
|
|
|
|
| 12 |
|
| 13 |
# WeDLM-8B-Instruct β
|
| 14 |
|
| 15 |
+
**WeDLM-8B-Instruct** is our flagship instruction-tuned diffusion language model that performs parallel decoding under standard causal attention, fine-tuned from [WeDLM-8B](https://huggingface.co/tencent/WeDLM-8B-Base).
|
| 16 |
|
| 17 |
**Highlights:**
|
| 18 |
- π 3-6Γ faster than vLLM-optimized Qwen3-8B on math reasoning tasks
|
|
|
|
| 21 |
|
| 22 |
For the base (pretrained) version, see [WeDLM-8B](https://huggingface.co/tencent/WeDLM-8B-Base), which is based on Qwen3-8B-Base.
|
| 23 |
|
| 24 |
+
π [Paper](https://arxiv.org/abs/2512.22737) | π [Project Page](https://wedlm.github.io) | π» [GitHub](https://github.com/tencent/WeDLM)
|
| 25 |
|
| 26 |
## Model Details
|
| 27 |
|
|
|
|
| 31 |
| Parameters | 8B |
|
| 32 |
| Context Length | 32,768 |
|
| 33 |
|
| 34 |
+
## Installation
|
| 35 |
|
| 36 |
+
```bash
|
| 37 |
+
git clone https://github.com/tencent/WeDLM.git
|
| 38 |
+
cd WeDLM && bash install.sh
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
<details>
|
| 42 |
+
<summary><b>Manual Installation</b></summary>
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
# Step 1: PyTorch
|
| 46 |
+
pip install torch==2.8.0+cu129 --index-url https://download.pytorch.org/whl/cu129
|
| 47 |
+
|
| 48 |
+
# Step 2: flash-attn build dependencies
|
| 49 |
+
pip install psutil ninja packaging
|
| 50 |
+
|
| 51 |
+
# Step 3: flash-attn (requires torch first)
|
| 52 |
+
pip install flash-attn==2.7.4.post1 --no-build-isolation
|
| 53 |
+
|
| 54 |
+
# Step 4: WeDLM
|
| 55 |
+
git clone https://github.com/tencent/WeDLM.git
|
| 56 |
+
cd WeDLM && pip install -e .
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
</details>
|
| 60 |
+
|
| 61 |
+
<details>
|
| 62 |
+
<summary><b>Docker Installation</b></summary>
|
| 63 |
|
| 64 |
```bash
|
| 65 |
+
# Pull the Docker image
|
| 66 |
+
docker pull aiweiliu/wedlm:v3
|
| 67 |
+
|
| 68 |
+
# Run the container with GPU support
|
| 69 |
+
docker run -it --gpus all -p 8080:8080 --name wedlm aiweiliu/wedlm:v3 /bin/bash
|
| 70 |
+
|
| 71 |
+
# Inside the container, run inference directly
|
| 72 |
+
python example.py --model tencent/WeDLM-8B-Instruct
|
| 73 |
```
|
| 74 |
|
| 75 |
+
</details>
|
| 76 |
+
|
| 77 |
+
> **Note:** `flash-attn` requires compilation and must be installed after PyTorch.
|
| 78 |
+
> The `install.sh` script handles this automatically (default: CUDA 12.9).
|
| 79 |
+
> For other CUDA versions: `CUDA_VERSION=cu124 bash install.sh`
|
| 80 |
+
|
| 81 |
+
## Quick Start (Recommended)
|
| 82 |
+
|
| 83 |
+
For **fast inference**, use the `wedlm` engine:
|
| 84 |
+
|
| 85 |
```python
|
| 86 |
from transformers import AutoTokenizer
|
| 87 |
from wedlm import LLM, SamplingParams
|
|
|
|
| 172 |
| Code Generation | 2-3Γ | Deterministic syntax |
|
| 173 |
| Open-ended QA | 1.5-2Γ | Higher entropy limits parallelism |
|
| 174 |
|
| 175 |
+
## Citation
|
| 176 |
|
| 177 |
+
```bibtex
|
| 178 |
+
@article{liu2025wedlm,
|
| 179 |
+
title={WeDLM: Reconciling Diffusion Language Models with Standard Causal Attention for Fast Inference},
|
| 180 |
+
author={Liu, Aiwei and He, Minghua and Zeng, Shaoxun and Zhang, Linhao and Wu, Chuhan and Jia, Wei and Liu, Yuan and Yu, Yang and Zhou, Xiao and Zhou, Jie},
|
| 181 |
+
journal={arXiv preprint arXiv:2512.22737},
|
| 182 |
+
year={2025}
|
| 183 |
+
}
|
| 184 |
+
```
|
| 185 |
|
| 186 |
## License
|
| 187 |
|