Image-Text-to-Text
Transformers
Safetensors
Chinese
English
qwen3_5
code
chat
128k-context
conversational
Instructions to use KSKOOO/HakuChat-Code-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KSKOOO/HakuChat-Code-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="KSKOOO/HakuChat-Code-9B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("KSKOOO/HakuChat-Code-9B") model = AutoModelForMultimodalLM.from_pretrained("KSKOOO/HakuChat-Code-9B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KSKOOO/HakuChat-Code-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KSKOOO/HakuChat-Code-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KSKOOO/HakuChat-Code-9B", "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/KSKOOO/HakuChat-Code-9B
- SGLang
How to use KSKOOO/HakuChat-Code-9B 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 "KSKOOO/HakuChat-Code-9B" \ --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": "KSKOOO/HakuChat-Code-9B", "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 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 "KSKOOO/HakuChat-Code-9B" \ --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": "KSKOOO/HakuChat-Code-9B", "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" } } ] } ] }' - Docker Model Runner
How to use KSKOOO/HakuChat-Code-9B with Docker Model Runner:
docker model run hf.co/KSKOOO/HakuChat-Code-9B
HakuChat-Code-9B
HakuChat 是一个本地部署的中文代码助手,本仓库为 9B 参数全量权重(合并后,未量化)。
能力
- Python 代码生成、补全、函数实现与解释
- 工具调用(calculator / web.search 轨迹)
- 长上下文:原生支持 256k,部署配置 128k
- 中文对话与身份统一为 HakuChat
评测结果(线上 int4 / 128k,temperature=0)
| Benchmark | 分数 | 样本数 |
|---|---|---|
| MMLU | 73.1 | 171 |
| C-Eval | 78.85 | 104 |
| GSM8K | 86.67 | 60 |
| HumanEval (pass@1) | 63.33 | 60 |
口径说明:0-shot 生成式采样,采样数见上表;同类模型多为厂商 5-shot/bf16 成绩,数值仅供量级参考。
使用
from transformers import AutoModelForImageTextToText, AutoTokenizer
tok = AutoTokenizer.from_pretrained("KSKOOO/HakuChat-Code-9B")
model = AutoModelForImageTextToText.from_pretrained(
"KSKOOO/HakuChat-Code-9B", dtype="auto", device_map="auto")
对话模板内置身份设定,调用时无需额外 system prompt。
- Downloads last month
- 62