Instructions to use trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration") 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("trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration") model = AutoModelForMultimodalLM.from_pretrained("trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration", 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 trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration", "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/trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration
- SGLang
How to use trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration 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 "trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration" \ --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": "trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration", "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 "trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration" \ --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": "trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration", "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 trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-MuseGlimmerForConditionalGeneration
Upload MuseGlimmerForConditionalGeneration
#1
by albertvillanova HF Staff - opened
- chat_template.jinja +11 -0
- config.json +1 -1
- model.safetensors +1 -1
chat_template.jinja
CHANGED
|
@@ -84,6 +84,15 @@
|
|
| 84 |
{%- set rs = reasoning_strength if reasoning_strength is defined and reasoning_strength else 'high' -%}
|
| 85 |
{{- 'Reasoning strength: ' + rs + '.' -}}
|
| 86 |
{%- endmacro -%}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
{%- macro render_system_meta(tools) -%}
|
| 88 |
{%- set rns = namespace(recipients=['"self"'], nslist=[]) -%}
|
| 89 |
{%- if tools -%}
|
|
@@ -119,6 +128,7 @@
|
|
| 119 |
{%- endif -%}
|
| 120 |
{{- '\n\n' -}}
|
| 121 |
{{- render_reasoning() -}}
|
|
|
|
| 122 |
{%- if tools -%}
|
| 123 |
{{- '\n\n' -}}
|
| 124 |
{{- render_tool_defs(tools) -}}
|
|
@@ -146,6 +156,7 @@
|
|
| 146 |
{{- '\n\n' -}}
|
| 147 |
{{- render_reasoning() -}}
|
| 148 |
{%- endif -%}
|
|
|
|
| 149 |
{%- if tools -%}
|
| 150 |
{{- '\n\n' -}}
|
| 151 |
{{- render_tool_defs(tools) -}}
|
|
|
|
| 84 |
{%- set rs = reasoning_strength if reasoning_strength is defined and reasoning_strength else 'high' -%}
|
| 85 |
{{- 'Reasoning strength: ' + rs + '.' -}}
|
| 86 |
{%- endmacro -%}
|
| 87 |
+
{%- macro render_response_format() -%}
|
| 88 |
+
{#- The engine enforces response_format by sampling; the model never sees it. State it so the
|
| 89 |
+
model writes the answer the grammar expects. -#}
|
| 90 |
+
{%- if response_format is defined and response_format -%}
|
| 91 |
+
{%- if response_format.type == 'json_schema' -%}
|
| 92 |
+
{{- '\n\nIn your final response to the user\'s latest message the output must adhere to the following json schema: ' + (response_format.json_schema.schema | tojson) -}}
|
| 93 |
+
{%- endif -%}
|
| 94 |
+
{%- endif -%}
|
| 95 |
+
{%- endmacro -%}
|
| 96 |
{%- macro render_system_meta(tools) -%}
|
| 97 |
{%- set rns = namespace(recipients=['"self"'], nslist=[]) -%}
|
| 98 |
{%- if tools -%}
|
|
|
|
| 128 |
{%- endif -%}
|
| 129 |
{{- '\n\n' -}}
|
| 130 |
{{- render_reasoning() -}}
|
| 131 |
+
{{- render_response_format() -}}
|
| 132 |
{%- if tools -%}
|
| 133 |
{{- '\n\n' -}}
|
| 134 |
{{- render_tool_defs(tools) -}}
|
|
|
|
| 156 |
{{- '\n\n' -}}
|
| 157 |
{{- render_reasoning() -}}
|
| 158 |
{%- endif -%}
|
| 159 |
+
{{- render_response_format() -}}
|
| 160 |
{%- if tools -%}
|
| 161 |
{{- '\n\n' -}}
|
| 162 |
{{- render_tool_defs(tools) -}}
|
config.json
CHANGED
|
@@ -60,7 +60,7 @@
|
|
| 60 |
"max_position_embeddings": 1024,
|
| 61 |
"merge_size": 2,
|
| 62 |
"model_type": "muse_glimmer_vision",
|
| 63 |
-
"num_attention_heads":
|
| 64 |
"num_hidden_layers": 2,
|
| 65 |
"patch_size": 14,
|
| 66 |
"patch_temporal": 2,
|
|
|
|
| 60 |
"max_position_embeddings": 1024,
|
| 61 |
"merge_size": 2,
|
| 62 |
"model_type": "muse_glimmer_vision",
|
| 63 |
+
"num_attention_heads": 2,
|
| 64 |
"num_hidden_layers": 2,
|
| 65 |
"patch_size": 14,
|
| 66 |
"patch_temporal": 2,
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 13040152
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:257890ca84b60bf46393f1b6b857ca8a0639a6a32195e8c7888d74074357b73f
|
| 3 |
size 13040152
|