Text Generation
Transformers
Safetensors
hy_v4
hunyuan
hy4
Mixture of Experts
fp8
quantized
conversational
modelopt
Instructions to use tencent/Hy4-preview-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hy4-preview-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/Hy4-preview-FP8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("tencent/Hy4-preview-FP8", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tencent/Hy4-preview-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/Hy4-preview-FP8" # 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/Hy4-preview-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/Hy4-preview-FP8
- SGLang
How to use tencent/Hy4-preview-FP8 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/Hy4-preview-FP8" \ --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/Hy4-preview-FP8", "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/Hy4-preview-FP8" \ --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/Hy4-preview-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/Hy4-preview-FP8 with Docker Model Runner:
docker model run hf.co/tencent/Hy4-preview-FP8
Update vLLM recipe
Browse files
README.md
CHANGED
|
@@ -169,31 +169,7 @@ For production serving, we recommend using [vLLM](https://github.com/vllm-projec
|
|
| 169 |
|
| 170 |
### vLLM
|
| 171 |
|
| 172 |
-
|
| 173 |
-
```bash
|
| 174 |
-
uv venv --python 3.12 --seed --managed-python
|
| 175 |
-
source .venv/bin/activate
|
| 176 |
-
git clone https://github.com/vllm-project/vllm.git
|
| 177 |
-
cd vllm
|
| 178 |
-
uv pip install --editable . --torch-backend=auto
|
| 179 |
-
```
|
| 180 |
-
|
| 181 |
-
Start the vLLM server with MTP enabled:
|
| 182 |
-
|
| 183 |
-
```bash
|
| 184 |
-
vllm serve tencent/Hy4-preview-FP8 \
|
| 185 |
-
--tensor-parallel-size 8 \
|
| 186 |
-
--speculative-config.method mtp \
|
| 187 |
-
--speculative-config.num_speculative_tokens 3 \
|
| 188 |
-
--attention-backend FLASHMLA_SPARSE \
|
| 189 |
-
--tool-call-parser hy_v4 \
|
| 190 |
-
--reasoning-parser hy_v4 \
|
| 191 |
-
--enable-auto-tool-choice \
|
| 192 |
-
--port 8000 \
|
| 193 |
-
--served-model-name hy4-preview
|
| 194 |
-
```
|
| 195 |
-
|
| 196 |
-
Or use official prebuilt image `vllm/vllm-openai:hy4-preview`:
|
| 197 |
|
| 198 |
```bash
|
| 199 |
docker run --gpus all \
|
|
|
|
| 169 |
|
| 170 |
### vLLM
|
| 171 |
|
| 172 |
+
Use official prebuilt image `vllm/vllm-openai:hy4-preview`:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
```bash
|
| 175 |
docker run --gpus all \
|