Image-Text-to-Text
MLX
Safetensors
hy_v4_flash
mtp
dfly2
speculative-decoding
hunyuan
hy4-flash
mixture-of-experts
vision-language
quantized
apple-silicon
8-bit precision
conversational
Instructions to use TensorFold/Hy4-flash-MLX-8bit-MTP with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use TensorFold/Hy4-flash-MLX-8bit-MTP with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("TensorFold/Hy4-flash-MLX-8bit-MTP") config = load_config("TensorFold/Hy4-flash-MLX-8bit-MTP") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use TensorFold/Hy4-flash-MLX-8bit-MTP with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TensorFold/Hy4-flash-MLX-8bit-MTP"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "TensorFold/Hy4-flash-MLX-8bit-MTP" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use TensorFold/Hy4-flash-MLX-8bit-MTP with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TensorFold/Hy4-flash-MLX-8bit-MTP"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default TensorFold/Hy4-flash-MLX-8bit-MTP
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use TensorFold/Hy4-flash-MLX-8bit-MTP with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TensorFold/Hy4-flash-MLX-8bit-MTP"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "TensorFold/Hy4-flash-MLX-8bit-MTP" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Download config.json from TensorFold/Hy4-flash-MLX-8bit-MTP: direct link, hf CLI and curl.
- Browser
- Download file 12.1 kB
-
https://huggingface.co/TensorFold/Hy4-flash-MLX-8bit-MTP/resolve/main/config.json
- Command line
-
hf download hf://TensorFold/Hy4-flash-MLX-8bit-MTP/config.json
-
curl -L -o config.json https://huggingface.co/TensorFold/Hy4-flash-MLX-8bit-MTP/resolve/main/config.json
12.1 kB
| { | |
| "architectures": [ | |
| "HYV4FlashForConditionalGeneration" | |
| ], | |
| "dtype": "bfloat16", | |
| "image_end_token_id": 120119, | |
| "image_newline_token_id": 120121, | |
| "image_start_token_id": 120118, | |
| "image_token_id": 120120, | |
| "model_type": "hy_v4_flash", | |
| "processor_class": "HYV4FlashProcessor", | |
| "spatial_merge_size": 2, | |
| "text_config": { | |
| "architectures": [ | |
| "HYV4FlashForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bitwise_backward_align": true, | |
| "bos_token_id": 120000, | |
| "compressed_indexer_candidate_topk": 2048, | |
| "compressed_indexer_compress_ratio": 4, | |
| "compressed_indexer_group_topk": 512, | |
| "compressed_indexer_head_dim": 128, | |
| "compressed_indexer_key_pooling": "gated", | |
| "compressed_indexer_num_attention_heads": 16, | |
| "compressed_indexer_reuse_fine_indexer": false, | |
| "compressed_indexer_skip_fine_select": true, | |
| "compressed_indexer_stage2_query_block_size": 8192, | |
| "compressed_indexer_teacher_pooling_type": "max", | |
| "compressed_indexer_triton_pooling_min_groups": 1, | |
| "compressed_indexer_use_triton_pooling": true, | |
| "dsa_skip_attn_post_norm": false, | |
| "enable_ihc": true, | |
| "enable_lm_head_fp32": true, | |
| "engram_embed_random_seed": 1234, | |
| "engram_fp8_embedding": true, | |
| "engram_isolate_fffd_namespace": false, | |
| "engram_layer_head_vocab_sizes": { | |
| "12": [ | |
| [ | |
| 10312277, | |
| 10312283, | |
| 10312301, | |
| 10312343, | |
| 10312373, | |
| 10312397, | |
| 10312409, | |
| 10312453 | |
| ], | |
| [ | |
| 10312457, | |
| 10312483, | |
| 10312507, | |
| 10312513, | |
| 10312531, | |
| 10312543, | |
| 10312567, | |
| 10312571 | |
| ] | |
| ], | |
| "2": [ | |
| [ | |
| 10312007, | |
| 10312021, | |
| 10312039, | |
| 10312069, | |
| 10312091, | |
| 10312121, | |
| 10312123, | |
| 10312147 | |
| ], | |
| [ | |
| 10312177, | |
| 10312187, | |
| 10312207, | |
| 10312213, | |
| 10312229, | |
| 10312241, | |
| 10312249, | |
| 10312259 | |
| ] | |
| ], | |
| "22": [ | |
| [ | |
| 10312613, | |
| 10312619, | |
| 10312633, | |
| 10312657, | |
| 10312681, | |
| 10312699, | |
| 10312723, | |
| 10312747 | |
| ], | |
| [ | |
| 10312759, | |
| 10312789, | |
| 10312811, | |
| 10312823, | |
| 10312867, | |
| 10312873, | |
| 10312889, | |
| 10312903 | |
| ] | |
| ], | |
| "32": [ | |
| [ | |
| 10312909, | |
| 10312919, | |
| 10312927, | |
| 10312957, | |
| 10312979, | |
| 10313011, | |
| 10313021, | |
| 10313057 | |
| ], | |
| [ | |
| 10313063, | |
| 10313117, | |
| 10313123, | |
| 10313129, | |
| 10313161, | |
| 10313179, | |
| 10313189, | |
| 10313201 | |
| ] | |
| ] | |
| }, | |
| "engram_layer_ids": [ | |
| 2, | |
| 12, | |
| 22, | |
| 32 | |
| ], | |
| "engram_max_ngram_size": 3, | |
| "engram_n_embed_per_ngram": 768, | |
| "engram_n_head_per_ngram": 8, | |
| "engram_pad_id": 120002, | |
| "engram_seed": 0, | |
| "engram_tokenizer_name_or_path": null, | |
| "engram_vocab_map_path": null, | |
| "engram_vocab_size": [ | |
| 10312000, | |
| 10312000 | |
| ], | |
| "eos_token_id": 120025, | |
| "fast_op_fp32_linear_gemm": true, | |
| "first_k_dense_replace": 1, | |
| "full_nope": false, | |
| "gate_groups": 1, | |
| "gate_lora_op": "none", | |
| "gate_lora_rank": null, | |
| "gated_mla": true, | |
| "gating_type": "elementwise", | |
| "hc_eps": 1e-06, | |
| "hc_magnitude": 2.0, | |
| "hc_mult": 4, | |
| "head_dim": 64, | |
| "hidden_act": "silu", | |
| "hidden_size": 3072, | |
| "ihc_kernel_backend": "naive", | |
| "index_head_dim": 128, | |
| "index_n_heads": 16, | |
| "index_topk": 2048, | |
| "indexer_types": [ | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full" | |
| ], | |
| "initializer_range": 0.006, | |
| "intermediate_size": 13824, | |
| "kv_lora_rank": 512, | |
| "layer_types": [ | |
| "deepseek_sparse_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "deepseek_sparse_attention" | |
| ], | |
| "learnable_sink": true, | |
| "learnable_sink_init": 0.0, | |
| "max_position_embeddings": 1048576, | |
| "mlp_layer_types": [ | |
| "dense", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse" | |
| ], | |
| "model_type": "hy_v4_flash", | |
| "moe_aux_loss_coeff": 0.0, | |
| "moe_intermediate_size": 1536, | |
| "moe_router_enable_expert_bias": true, | |
| "moe_router_use_sigmoid": true, | |
| "n_group": 1, | |
| "n_routed_experts": 512, | |
| "n_shared_experts": 1, | |
| "norm_topk_prob": true, | |
| "num_attention_heads": 32, | |
| "num_experts_per_tok": 16, | |
| "num_hidden_layers": 42, | |
| "num_key_value_heads": 32, | |
| "num_nextn_predict_layers": 0, | |
| "o_groups": 1, | |
| "o_lora_op": "none", | |
| "o_lora_rank": null, | |
| "output_router_logits": false, | |
| "pad_token_id": 120002, | |
| "q_lora_rank": 1024, | |
| "qk_head_dim": 256, | |
| "qk_nope_head_dim": 192, | |
| "qk_norm": true, | |
| "qk_rope_head_dim": 64, | |
| "return_bos_score": true, | |
| "return_max_logit": true, | |
| "rms_norm_eps": 1e-05, | |
| "rope_parameters": { | |
| "sliding_attention": { | |
| "mrope_interleaved": true, | |
| "mrope_section": [ | |
| 12, | |
| 10, | |
| 10 | |
| ], | |
| "rope_theta": 10000, | |
| "rope_type": "default" | |
| }, | |
| "deepseek_sparse_attention": { | |
| "mrope_interleaved": true, | |
| "mrope_section": [ | |
| 12, | |
| 10, | |
| 10 | |
| ], | |
| "rope_theta": 10000000, | |
| "rope_type": "default" | |
| } | |
| }, | |
| "routed_expert_hidden_size": 1536, | |
| "routed_scaling_factor": 3.998, | |
| "sandwich_norm": true, | |
| "sliding_window": 512, | |
| "swa_num_attention_heads": 64, | |
| "swa_pattern": [ | |
| 0, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 0 | |
| ], | |
| "swa_qk_head_dim": 256, | |
| "swa_qk_nope_head_dim": 192, | |
| "swa_qk_rope_head_dim": 64, | |
| "swa_v_head_dim": 256, | |
| "swiglu_limit": 10.0, | |
| "tie_word_embeddings": false, | |
| "topk_group": 1, | |
| "use_cache": true, | |
| "use_compressed_indexer": true, | |
| "use_dsa": true, | |
| "use_grouped_mm": false, | |
| "use_mla": true, | |
| "v_head_dim": 256, | |
| "vocab_size": 120832, | |
| "window_size": [ | |
| 511, | |
| 0 | |
| ] | |
| }, | |
| "transformers_version": "5.23.0", | |
| "video_end_token_id": 120123, | |
| "video_start_token_id": 120122, | |
| "video_token_id": 120124, | |
| "vision_config": { | |
| "add_patchemb_bias": true, | |
| "anyres_vit_max_image_size": 2048, | |
| "attention_backend": "hf_align_sdpa", | |
| "attention_dropout": 0.0, | |
| "bias_activation_fusion": true, | |
| "cat_extra_token": 0, | |
| "hidden_act": "gelu", | |
| "hidden_dropout": 0.0, | |
| "hidden_size": 1152, | |
| "img_max_token_num": 4096, | |
| "intermediate_size": 4304, | |
| "interpolate_mode": "bilinear", | |
| "learnable_mlp_pooling_size": 0, | |
| "max_image_size": 2048, | |
| "max_vit_seq_len": 16384, | |
| "min_image_size": 512, | |
| "model_type": "hy_v4_flash", | |
| "num_attention_heads": 16, | |
| "num_channels": 3, | |
| "num_hidden_layers": 27, | |
| "num_key_value_heads": 16, | |
| "out_hidden_size": 3072, | |
| "packed_seq_alignment": 128, | |
| "patch_size": 16, | |
| "perceive_post_norm": false, | |
| "perceive_pre_norm": true, | |
| "projector_type": "rmsnorm_mlp_adapter", | |
| "remove_prenorm": true, | |
| "resize_resolution": 2048, | |
| "rms_norm_eps": 1e-05, | |
| "rope_2d_percent": 1.0, | |
| "rope_2d_theta": 10000.0, | |
| "spatial_merge_size": 2, | |
| "spatial_patch_size": 1, | |
| "temporal_patch_size": 1, | |
| "text_hidden_size": 3072, | |
| "video_max_image_size": 768, | |
| "video_min_image_size": 256, | |
| "video_spatial_compression": false, | |
| "video_temporal_compression": false, | |
| "vision_full_attention": false | |
| }, | |
| "vision_start_token_id": 120118, | |
| "speculative_config": { | |
| "method": "dfly", | |
| "model": "dfly", | |
| "num_speculative_tokens": 5, | |
| "draft_sample_method": "probabilistic" | |
| }, | |
| "dfly_mtp_fusion": "slot0", | |
| "dfly_target_index_topk": 2048, | |
| "dfly_context_local_window": null, | |
| "dfly_enable_hidden_correction": true, | |
| "dfly_num_hidden_layers": 5, | |
| "dfly_mask_token_id": 120009, | |
| "dfly_target_index_layer": [ | |
| 25, | |
| 29, | |
| 33, | |
| 37, | |
| 41 | |
| ], | |
| "dfly_target_kv_layers": [ | |
| 25, | |
| 29, | |
| 33, | |
| 37, | |
| 41 | |
| ], | |
| "quantization": { | |
| "bits": 8, | |
| "group_size": 64, | |
| "mode": "affine", | |
| "model.layers.31.engram_layer.multi_head_embedding.embedding": { | |
| "bits": 8, | |
| "group_size": 32, | |
| "mode": "affine" | |
| }, | |
| "model.layers.21.engram_layer.multi_head_embedding.embedding": { | |
| "bits": 8, | |
| "group_size": 32, | |
| "mode": "affine" | |
| }, | |
| "model.layers.11.engram_layer.multi_head_embedding.embedding": { | |
| "bits": 8, | |
| "group_size": 32, | |
| "mode": "affine" | |
| }, | |
| "model.layers.1.engram_layer.multi_head_embedding.embedding": { | |
| "bits": 8, | |
| "group_size": 32, | |
| "mode": "affine" | |
| } | |
| }, | |
| "quantization_config": { | |
| "bits": 8, | |
| "group_size": 64, | |
| "mode": "affine", | |
| "model.layers.31.engram_layer.multi_head_embedding.embedding": { | |
| "bits": 8, | |
| "group_size": 32, | |
| "mode": "affine" | |
| }, | |
| "model.layers.21.engram_layer.multi_head_embedding.embedding": { | |
| "bits": 8, | |
| "group_size": 32, | |
| "mode": "affine" | |
| }, | |
| "model.layers.11.engram_layer.multi_head_embedding.embedding": { | |
| "bits": 8, | |
| "group_size": 32, | |
| "mode": "affine" | |
| }, | |
| "model.layers.1.engram_layer.multi_head_embedding.embedding": { | |
| "bits": 8, | |
| "group_size": 32, | |
| "mode": "affine" | |
| } | |
| } | |
| } | |