Instructions to use HawkonLi/Hunyuan-A52B-Instruct-2bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HawkonLi/Hunyuan-A52B-Instruct-2bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HawkonLi/Hunyuan-A52B-Instruct-2bit", 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("HawkonLi/Hunyuan-A52B-Instruct-2bit", trust_remote_code=True, device_map="auto") - MLX
How to use HawkonLi/Hunyuan-A52B-Instruct-2bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("HawkonLi/Hunyuan-A52B-Instruct-2bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use HawkonLi/Hunyuan-A52B-Instruct-2bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HawkonLi/Hunyuan-A52B-Instruct-2bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HawkonLi/Hunyuan-A52B-Instruct-2bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/HawkonLi/Hunyuan-A52B-Instruct-2bit
- SGLang
How to use HawkonLi/Hunyuan-A52B-Instruct-2bit 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 "HawkonLi/Hunyuan-A52B-Instruct-2bit" \ --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": "HawkonLi/Hunyuan-A52B-Instruct-2bit", "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 "HawkonLi/Hunyuan-A52B-Instruct-2bit" \ --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": "HawkonLi/Hunyuan-A52B-Instruct-2bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - MLX LM
How to use HawkonLi/Hunyuan-A52B-Instruct-2bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "HawkonLi/Hunyuan-A52B-Instruct-2bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "HawkonLi/Hunyuan-A52B-Instruct-2bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HawkonLi/Hunyuan-A52B-Instruct-2bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use HawkonLi/Hunyuan-A52B-Instruct-2bit with Docker Model Runner:
docker model run hf.co/HawkonLi/Hunyuan-A52B-Instruct-2bit
- Atomic Chat
Download config.json from HawkonLi/Hunyuan-A52B-Instruct-2bit: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/HawkonLi/Hunyuan-A52B-Instruct-2bit/resolve/main/config.json
- Command line
-
hf download hf://HawkonLi/Hunyuan-A52B-Instruct-2bit/config.json
-
curl -L -o config.json https://huggingface.co/HawkonLi/Hunyuan-A52B-Instruct-2bit/resolve/main/config.json
1.44 kB
| { | |
| "architectures": [ | |
| "HunYuanForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "auto_map": { | |
| "AutoConfig": "configuration_hunyuan.HunYuanConfig", | |
| "AutoModel": "modeling_hunyuan.HunyuanModel", | |
| "AutoModelForCausalLM": "modeling_hunyuan.HunYuanForCausalLM" | |
| }, | |
| "bos_token_id": 1, | |
| "capacity_factor": 1.0, | |
| "cla_share_factor": 2, | |
| "eos_token_id": 2, | |
| "hidden_act": "silu", | |
| "hidden_size": 6400, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 18304, | |
| "max_position_embeddings": 131072, | |
| "model_type": "hunyuan", | |
| "moe_drop_tokens": false, | |
| "moe_random_routing_dropped_token": false, | |
| "moe_topk": 1, | |
| "num_attention_heads": 80, | |
| "num_experts": 16, | |
| "num_hidden_layers": 64, | |
| "num_key_value_heads": 8, | |
| "num_shared_expert": 1, | |
| "pad_token_id": 0, | |
| "pretraining_tp": 1, | |
| "quantization": { | |
| "group_size": 128, | |
| "bits": 2 | |
| }, | |
| "quantization_config": { | |
| "group_size": 128, | |
| "bits": 2 | |
| }, | |
| "rms_norm_eps": 1e-05, | |
| "rope_scaling": { | |
| "alpha": 1000.0, | |
| "factor": 1.0, | |
| "type": "dynamic" | |
| }, | |
| "rope_theta": 10000.0, | |
| "tie_word_embeddings": true, | |
| "torch_dtype": "bfloat16", | |
| "transformers_version": "4.45.0.dev0", | |
| "use_cache": true, | |
| "use_cla": true, | |
| "use_mixed_mlp_moe": true, | |
| "use_qk_norm": true, | |
| "vocab_size": 129024 | |
| } |