Text Generation
Transformers
Safetensors
qwen3
feature-extraction
dflash
speculative-decoding
diffusion
efficiency
flash-decoding
qwen
diffusion-language-model
custom_code
text-generation-inference
Instructions to use z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat", trust_remote_code=True) model = AutoModel.from_pretrained("z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat" # 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/LLaMA3.1-8B-Instruct-DFlash-UltraChat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat
- SGLang
How to use z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat 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/LLaMA3.1-8B-Instruct-DFlash-UltraChat" \ --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/LLaMA3.1-8B-Instruct-DFlash-UltraChat", "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/LLaMA3.1-8B-Instruct-DFlash-UltraChat" \ --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/LLaMA3.1-8B-Instruct-DFlash-UltraChat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat with Docker Model Runner:
docker model run hf.co/z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat
Update README.md
Browse files
README.md
CHANGED
|
@@ -30,19 +30,18 @@ This model is the **drafter** component. It must be used in conjunction with the
|
|
| 30 |
## 🚀 Quick Start
|
| 31 |
|
| 32 |
### SGLang
|
| 33 |
-
DFlash is now supported on SGLang. And vLLM integration is currently in progress.
|
| 34 |
|
| 35 |
#### Installation
|
| 36 |
```bash
|
| 37 |
uv pip install "git+https://github.com/sgl-project/sglang.git@refs/pull/20547/head#subdirectory=python"
|
| 38 |
```
|
| 39 |
|
| 40 |
-
####
|
| 41 |
```bash
|
| 42 |
-
|
| 43 |
-
export
|
| 44 |
-
export
|
| 45 |
-
export
|
| 46 |
|
| 47 |
python -m sglang.launch_server \
|
| 48 |
--model-path meta-llama/Llama-3.1-8B-Instruct \
|
|
@@ -55,6 +54,56 @@ python -m sglang.launch_server \
|
|
| 55 |
--trust-remote-code
|
| 56 |
```
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
### Transformers
|
| 59 |
|
| 60 |
#### Installation
|
|
|
|
| 30 |
## 🚀 Quick Start
|
| 31 |
|
| 32 |
### SGLang
|
|
|
|
| 33 |
|
| 34 |
#### Installation
|
| 35 |
```bash
|
| 36 |
uv pip install "git+https://github.com/sgl-project/sglang.git@refs/pull/20547/head#subdirectory=python"
|
| 37 |
```
|
| 38 |
|
| 39 |
+
#### Launch Server
|
| 40 |
```bash
|
| 41 |
+
# Optional: enable schedule overlapping (experimental, may not be stable)
|
| 42 |
+
# export SGLANG_ENABLE_SPEC_V2=1
|
| 43 |
+
# export SGLANG_ENABLE_DFLASH_SPEC_V2=1
|
| 44 |
+
# export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1
|
| 45 |
|
| 46 |
python -m sglang.launch_server \
|
| 47 |
--model-path meta-llama/Llama-3.1-8B-Instruct \
|
|
|
|
| 54 |
--trust-remote-code
|
| 55 |
```
|
| 56 |
|
| 57 |
+
#### Usage
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
from openai import OpenAI
|
| 61 |
+
|
| 62 |
+
client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")
|
| 63 |
+
|
| 64 |
+
response = client.chat.completions.create(
|
| 65 |
+
model="meta-llama/Llama-3.1-8B-Instruct",
|
| 66 |
+
messages=[{"role": "user", "content": "Write a quicksort in Python."}],
|
| 67 |
+
max_tokens=2048,
|
| 68 |
+
temperature=0.0,
|
| 69 |
+
)
|
| 70 |
+
print(response.choices[0].message.content)
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
### vLLM
|
| 74 |
+
|
| 75 |
+
#### Installation
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
uv pip install vllm
|
| 79 |
+
uv pip install -U vllm --torch-backend=auto --extra-index-url https://wheels.vllm.ai/nightly
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
#### Launch Server
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
vllm serve meta-llama/Llama-3.1-8B-Instruct \
|
| 86 |
+
--speculative-config '{"method": "dflash", "model": "z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat", "num_speculative_tokens": 9}' \
|
| 87 |
+
--attention-backend flash_attn \
|
| 88 |
+
--max-num-batched-tokens 32768
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
#### Usage
|
| 92 |
+
|
| 93 |
+
```python
|
| 94 |
+
from openai import OpenAI
|
| 95 |
+
|
| 96 |
+
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
|
| 97 |
+
|
| 98 |
+
response = client.chat.completions.create(
|
| 99 |
+
model="meta-llama/Llama-3.1-8B-Instruct",
|
| 100 |
+
messages=[{"role": "user", "content": "Write a quicksort in Python."}],
|
| 101 |
+
max_tokens=2048,
|
| 102 |
+
temperature=0.0,
|
| 103 |
+
)
|
| 104 |
+
print(response.choices[0].message.content)
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
### Transformers
|
| 108 |
|
| 109 |
#### Installation
|