Text Generation
MLX
Safetensors
hunyuan_v1_dense
mlx-my-repo
hunyuan
translation
conversational
4-bit precision
Instructions to use illitan/Hy-MT2-1.8B-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use illitan/Hy-MT2-1.8B-4bit 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("illitan/Hy-MT2-1.8B-4bit") 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
- LM Studio
- MLX LM
How to use illitan/Hy-MT2-1.8B-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "illitan/Hy-MT2-1.8B-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "illitan/Hy-MT2-1.8B-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "illitan/Hy-MT2-1.8B-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }'
| { | |
| "add_classification_head": false, | |
| "architectures": [ | |
| "HunYuanDenseV1ForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "attention_head_dim": 128, | |
| "bos_token_id": 120000, | |
| "cla_share_factor": 2, | |
| "class_num": 0, | |
| "dense_list": [ | |
| 2048, | |
| 0 | |
| ], | |
| "eos_token_id": 120020, | |
| "head_dim": 128, | |
| "hidden_act": "silu", | |
| "hidden_size": 2048, | |
| "im_end_id": 5, | |
| "im_newline_id": 11, | |
| "im_start_id": 4, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 6144, | |
| "mask_init_id": 12, | |
| "max_position_embeddings": 262144, | |
| "mlp_bias": false, | |
| "model_type": "hunyuan_v1_dense", | |
| "norm_type": "rms", | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 32, | |
| "num_key_value_heads": 4, | |
| "org_vocab_size": 120818, | |
| "pad_id": 120002, | |
| "pad_token_id": 120002, | |
| "pool_type": "last", | |
| "pretraining_tp": 1, | |
| "quantization": { | |
| "group_size": 64, | |
| "bits": 4, | |
| "mode": "affine" | |
| }, | |
| "quantization_config": { | |
| "group_size": 64, | |
| "bits": 4, | |
| "mode": "affine" | |
| }, | |
| "rms_norm_eps": 1e-05, | |
| "rope_scaling": { | |
| "alpha": 1000.0, | |
| "beta_fast": 32, | |
| "beta_slow": 1, | |
| "factor": 1.0, | |
| "mscale": 1.0, | |
| "mscale_all_dim": 1.0, | |
| "type": "dynamic" | |
| }, | |
| "rope_theta": 10000.0, | |
| "sep_token_id": 120007, | |
| "text_end_id": 7, | |
| "text_start_id": 6, | |
| "tie_word_embeddings": true, | |
| "torch_dtype": "bfloat16", | |
| "transformers_version": "4.57.6", | |
| "use_cache": true, | |
| "use_cla": false, | |
| "use_qk_norm": true, | |
| "use_rotary_pos_emb": true, | |
| "vocab_size": 120818 | |
| } |