Instructions to use tencent/Hunyuan-4B-Instruct-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hunyuan-4B-Instruct-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/Hunyuan-4B-Instruct-FP8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tencent/Hunyuan-4B-Instruct-FP8") model = AutoModelForCausalLM.from_pretrained("tencent/Hunyuan-4B-Instruct-FP8") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use tencent/Hunyuan-4B-Instruct-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/Hunyuan-4B-Instruct-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/Hunyuan-4B-Instruct-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/Hunyuan-4B-Instruct-FP8
- SGLang
How to use tencent/Hunyuan-4B-Instruct-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/Hunyuan-4B-Instruct-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/Hunyuan-4B-Instruct-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/Hunyuan-4B-Instruct-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/Hunyuan-4B-Instruct-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/Hunyuan-4B-Instruct-FP8 with Docker Model Runner:
docker model run hf.co/tencent/Hunyuan-4B-Instruct-FP8
Upload angelslim_config.json with huggingface_hub
Browse files- angelslim_config.json +5 -5
angelslim_config.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
"compression_config": {
|
| 12 |
"name": "PTQ",
|
| 13 |
"quantization": {
|
| 14 |
-
"name": "
|
| 15 |
"bits": 8,
|
| 16 |
"quant_method": {
|
| 17 |
"weight": "per-tensor",
|
|
@@ -32,9 +32,9 @@
|
|
| 32 |
},
|
| 33 |
"dataset_config": {
|
| 34 |
"name": "TextDataset",
|
| 35 |
-
"data_path": "
|
| 36 |
"max_seq_length": 4096,
|
| 37 |
-
"num_samples":
|
| 38 |
"batch_size": 1,
|
| 39 |
"shuffle": false
|
| 40 |
},
|
|
@@ -49,8 +49,8 @@
|
|
| 49 |
"python": "3.10.14 (main, Mar 6 2025, 18:16:47) [GCC 11.4.0]",
|
| 50 |
"angelslim": {
|
| 51 |
"name": "angelslim",
|
| 52 |
-
"version": "
|
| 53 |
-
"source": "
|
| 54 |
},
|
| 55 |
"torch": {
|
| 56 |
"name": "torch",
|
|
|
|
| 11 |
"compression_config": {
|
| 12 |
"name": "PTQ",
|
| 13 |
"quantization": {
|
| 14 |
+
"name": "fp8_psad",
|
| 15 |
"bits": 8,
|
| 16 |
"quant_method": {
|
| 17 |
"weight": "per-tensor",
|
|
|
|
| 32 |
},
|
| 33 |
"dataset_config": {
|
| 34 |
"name": "TextDataset",
|
| 35 |
+
"data_path": "/",
|
| 36 |
"max_seq_length": 4096,
|
| 37 |
+
"num_samples": 32,
|
| 38 |
"batch_size": 1,
|
| 39 |
"shuffle": false
|
| 40 |
},
|
|
|
|
| 49 |
"python": "3.10.14 (main, Mar 6 2025, 18:16:47) [GCC 11.4.0]",
|
| 50 |
"angelslim": {
|
| 51 |
"name": "angelslim",
|
| 52 |
+
"version": "N/A",
|
| 53 |
+
"source": "Unknown"
|
| 54 |
},
|
| 55 |
"torch": {
|
| 56 |
"name": "torch",
|