Instructions to use trl-internal-testing/tiny-Qwen3_5ForConditionalGeneration-3.8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-Qwen3_5ForConditionalGeneration-3.8 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-Qwen3_5ForConditionalGeneration-3.8") 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-Qwen3_5ForConditionalGeneration-3.8") model = AutoModelForMultimodalLM.from_pretrained("trl-internal-testing/tiny-Qwen3_5ForConditionalGeneration-3.8", 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-Qwen3_5ForConditionalGeneration-3.8 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-Qwen3_5ForConditionalGeneration-3.8" # 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-Qwen3_5ForConditionalGeneration-3.8", "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-Qwen3_5ForConditionalGeneration-3.8
- SGLang
How to use trl-internal-testing/tiny-Qwen3_5ForConditionalGeneration-3.8 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-Qwen3_5ForConditionalGeneration-3.8" \ --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-Qwen3_5ForConditionalGeneration-3.8", "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-Qwen3_5ForConditionalGeneration-3.8" \ --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-Qwen3_5ForConditionalGeneration-3.8", "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-Qwen3_5ForConditionalGeneration-3.8 with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-Qwen3_5ForConditionalGeneration-3.8
Upload Qwen3_5ForConditionalGeneration
#1
by albertvillanova HF Staff - opened
- chat_template.jinja +7 -3
- config.json +1 -1
- model.safetensors +1 -1
- tokenizer_config.json +38 -0
chat_template.jinja
CHANGED
|
@@ -113,10 +113,12 @@
|
|
| 113 |
{%- set reasoning_content = message.reasoning_content %}
|
| 114 |
{%- endif %}
|
| 115 |
{%- set reasoning_content = reasoning_content|trim %}
|
|
|
|
|
|
|
| 116 |
{%- if preserve_thinking is undefined or preserve_thinking is true or loop.index0 > ns.last_query_index %}
|
| 117 |
-
{{- '<
|
| 118 |
{%- else %}
|
| 119 |
-
{{-
|
| 120 |
{%- endif %}
|
| 121 |
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 122 |
{%- for tool_call in message.tool_calls %}
|
|
@@ -143,7 +145,9 @@
|
|
| 143 |
{{- '</function>\n</tool_call>' }}
|
| 144 |
{%- endfor %}
|
| 145 |
{%- endif %}
|
| 146 |
-
{{- '<|im_end|>
|
|
|
|
|
|
|
| 147 |
{%- elif message.role == "tool" %}
|
| 148 |
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 149 |
{{- '<|im_start|>user' }}
|
|
|
|
| 113 |
{%- set reasoning_content = message.reasoning_content %}
|
| 114 |
{%- endif %}
|
| 115 |
{%- set reasoning_content = reasoning_content|trim %}
|
| 116 |
+
{{- '<|im_start|>' + message.role + '\n' }}
|
| 117 |
+
{%- generation %}
|
| 118 |
{%- if preserve_thinking is undefined or preserve_thinking is true or loop.index0 > ns.last_query_index %}
|
| 119 |
+
{{- '<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 120 |
{%- else %}
|
| 121 |
+
{{- content }}
|
| 122 |
{%- endif %}
|
| 123 |
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 124 |
{%- for tool_call in message.tool_calls %}
|
|
|
|
| 145 |
{{- '</function>\n</tool_call>' }}
|
| 146 |
{%- endfor %}
|
| 147 |
{%- endif %}
|
| 148 |
+
{{- '<|im_end|>' }}
|
| 149 |
+
{%- endgeneration %}
|
| 150 |
+
{{- '\n' }}
|
| 151 |
{%- elif message.role == "tool" %}
|
| 152 |
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 153 |
{{- '<|im_start|>user' }}
|
config.json
CHANGED
|
@@ -67,7 +67,7 @@
|
|
| 67 |
"initializer_range": 0.02,
|
| 68 |
"intermediate_size": 32,
|
| 69 |
"model_type": "qwen3_5",
|
| 70 |
-
"num_heads":
|
| 71 |
"num_position_embeddings": 2304,
|
| 72 |
"out_hidden_size": 16,
|
| 73 |
"patch_size": 16,
|
|
|
|
| 67 |
"initializer_range": 0.02,
|
| 68 |
"intermediate_size": 32,
|
| 69 |
"model_type": "qwen3_5",
|
| 70 |
+
"num_heads": 2,
|
| 71 |
"num_position_embeddings": 2304,
|
| 72 |
"out_hidden_size": 16,
|
| 73 |
"patch_size": 16,
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 20322624
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:33424b34c80e69675a9c6e8fb7fbe0767eca41a2a76fd167acff74229743835b
|
| 3 |
size 20322624
|
tokenizer_config.json
CHANGED
|
@@ -23,6 +23,44 @@
|
|
| 23 |
"pad_token": "<|endoftext|>",
|
| 24 |
"pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 25 |
"processor_class": "Qwen3VLProcessor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
"split_special_tokens": false,
|
| 27 |
"tokenizer_class": "TokenizersBackend",
|
| 28 |
"unk_token": null,
|
|
|
|
| 23 |
"pad_token": "<|endoftext|>",
|
| 24 |
"pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 25 |
"processor_class": "Qwen3VLProcessor",
|
| 26 |
+
"response_template": {
|
| 27 |
+
"defaults": {
|
| 28 |
+
"role": "assistant"
|
| 29 |
+
},
|
| 30 |
+
"fields": {
|
| 31 |
+
"content": {
|
| 32 |
+
"close": [
|
| 33 |
+
"<|im_end|>",
|
| 34 |
+
"<|endoftext|>"
|
| 35 |
+
],
|
| 36 |
+
"content": "text",
|
| 37 |
+
"join": "",
|
| 38 |
+
"repeats": true
|
| 39 |
+
},
|
| 40 |
+
"reasoning_content": {
|
| 41 |
+
"close_pattern": "</think>|(?=<tool_call>)",
|
| 42 |
+
"content": "text",
|
| 43 |
+
"open": "<think>"
|
| 44 |
+
},
|
| 45 |
+
"tool_calls": {
|
| 46 |
+
"close_pattern": "</tool_call>|(?=<tool_call>)",
|
| 47 |
+
"content": "xml-inline",
|
| 48 |
+
"content_args": {
|
| 49 |
+
"tag_pattern": "<parameter=(?P<key>[^>\\n]+)>\\n?(?P<value>.*?)\\n?(?:</parameter>|(?=<parameter=)|(?=</function>))"
|
| 50 |
+
},
|
| 51 |
+
"open_pattern": "<tool_call>\\s*<function=(?P<name>[^>\\n]+)>",
|
| 52 |
+
"repeats": true,
|
| 53 |
+
"transform": {
|
| 54 |
+
"function": {
|
| 55 |
+
"arguments": "{content}",
|
| 56 |
+
"name": "{name}"
|
| 57 |
+
},
|
| 58 |
+
"type": "function"
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
"start_anchor": "<|im_start|>assistant\n"
|
| 63 |
+
},
|
| 64 |
"split_special_tokens": false,
|
| 65 |
"tokenizer_class": "TokenizersBackend",
|
| 66 |
"unk_token": null,
|