Image-Text-to-Text
MLX
Safetensors
Thai
English
qwen3_5
ocr
thai
document-parsing
layout-analysis
vision-language-model
conversational
8-bit precision
Instructions to use jitvimol/typhoon-ocr2-2b-mlx-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use jitvimol/typhoon-ocr2-2b-mlx-8bit 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("jitvimol/typhoon-ocr2-2b-mlx-8bit") config = load_config("jitvimol/typhoon-ocr2-2b-mlx-8bit") # 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 jitvimol/typhoon-ocr2-2b-mlx-8bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "jitvimol/typhoon-ocr2-2b-mlx-8bit"
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": "jitvimol/typhoon-ocr2-2b-mlx-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use jitvimol/typhoon-ocr2-2b-mlx-8bit 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 "jitvimol/typhoon-ocr2-2b-mlx-8bit"
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 jitvimol/typhoon-ocr2-2b-mlx-8bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use jitvimol/typhoon-ocr2-2b-mlx-8bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "jitvimol/typhoon-ocr2-2b-mlx-8bit"
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 "jitvimol/typhoon-ocr2-2b-mlx-8bit" \ --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 chat_template.jinja from jitvimol/typhoon-ocr2-2b-mlx-8bit: direct link, hf CLI and curl.
- Browser
- Download file 6.9 kB
-
https://huggingface.co/jitvimol/typhoon-ocr2-2b-mlx-8bit/resolve/main/chat_template.jinja
- Command line
-
hf download hf://jitvimol/typhoon-ocr2-2b-mlx-8bit/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/jitvimol/typhoon-ocr2-2b-mlx-8bit/resolve/main/chat_template.jinja
6.9 kB
| {%- if tools %} | |
| {{- '<|im_start|>system\n' }} | |
| {%- if messages[0].role == 'system' %} | |
| {%- if messages[0].content is string %} | |
| {{- messages[0].content + '\n\n' }} | |
| {%- else %} | |
| {%- for part in messages[0].content %} | |
| {%- if part is mapping %} | |
| {%- set system_text = part.get('text') or part.get('content') or part.get('value') %} | |
| {%- if system_text %}{{- system_text }}{%- endif %} | |
| {%- elif part is string %} | |
| {{- part }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {{- '\n\n' }} | |
| {%- endif %} | |
| {%- endif %} | |
| {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }} | |
| {%- for tool in tools %} | |
| {{- "\n" }} | |
| {{- tool | tojson }} | |
| {%- endfor %} | |
| {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }} | |
| {%- else %} | |
| {%- if messages[0].role == 'system' %} | |
| {%- if messages[0].content is string %} | |
| {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }} | |
| {%- else %} | |
| {{- '<|im_start|>system\n' }} | |
| {%- for part in messages[0].content %} | |
| {%- if part is mapping %} | |
| {%- set system_text = part.get('text') or part.get('content') or part.get('value') %} | |
| {%- if system_text %}{{- system_text }}{%- endif %} | |
| {%- elif part is string %} | |
| {{- part }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {{- '<|im_end|>\n' }} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %} | |
| {#- Determine the real last index: use provided value or default to messages length - 1 #} | |
| {%- if real_last_index is defined and real_last_index is not none %} | |
| {%- set ns.real_last_index = real_last_index %} | |
| {%- else %} | |
| {%- set ns.real_last_index = messages|length - 1 %} | |
| {%- endif %} | |
| {%- for message in messages[::-1] %} | |
| {%- set index = (messages|length - 1) - loop.index0 %} | |
| {%- if message['content'] is string %} | |
| {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %} | |
| {%- set ns.multi_step_tool = false %} | |
| {%- set ns.last_query_index = index %} | |
| {%- endif %} | |
| {%- else %} | |
| {%- if ns.multi_step_tool and message.role == "user" %} | |
| {%- set ns.multi_step_tool = false %} | |
| {%- set ns.last_query_index = index %} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- for message in messages %} | |
| {%- if (message.role == "user") or (message.role == "system" and not loop.first) %} | |
| {{- '<|im_start|>' + message.role + '\n' }} | |
| {%- if message['content'] is string %} | |
| {{- message.content }} | |
| {%- else %} | |
| {%- for content in message['content'] %} | |
| {%- if content['type'] == 'image' or 'image' in content or 'image_url' in content %} | |
| {{- '<|vision_start|><|image_pad|><|vision_end|>' }} | |
| {%- elif content['type'] == 'video' or 'video' in content %} | |
| {{- '<|vision_start|><|video_pad|><|vision_end|>' }} | |
| {%- elif 'text' in content %} | |
| {{- content['text'] }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- endif %} | |
| {{- '<|im_end|>\n' }} | |
| {%- elif message.role == "assistant" %} | |
| {%- if message['content'] is string %} | |
| {%- set content = message.content %} | |
| {%- else %} | |
| {%- set content_ns = namespace(text='') %} | |
| {%- for item in message['content'] %} | |
| {%- if 'text' in item %} | |
| {%- set content_ns.text = content_ns.text + item['text'] %} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- set content = content_ns.text %} | |
| {%- endif %} | |
| {%- set reasoning_content = '' %} | |
| {%- if message.reasoning_content is defined and message.reasoning_content is not none %} | |
| {%- set reasoning_content = message.reasoning_content %} | |
| {%- else %} | |
| {%- if '</think>' in content %} | |
| {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %} | |
| {%- set content = content.split('</think>')[-1].lstrip('\n') %} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- if loop.index0 > ns.last_query_index %} | |
| {%- if loop.index0 == ns.real_last_index or (loop.index0 != ns.real_last_index and reasoning_content) %} | |
| {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }} | |
| {%- else %} | |
| {{- '<|im_start|>' + message.role + '\n' + content }} | |
| {%- endif %} | |
| {%- else %} | |
| {{- '<|im_start|>' + message.role + '\n' + content }} | |
| {%- endif %} | |
| {%- if message.tool_calls %} | |
| {%- for tool_call in message.tool_calls %} | |
| {%- if (loop.first and content) or (not loop.first) %} | |
| {{- '\n' }} | |
| {%- endif %} | |
| {%- if tool_call.function %} | |
| {%- set tool_call = tool_call.function %} | |
| {%- endif %} | |
| {{- '<tool_call>\n{"name": "' }} | |
| {{- tool_call.name }} | |
| {{- '", "arguments": ' }} | |
| {%- if tool_call.arguments is string %} | |
| {{- tool_call.arguments }} | |
| {%- else %} | |
| {{- tool_call.arguments | tojson }} | |
| {%- endif %} | |
| {{- '}\n</tool_call>' }} | |
| {%- endfor %} | |
| {%- endif %} | |
| {{- '<|im_end|>\n' }} | |
| {%- elif message.role == "tool" %} | |
| {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %} | |
| {{- '<|im_start|>user' }} | |
| {%- endif %} | |
| {{- '\n<tool_response>\n' }} | |
| {{- message.content }} | |
| {{- '\n</tool_response>' }} | |
| {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} | |
| {{- '<|im_end|>\n' }} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- if add_generation_prompt %} | |
| {{- '<|im_start|>assistant\n' }} | |
| {%- if enable_thinking is defined and enable_thinking is false %} | |
| {{- '<think>\n\n</think>\n\n' }} | |
| {%- else %} | |
| {{- '<think>\n\n' }} | |
| {%- endif %} | |
| {%- endif %} | |