Image-Text-to-Text
Transformers
Safetensors
inkling_mm_model
conversational
audio-text-to-text
Mixture of Experts
Instructions to use thinkingmachines/Inkling with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thinkingmachines/Inkling with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="thinkingmachines/Inkling") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("thinkingmachines/Inkling") model = AutoModelForMultimodalLM.from_pretrained("thinkingmachines/Inkling") 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use thinkingmachines/Inkling with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thinkingmachines/Inkling" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thinkingmachines/Inkling", "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/thinkingmachines/Inkling
- SGLang
How to use thinkingmachines/Inkling 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 "thinkingmachines/Inkling" \ --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": "thinkingmachines/Inkling", "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 "thinkingmachines/Inkling" \ --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": "thinkingmachines/Inkling", "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 thinkingmachines/Inkling with Docker Model Runner:
docker model run hf.co/thinkingmachines/Inkling
| {%- set effort_map = {"none": 0.0, "minimal": 0.1, "low": 0.2, "medium": 0.7, "high": 0.9, "max": 0.99} -%} | |
| {%- set role_token = {"user": "<|message_user|>", "assistant": "<|message_model|>", "system": "<|message_system|>", "tool": "<|message_tool|>"} -%} | |
| {%- macro emit_thinking_effort() -%} | |
| {%- set eff = reasoning_effort if reasoning_effort is defined and reasoning_effort is not none else 0.9 -%} | |
| {%- if eff is string -%} | |
| {%- set key = eff | trim -%} | |
| {%- if key not in effort_map -%} | |
| {{- raise_exception("Unknown reasoning_effort: " ~ eff) -}} | |
| {%- endif -%} | |
| {%- set num = effort_map[key] -%} | |
| {%- else -%} | |
| {%- set num = eff | float -%} | |
| {%- endif -%} | |
| {%- if num < 0.0 or num > 0.99 -%} | |
| {{- raise_exception("reasoning_effort must be in [0.0, 0.99]") -}} | |
| {%- endif -%} | |
| {{- "<|message_system|><|content_text|>Thinking effort level: " -}} | |
| {%- if num == 0.0 -%}0{%- else -%}{{ num }}{%- endif -%} | |
| {{- "<|end_message|>" -}} | |
| {%- endmacro -%} | |
| {%- if tools -%} | |
| {%- set tool_state = namespace(specs=[]) -%} | |
| {%- for tool in tools -%} | |
| {%- set fn = tool.function if tool.function is defined else tool -%} | |
| {%- set spec = { | |
| "description": (fn.description if fn.description is defined and fn.description else ""), | |
| "name": fn.name, | |
| "parameters": (fn.parameters if fn.parameters is defined and fn.parameters else {}), | |
| "type": (tool.type if tool.type is defined and tool.type else "function"), | |
| } -%} | |
| {%- set tool_state.specs = tool_state.specs + [spec] -%} | |
| {%- endfor -%} | |
| {{- "<|message_system|>tool_declare<|content_xml|>" -}} | |
| {{- tool_state.specs | tojson(sort_keys=true, separators=(",", ":")) -}} | |
| {{- "<|end_message|>" -}} | |
| {%- endif -%} | |
| {%- set state = namespace(effort_emitted=false) -%} | |
| {%- for message in messages -%} | |
| {%- if message.role not in role_token -%} | |
| {{- raise_exception("Unknown message role: " ~ message.role) -}} | |
| {%- endif -%} | |
| {%- if not state.effort_emitted and message.role != "system" -%} | |
| {{- emit_thinking_effort() -}} | |
| {%- set state.effort_emitted = true -%} | |
| {%- endif -%} | |
| {%- set rtok = role_token[message.role] -%} | |
| {%- if message.role == "tool" -%} | |
| {%- set tool_name_state = namespace(name="") -%} | |
| {%- if message.name is defined and message.name -%} | |
| {%- set tool_name_state.name = message.name -%} | |
| {%- elif message.tool_call_id is defined and message.tool_call_id -%} | |
| {%- for prev in messages -%} | |
| {%- if prev.role == "assistant" and prev.tool_calls -%} | |
| {%- for tc in prev.tool_calls -%} | |
| {%- if tc.id is defined and tc.id == message.tool_call_id and tc.function.name is defined -%} | |
| {%- set tool_name_state.name = tc.function.name -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {{- rtok -}} | |
| {%- if tool_name_state.name -%}{{- tool_name_state.name -}}{%- endif -%} | |
| {{- "<|content_text|>" -}} | |
| {%- if message.content is string -%}{{- message.content -}}{%- endif -%} | |
| {{- "<|end_message|>" -}} | |
| {%- else -%} | |
| {%- if message.role == "assistant" and message.reasoning_content is defined and message.reasoning_content -%} | |
| {{- "<|message_model|><|content_thinking|>" ~ message.reasoning_content ~ "<|end_message|>" -}} | |
| {%- endif -%} | |
| {%- if message.content is string -%} | |
| {{- rtok ~ "<|content_text|>" ~ message.content ~ "<|end_message|>" -}} | |
| {%- elif message.content -%} | |
| {%- for part in message.content -%} | |
| {%- if part is string -%} | |
| {{- rtok ~ "<|content_text|>" ~ part ~ "<|end_message|>" -}} | |
| {%- elif part.type is not defined or part.type in ("text", "input_text") -%} | |
| {%- set text_part = (part.text if part.text is defined and part.text is string else "") -%} | |
| {{- rtok ~ "<|content_text|>" ~ text_part ~ "<|end_message|>" -}} | |
| {%- elif part.type in ("image", "input_image", "image_url") -%} | |
| {{- rtok ~ "<|content_image|><|unused_200054|><|end_message|>" -}} | |
| {%- elif part.type in ("audio", "input_audio", "audio_url") -%} | |
| {{- rtok ~ "<|content_audio_input|><|unused_200053|><|audio_end|><|end_message|>" -}} | |
| {%- else -%} | |
| {{- raise_exception("Unsupported content part type: " ~ part.type) -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {%- if message.role == "assistant" and message.tool_calls -%} | |
| {%- for tc in message.tool_calls -%} | |
| {%- set fn = tc.function -%} | |
| {%- if fn.name is not defined or fn.name is not string -%} | |
| {{- raise_exception("tool call function name must be a string") -}} | |
| {%- endif -%} | |
| {%- set args = fn.arguments if fn.arguments is defined and fn.arguments else {} -%} | |
| {%- if args is string -%} | |
| {{- raise_exception("tool call arguments must be a parsed object, not a JSON string; canonicalize upstream") -}} | |
| {%- endif -%} | |
| {%- if args is not mapping -%} | |
| {{- raise_exception("tool call arguments must be an object") -}} | |
| {%- endif -%} | |
| {{- "<|message_model|>" ~ fn.name ~ "<|content_invoke_tool_json|>" -}} | |
| {{- '{"name":' ~ (fn.name | tojson(sort_keys=true, separators=(",", ":"))) ~ ',"args":' -}} | |
| {{- (args | tojson(sort_keys=true, separators=(",", ":"))) -}} | |
| {{- "}<|end_message|>" -}} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {%- if message.role == "assistant" -%} | |
| {{- "<|content_model_end_sampling|>" -}} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- if not state.effort_emitted -%} | |
| {{- emit_thinking_effort() -}} | |
| {%- endif -%} | |
| {%- if add_generation_prompt -%} | |
| {{- "<|message_model|>" -}} | |
| {%- endif -%} | |