Image-Text-to-Text
Transformers
Safetensors
muse_spark
muse-spark
testing
random-weights
conversational
Instructions to use hf-internal-testing/tiny-muse-spark with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hf-internal-testing/tiny-muse-spark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hf-internal-testing/tiny-muse-spark") 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("hf-internal-testing/tiny-muse-spark") model = AutoModelForMultimodalLM.from_pretrained("hf-internal-testing/tiny-muse-spark", 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 hf-internal-testing/tiny-muse-spark with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hf-internal-testing/tiny-muse-spark" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hf-internal-testing/tiny-muse-spark", "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/hf-internal-testing/tiny-muse-spark
- SGLang
How to use hf-internal-testing/tiny-muse-spark 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 "hf-internal-testing/tiny-muse-spark" \ --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": "hf-internal-testing/tiny-muse-spark", "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 "hf-internal-testing/tiny-muse-spark" \ --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": "hf-internal-testing/tiny-muse-spark", "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 hf-internal-testing/tiny-muse-spark with Docker Model Runner:
docker model run hf.co/hf-internal-testing/tiny-muse-spark
Update chat template
Browse files- chat_template.jinja +6 -3
chat_template.jinja
CHANGED
|
@@ -1,9 +1,12 @@
|
|
| 1 |
{%- set tools = tools | default(none) -%}
|
| 2 |
{%- set add_generation_prompt = add_generation_prompt | default(false) -%}
|
| 3 |
-
{%- set reasoning_effort = reasoning_effort | default('
|
| 4 |
{%- set cutoff_date = cutoff_date | default('2026-01-04') -%}
|
| 5 |
{%- set current_date = current_date | default(strftime_now('%Y-%m-%d') if strftime_now is defined else none) -%}
|
| 6 |
-
{%- set reasoning_effort_map = {'
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
{#- Neutralise control sequences in caller-supplied text so it cannot be
|
| 9 |
tokenized as structure. "<|" is broken because every special token has the
|
|
@@ -142,7 +145,7 @@
|
|
| 142 |
{%- if tools -%}
|
| 143 |
{%- set sys.parts = sys.parts + [render_tool_defs(tools) | trim] -%}
|
| 144 |
{%- endif -%}
|
| 145 |
-
{%- if
|
| 146 |
{%- set sys.parts = sys.parts + ['Reasoning strength: ' ~ reasoning_effort_map[reasoning_effort] ~ '.'] -%}
|
| 147 |
{%- endif -%}
|
| 148 |
{%- set sys.parts = sys.parts + [render_valid_recipients(tools) | trim] -%}
|
|
|
|
| 1 |
{%- set tools = tools | default(none) -%}
|
| 2 |
{%- set add_generation_prompt = add_generation_prompt | default(false) -%}
|
| 3 |
+
{%- set reasoning_effort = reasoning_effort | default('xhigh', true) -%}
|
| 4 |
{%- set cutoff_date = cutoff_date | default('2026-01-04') -%}
|
| 5 |
{%- set current_date = current_date | default(strftime_now('%Y-%m-%d') if strftime_now is defined else none) -%}
|
| 6 |
+
{%- set reasoning_effort_map = {'low': 8, 'medium': 32, 'high': 256, 'xhigh': 512} -%}
|
| 7 |
+
{%- if not (reasoning_effort is string and reasoning_effort in reasoning_effort_map) -%}
|
| 8 |
+
{{- raise_exception('Unsupported reasoning_effort: ' ~ reasoning_effort ~ '. Expected one of: low, medium, high, xhigh.') -}}
|
| 9 |
+
{%- endif -%}
|
| 10 |
|
| 11 |
{#- Neutralise control sequences in caller-supplied text so it cannot be
|
| 12 |
tokenized as structure. "<|" is broken because every special token has the
|
|
|
|
| 145 |
{%- if tools -%}
|
| 146 |
{%- set sys.parts = sys.parts + [render_tool_defs(tools) | trim] -%}
|
| 147 |
{%- endif -%}
|
| 148 |
+
{%- if 'reasoning strength:' not in ((ns.instructions if ns.instructions else '') | lower) -%}
|
| 149 |
{%- set sys.parts = sys.parts + ['Reasoning strength: ' ~ reasoning_effort_map[reasoning_effort] ~ '.'] -%}
|
| 150 |
{%- endif -%}
|
| 151 |
{%- set sys.parts = sys.parts + [render_valid_recipients(tools) | trim] -%}
|