Instructions to use tencent/Hunyuan-7B-Instruct-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hunyuan-7B-Instruct-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tencent/Hunyuan-7B-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-7B-Instruct-FP8") model = AutoModelForCausalLM.from_pretrained("tencent/Hunyuan-7B-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-7B-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-7B-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-7B-Instruct-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tencent/Hunyuan-7B-Instruct-FP8
- SGLang
How to use tencent/Hunyuan-7B-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-7B-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-7B-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-7B-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-7B-Instruct-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tencent/Hunyuan-7B-Instruct-FP8 with Docker Model Runner:
docker model run hf.co/tencent/Hunyuan-7B-Instruct-FP8
Upload angelslim_config.json with huggingface_hub
Browse files- angelslim_config.json +67 -0
angelslim_config.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_config": {
|
| 3 |
+
"name": "HunyuanDense",
|
| 4 |
+
"model_path": "/",
|
| 5 |
+
"trust_remote_code": true,
|
| 6 |
+
"torch_dtype": "auto",
|
| 7 |
+
"device_map": "auto",
|
| 8 |
+
"low_cpu_mem_usage": true,
|
| 9 |
+
"use_cache": false
|
| 10 |
+
},
|
| 11 |
+
"compression_config": {
|
| 12 |
+
"name": "PTQ",
|
| 13 |
+
"quantization": {
|
| 14 |
+
"name": "fp8_static",
|
| 15 |
+
"bits": 8,
|
| 16 |
+
"quant_method": {
|
| 17 |
+
"weight": "per-tensor",
|
| 18 |
+
"activation": "per-tensor"
|
| 19 |
+
},
|
| 20 |
+
"quant_helpers": [],
|
| 21 |
+
"smooth_alpha": 0.5,
|
| 22 |
+
"low_memory": false,
|
| 23 |
+
"modules_to_quantize": [],
|
| 24 |
+
"zero_point": true,
|
| 25 |
+
"mse_range": false,
|
| 26 |
+
"ignore_layers": [
|
| 27 |
+
"lm_head",
|
| 28 |
+
"model.embed_tokens"
|
| 29 |
+
],
|
| 30 |
+
"quant_analyse": false
|
| 31 |
+
}
|
| 32 |
+
},
|
| 33 |
+
"dataset_config": {
|
| 34 |
+
"name": "TextDataset",
|
| 35 |
+
"data_path": "./dataset/PTQ_data.jsonl",
|
| 36 |
+
"max_seq_length": 4096,
|
| 37 |
+
"num_samples": 512,
|
| 38 |
+
"batch_size": 1,
|
| 39 |
+
"shuffle": false
|
| 40 |
+
},
|
| 41 |
+
"global_config": {
|
| 42 |
+
"save_path": "/",
|
| 43 |
+
"max_seq_length": 4096,
|
| 44 |
+
"hidden_size": 4096,
|
| 45 |
+
"model_arch_type": "hunyuan_v1_dense",
|
| 46 |
+
"deploy_backend": "vllm"
|
| 47 |
+
},
|
| 48 |
+
"debug_info": {
|
| 49 |
+
"python": "3.10.14 (main, Mar 6 2025, 18:16:47) [GCC 11.4.0]",
|
| 50 |
+
"angelslim": {
|
| 51 |
+
"name": "angelslim",
|
| 52 |
+
"version": "be35620eca8ad4e6bf8263e84cee69d90c7045a4",
|
| 53 |
+
"source": "git"
|
| 54 |
+
},
|
| 55 |
+
"torch": {
|
| 56 |
+
"name": "torch",
|
| 57 |
+
"version": "2.7.0",
|
| 58 |
+
"source": "pip"
|
| 59 |
+
},
|
| 60 |
+
"transformers": {
|
| 61 |
+
"name": "transformers",
|
| 62 |
+
"version": "4.52.4",
|
| 63 |
+
"source": "pip"
|
| 64 |
+
},
|
| 65 |
+
"torch_cuda_version": "12.6"
|
| 66 |
+
}
|
| 67 |
+
}
|