Image-Text-to-Text
GGUF
llama.cpp
hunyuan
hy4-flash
Mixture of Experts
quantized
conversational
vision
atomic-chat
imatrix
Instructions to use AtomicChat/Hy4-flash-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use AtomicChat/Hy4-flash-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf AtomicChat/Hy4-flash-GGUF:IQ2_XXS # Run inference directly in the terminal: llama cli -hf AtomicChat/Hy4-flash-GGUF:IQ2_XXS
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AtomicChat/Hy4-flash-GGUF:IQ2_XXS # Run inference directly in the terminal: llama cli -hf AtomicChat/Hy4-flash-GGUF:IQ2_XXS
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf AtomicChat/Hy4-flash-GGUF:IQ2_XXS # Run inference directly in the terminal: ./build/bin/llama cli -hf AtomicChat/Hy4-flash-GGUF:IQ2_XXS
Use Docker
docker model run hf.co/AtomicChat/Hy4-flash-GGUF:IQ2_XXS
- Llama new
- LM Studio
- Jan
- vLLM
How to use AtomicChat/Hy4-flash-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AtomicChat/Hy4-flash-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AtomicChat/Hy4-flash-GGUF", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/AtomicChat/Hy4-flash-GGUF:IQ2_XXS
- Ollama
How to use AtomicChat/Hy4-flash-GGUF with Ollama:
ollama run hf.co/AtomicChat/Hy4-flash-GGUF:IQ2_XXS
- Unsloth Desktop
- Pi
How to use AtomicChat/Hy4-flash-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AtomicChat/Hy4-flash-GGUF:IQ2_XXS
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "AtomicChat/Hy4-flash-GGUF:IQ2_XXS" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use AtomicChat/Hy4-flash-GGUF with Docker Model Runner:
docker model run hf.co/AtomicChat/Hy4-flash-GGUF:IQ2_XXS
- Lemonade
How to use AtomicChat/Hy4-flash-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AtomicChat/Hy4-flash-GGUF:IQ2_XXS
Run and chat with the model
lemonade run user.Hy4-flash-GGUF-IQ2_XXS
List all available models
lemonade list
- Hermes Agent
How to use AtomicChat/Hy4-flash-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AtomicChat/Hy4-flash-GGUF:IQ2_XXS
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:9931/v1 hermes config set model.default AtomicChat/Hy4-flash-GGUF:IQ2_XXS
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use AtomicChat/Hy4-flash-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AtomicChat/Hy4-flash-GGUF:IQ2_XXS
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:9931/v1 \ --custom-model-id "AtomicChat/Hy4-flash-GGUF:IQ2_XXS" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 3,780 Bytes
7fb7a5a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | """Make the public tencent/Hy4-flash checkpoint readable by the converter of llama.cpp PR #32517.
The PR's converter was written against Tencent's internal export. The public release (rev d88c9dfd) differs in
four ways, all of them naming; the weights are the same tensors:
1. architectures HYV4FlashForConditionalGeneration / HYV4FlashForCausalLM (PR: HYV4NextVL... / HYV4Next...)
2. layer_types and rope_parameters say "deepseek_sparse_attention" (PR: "sparse_attention")
3. no engram_enable key (PR: engram_enable true or Engram is dropped)
4. the Engram token map is the I32 tensor model.layers.{i-1}.engram_layer.lookup_table, the same in all four
Engram layers (PR: engram_vocab_map.npz next to the config)
The compressed vocabulary size is lookup_table.max() + 1, as vLLM's loader takes it (vllm PR #68296, engram.py
load_lookup); validate.py checks the resulting token map and hash multipliers against the vendor's own GGUF.
The vision tower converter wants preprocessor_config.json (min_pixels / max_pixels): it is the image_processor
section of processor_config.json.
python prep.py /work/src # idempotent; the original config stays as config.json.orig
"""
import json
import os
import shutil
import sys
import numpy as np
from safetensors import safe_open
src = sys.argv[1]
cfg_p = os.path.join(src, "config.json")
if not os.path.exists(cfg_p + ".orig"):
shutil.copy(cfg_p, cfg_p + ".orig")
cfg = json.load(open(cfg_p + ".orig"))
tc = cfg["text_config"]
assert cfg["architectures"] == ["HYV4FlashForConditionalGeneration"], cfg["architectures"]
assert tc["architectures"] == ["HYV4FlashForCausalLM"], tc["architectures"]
assert "engram_enable" not in tc and not os.path.exists(os.path.join(src, "engram_vocab_map.npz.orig"))
cfg["architectures"] = ["HYV4NextVLForConditionalGeneration"]
tc["architectures"] = ["HYV4NextForCausalLM"]
types = set(tc["layer_types"])
assert types == {"deepseek_sparse_attention", "sliding_attention"}, types
tc["layer_types"] = ["sparse_attention" if t == "deepseek_sparse_attention" else t for t in tc["layer_types"]]
rp = tc["rope_parameters"]
assert set(rp) == {"deepseek_sparse_attention", "sliding_attention"}, set(rp)
rp["sparse_attention"] = rp.pop("deepseek_sparse_attention")
tc["engram_enable"] = True
# the token map
wm = json.load(open(os.path.join(src, "model.safetensors.index.json")))["weight_map"]
maps = []
for i in sorted(int(x) for x in tc["engram_layer_ids"]):
name = f"model.layers.{i - 1}.engram_layer.lookup_table"
with safe_open(os.path.join(src, wm[name]), "pt") as f:
maps.append(f.get_tensor(name).numpy().astype(np.int64))
for m in maps[1:]:
assert np.array_equal(m, maps[0]), "Engram layers carry different token maps"
table = maps[0]
assert table.ndim == 1 and table.min() >= 0 and len(table) <= tc["vocab_size"], (table.shape, table.min())
compressed = int(table.max()) + 1
meta = {"compressed_vocab_size": compressed, "engram_seed": int(tc.get("engram_seed", 0)),
"source": "tencent/Hy4-flash lookup_table tensor (prep.py)"}
np.savez(os.path.join(src, "engram_vocab_map.npz"), lookup_table=table,
metadata=np.frombuffer(json.dumps(meta).encode(), dtype=np.uint8))
pc = json.load(open(os.path.join(src, "processor_config.json")))
json.dump(pc["image_processor"], open(os.path.join(src, "preprocessor_config.json"), "w"), indent=1)
json.dump(cfg, open(cfg_p, "w"), indent=1)
print(json.dumps({"token_map_len": len(table), "compressed_vocab_size": compressed, "vocab_size": tc["vocab_size"],
"engram_layers": tc["engram_layer_ids"], "sparse_layers": tc["layer_types"].count("sparse_attention")}))
|