Instructions to use OpenSI-SI/OpenSI-Haiku with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenSI-SI/OpenSI-Haiku with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenSI-SI/OpenSI-Haiku") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("OpenSI-SI/OpenSI-Haiku") model = AutoModelForCausalLM.from_pretrained("OpenSI-SI/OpenSI-Haiku", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenSI-SI/OpenSI-Haiku with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenSI-SI/OpenSI-Haiku" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenSI-SI/OpenSI-Haiku", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OpenSI-SI/OpenSI-Haiku
- SGLang
How to use OpenSI-SI/OpenSI-Haiku 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 "OpenSI-SI/OpenSI-Haiku" \ --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": "OpenSI-SI/OpenSI-Haiku", "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 "OpenSI-SI/OpenSI-Haiku" \ --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": "OpenSI-SI/OpenSI-Haiku", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OpenSI-SI/OpenSI-Haiku with Docker Model Runner:
docker model run hf.co/OpenSI-SI/OpenSI-Haiku
File size: 1,937 Bytes
6604f89 | 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 | {
"tokenizer_class": "PreTrainedTokenizerFast",
"model_max_length": 2048,
"bos_token": "<s>",
"eos_token": "</s>",
"unk_token": "<unk>",
"pad_token": "<pad>",
"clean_up_tokenization_spaces": false,
"added_tokens_decoder": {
"0": {
"content": "<unk>",
"special": true,
"normalized": false,
"lstrip": false,
"rstrip": false,
"single_word": false
},
"1": {
"content": "<s>",
"special": true,
"normalized": false,
"lstrip": false,
"rstrip": false,
"single_word": false
},
"2": {
"content": "</s>",
"special": true,
"normalized": false,
"lstrip": false,
"rstrip": false,
"single_word": false
},
"3": {
"content": "<pad>",
"special": true,
"normalized": false,
"lstrip": false,
"rstrip": false,
"single_word": false
}
},
"chat_template": "{#-\n OpenSI-Haiku 对话模板(与 src/chat_format.py 逐字符等价,由 self_check 保证)。\n\n 要点:\n * 不引入新 special token,role 用纯文本标记 ### System/User/Assistant。\n * 助手轮以 eos_token(</s>) 收尾——它就是文档边界,模型据此学会「说完」。\n * add_generation_prompt=True 时以「### Assistant:\\n」结尾,等待模型生成。\n * 所有模板字面空白都用 {%- -%} 去掉,实际文本完全由表达式产出,\n 这样才会与 Python 的字符串拼接逐字符一致。\n-#}\n{%- for message in messages -%}\n{%- if message['role'] == 'system' -%}\n{{ '### System:\\n' + message['content'] + '\\n' }}\n{%- elif message['role'] == 'user' -%}\n{{ '### User:\\n' + message['content'] + '\\n' }}\n{%- elif message['role'] == 'assistant' -%}\n{{ '### Assistant:\\n' + message['content'] + eos_token }}\n{%- endif -%}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n{{ '### Assistant:\\n' }}\n{%- endif -%}\n"
} |