Instructions to use cs-552-2026-flab/multilingual_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cs-552-2026-flab/multilingual_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cs-552-2026-flab/multilingual_model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cs-552-2026-flab/multilingual_model") model = AutoModelForCausalLM.from_pretrained("cs-552-2026-flab/multilingual_model", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cs-552-2026-flab/multilingual_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cs-552-2026-flab/multilingual_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cs-552-2026-flab/multilingual_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cs-552-2026-flab/multilingual_model
- SGLang
How to use cs-552-2026-flab/multilingual_model 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 "cs-552-2026-flab/multilingual_model" \ --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": "cs-552-2026-flab/multilingual_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "cs-552-2026-flab/multilingual_model" \ --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": "cs-552-2026-flab/multilingual_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cs-552-2026-flab/multilingual_model with Docker Model Runner:
docker model run hf.co/cs-552-2026-flab/multilingual_model
submit multilingual a10-a33-t007 tiny soup candidate
Browse files- chat_template.jinja +2 -2
- config.json +3 -3
- generation_config.json +1 -0
- hydra/.hydra/config.yaml +9 -8
- hydra/.hydra/hydra.yaml +8 -9
- hydra/.hydra/overrides.yaml +3 -4
- hydra/merge_peft.log +23 -10
- interpolation.json +6 -0
- model.safetensors +1 -1
- tokenizer_config.json +2 -2
chat_template.jinja
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
{%- set enable_thinking =
|
| 2 |
-
{%- set flab_boxed_instruction = "
|
| 3 |
{%- if flab_boxed_instruction %}{{ '<|im_start|>system\n' + flab_boxed_instruction + '<|im_end|>\n' }}{%- endif %}{%- if tools %}
|
| 4 |
{{- '<|im_start|>system\n' }}
|
| 5 |
{%- if messages[0].role == 'system' %}
|
|
|
|
| 1 |
+
{%- set enable_thinking = true %}
|
| 2 |
+
{%- set flab_boxed_instruction = "Solve the problem carefully. Think before answering. You must finish every response with exactly one final answer in the form \\boxed{LETTER}. Never omit the final boxed answer." %}
|
| 3 |
{%- if flab_boxed_instruction %}{{ '<|im_start|>system\n' + flab_boxed_instruction + '<|im_end|>\n' }}{%- endif %}{%- if tools %}
|
| 4 |
{{- '<|im_start|>system\n' }}
|
| 5 |
{%- if messages[0].role == 'system' %}
|
config.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
-
"bos_token_id":
|
| 8 |
"dtype": "bfloat16",
|
| 9 |
"eos_token_id": 151645,
|
| 10 |
"head_dim": 128,
|
|
@@ -48,7 +48,7 @@
|
|
| 48 |
"num_attention_heads": 16,
|
| 49 |
"num_hidden_layers": 28,
|
| 50 |
"num_key_value_heads": 8,
|
| 51 |
-
"pad_token_id":
|
| 52 |
"rms_norm_eps": 1e-06,
|
| 53 |
"rope_parameters": {
|
| 54 |
"rope_theta": 1000000,
|
|
@@ -57,7 +57,7 @@
|
|
| 57 |
"sliding_window": null,
|
| 58 |
"tie_word_embeddings": true,
|
| 59 |
"transformers_version": "5.7.0",
|
| 60 |
-
"use_cache":
|
| 61 |
"use_sliding_window": false,
|
| 62 |
"vocab_size": 151936
|
| 63 |
}
|
|
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 151643,
|
| 8 |
"dtype": "bfloat16",
|
| 9 |
"eos_token_id": 151645,
|
| 10 |
"head_dim": 128,
|
|
|
|
| 48 |
"num_attention_heads": 16,
|
| 49 |
"num_hidden_layers": 28,
|
| 50 |
"num_key_value_heads": 8,
|
| 51 |
+
"pad_token_id": null,
|
| 52 |
"rms_norm_eps": 1e-06,
|
| 53 |
"rope_parameters": {
|
| 54 |
"rope_theta": 1000000,
|
|
|
|
| 57 |
"sliding_window": null,
|
| 58 |
"tie_word_embeddings": true,
|
| 59 |
"transformers_version": "5.7.0",
|
| 60 |
+
"use_cache": true,
|
| 61 |
"use_sliding_window": false,
|
| 62 |
"vocab_size": 151936
|
| 63 |
}
|
generation_config.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
{
|
|
|
|
| 2 |
"do_sample": true,
|
| 3 |
"eos_token_id": [
|
| 4 |
151645,
|
|
|
|
| 1 |
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
"do_sample": true,
|
| 4 |
"eos_token_id": [
|
| 5 |
151645,
|
hydra/.hydra/config.yaml
CHANGED
|
@@ -47,7 +47,7 @@ training:
|
|
| 47 |
adapter_model_dir: null
|
| 48 |
domain:
|
| 49 |
name: multilingual
|
| 50 |
-
thinking_mode:
|
| 51 |
benchmark: multilingual
|
| 52 |
languages:
|
| 53 |
- it
|
|
@@ -58,10 +58,12 @@ domain:
|
|
| 58 |
target_format: boxed
|
| 59 |
max_options: 20
|
| 60 |
reward_fn: multilingual
|
| 61 |
-
system_instruction:
|
| 62 |
-
exactly one final answer in the form \boxed{LETTER}.
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
| 65 |
post_train:
|
| 66 |
enabled: false
|
| 67 |
merge_adapter: false
|
|
@@ -70,7 +72,7 @@ post_train:
|
|
| 70 |
evals: []
|
| 71 |
seed: 42
|
| 72 |
run_id: ${now:%Y%m%d_%H%M%S}
|
| 73 |
-
output_dir: /scratch/checkpoints/multilingual/
|
| 74 |
wandb:
|
| 75 |
project: flab-cs552
|
| 76 |
entity: cs-552-2026-flab
|
|
@@ -91,8 +93,7 @@ eval:
|
|
| 91 |
max_tokens: 4096
|
| 92 |
samples_dir: null
|
| 93 |
push:
|
| 94 |
-
model_dir: /scratch/checkpoints/multilingual/
|
| 95 |
-
base_model_dir: /scratch/checkpoints/multilingual/a33-branchout-fit12h-20260528/cpt
|
| 96 |
es:
|
| 97 |
base_model_dir: null
|
| 98 |
data: null
|
|
|
|
| 47 |
adapter_model_dir: null
|
| 48 |
domain:
|
| 49 |
name: multilingual
|
| 50 |
+
thinking_mode: true
|
| 51 |
benchmark: multilingual
|
| 52 |
languages:
|
| 53 |
- it
|
|
|
|
| 58 |
target_format: boxed
|
| 59 |
max_options: 20
|
| 60 |
reward_fn: multilingual
|
| 61 |
+
system_instruction: Solve the problem carefully. Think before answering. You must
|
| 62 |
+
finish every response with exactly one final answer in the form \boxed{LETTER}.
|
| 63 |
+
Never omit the final boxed answer.
|
| 64 |
+
template_boxed_instruction: Solve the problem carefully. Think before answering.
|
| 65 |
+
You must finish every response with exactly one final answer in the form \boxed{LETTER}.
|
| 66 |
+
Never omit the final boxed answer.
|
| 67 |
post_train:
|
| 68 |
enabled: false
|
| 69 |
merge_adapter: false
|
|
|
|
| 72 |
evals: []
|
| 73 |
seed: 42
|
| 74 |
run_id: ${now:%Y%m%d_%H%M%S}
|
| 75 |
+
output_dir: /scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500_merged
|
| 76 |
wandb:
|
| 77 |
project: flab-cs552
|
| 78 |
entity: cs-552-2026-flab
|
|
|
|
| 93 |
max_tokens: 4096
|
| 94 |
samples_dir: null
|
| 95 |
push:
|
| 96 |
+
model_dir: /scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500
|
|
|
|
| 97 |
es:
|
| 98 |
base_model_dir: null
|
| 99 |
data: null
|
hydra/.hydra/hydra.yaml
CHANGED
|
@@ -112,14 +112,13 @@ hydra:
|
|
| 112 |
hydra:
|
| 113 |
- hydra.mode=RUN
|
| 114 |
task:
|
| 115 |
-
- domain=
|
| 116 |
-
- push.model_dir=/scratch/checkpoints/multilingual/
|
| 117 |
-
-
|
| 118 |
-
- output_dir=/scratch/checkpoints/multilingual/a33-branchout-fit12h-20260528/merged_resume
|
| 119 |
job:
|
| 120 |
name: merge_peft
|
| 121 |
chdir: false
|
| 122 |
-
override_dirname: domain=
|
| 123 |
id: ???
|
| 124 |
num: ???
|
| 125 |
config_name: base
|
|
@@ -133,21 +132,21 @@ hydra:
|
|
| 133 |
runtime:
|
| 134 |
version: 1.3.2
|
| 135 |
version_base: '1.3'
|
| 136 |
-
cwd: /scratch/runs/cs552-mazniche-g07-
|
| 137 |
config_sources:
|
| 138 |
- path: hydra.conf
|
| 139 |
schema: pkg
|
| 140 |
provider: hydra
|
| 141 |
-
- path: /scratch/runs/cs552-mazniche-g07-
|
| 142 |
schema: file
|
| 143 |
provider: main
|
| 144 |
- path: ''
|
| 145 |
schema: structured
|
| 146 |
provider: schema
|
| 147 |
-
output_dir: /scratch/checkpoints/multilingual/
|
| 148 |
choices:
|
| 149 |
post_train: disabled
|
| 150 |
-
domain:
|
| 151 |
training: sft
|
| 152 |
data: nemotron_math
|
| 153 |
model: qwen3_17b
|
|
|
|
| 112 |
hydra:
|
| 113 |
- hydra.mode=RUN
|
| 114 |
task:
|
| 115 |
+
- domain=multilingual_reasoning_thinking
|
| 116 |
+
- push.model_dir=/scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500
|
| 117 |
+
- output_dir=/scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500_merged
|
|
|
|
| 118 |
job:
|
| 119 |
name: merge_peft
|
| 120 |
chdir: false
|
| 121 |
+
override_dirname: domain=multilingual_reasoning_thinking,output_dir=/scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500_merged,push.model_dir=/scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500
|
| 122 |
id: ???
|
| 123 |
num: ???
|
| 124 |
config_name: base
|
|
|
|
| 132 |
runtime:
|
| 133 |
version: 1.3.2
|
| 134 |
version_base: '1.3'
|
| 135 |
+
cwd: /scratch/runs/cs552-mazniche-g07-ps-a10-rmix-lr1e6-s500-185054
|
| 136 |
config_sources:
|
| 137 |
- path: hydra.conf
|
| 138 |
schema: pkg
|
| 139 |
provider: hydra
|
| 140 |
+
- path: /scratch/runs/cs552-mazniche-g07-ps-a10-rmix-lr1e6-s500-185054/configs
|
| 141 |
schema: file
|
| 142 |
provider: main
|
| 143 |
- path: ''
|
| 144 |
schema: structured
|
| 145 |
provider: schema
|
| 146 |
+
output_dir: /scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500_merged/hydra
|
| 147 |
choices:
|
| 148 |
post_train: disabled
|
| 149 |
+
domain: multilingual_reasoning_thinking
|
| 150 |
training: sft
|
| 151 |
data: nemotron_math
|
| 152 |
model: qwen3_17b
|
hydra/.hydra/overrides.yaml
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
- domain=
|
| 2 |
-
- push.model_dir=/scratch/checkpoints/multilingual/
|
| 3 |
-
-
|
| 4 |
-
- output_dir=/scratch/checkpoints/multilingual/a33-branchout-fit12h-20260528/merged_resume
|
|
|
|
| 1 |
+
- domain=multilingual_reasoning_thinking
|
| 2 |
+
- push.model_dir=/scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500
|
| 3 |
+
- output_dir=/scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500_merged
|
|
|
hydra/merge_peft.log
CHANGED
|
@@ -1,10 +1,23 @@
|
|
| 1 |
-
[2026-05-
|
| 2 |
-
[2026-05-
|
| 3 |
-
[2026-05-
|
| 4 |
-
[2026-05-
|
| 5 |
-
[2026-05-
|
| 6 |
-
[2026-05-
|
| 7 |
-
[2026-05-
|
| 8 |
-
[2026-05-
|
| 9 |
-
[2026-05-
|
| 10 |
-
[2026-05-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[2026-05-21 00:12:59,924][__main__][INFO] - Loading base model for merge ...
|
| 2 |
+
[2026-05-21 00:13:00,074][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/Qwen/Qwen3-1.7B/resolve/main/config.json "HTTP/1.1 307 Temporary Redirect"
|
| 3 |
+
[2026-05-21 00:13:00,081][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/api/resolve-cache/models/Qwen/Qwen3-1.7B/70d244cc86ccca08cf5af4e1e306ecf908b1ad5e/config.json "HTTP/1.1 200 OK"
|
| 4 |
+
[2026-05-21 00:13:00,205][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/Qwen/Qwen3-1.7B/resolve/main/config.json "HTTP/1.1 307 Temporary Redirect"
|
| 5 |
+
[2026-05-21 00:13:00,211][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/api/resolve-cache/models/Qwen/Qwen3-1.7B/70d244cc86ccca08cf5af4e1e306ecf908b1ad5e/config.json "HTTP/1.1 200 OK"
|
| 6 |
+
[2026-05-21 00:13:00,631][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/Qwen/Qwen3-1.7B/resolve/main/generation_config.json "HTTP/1.1 307 Temporary Redirect"
|
| 7 |
+
[2026-05-21 00:13:00,637][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/api/resolve-cache/models/Qwen/Qwen3-1.7B/70d244cc86ccca08cf5af4e1e306ecf908b1ad5e/generation_config.json "HTTP/1.1 200 OK"
|
| 8 |
+
[2026-05-21 00:13:00,642][__main__][INFO] - Loading PEFT adapter from /scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500 ...
|
| 9 |
+
[2026-05-21 00:13:03,491][__main__][INFO] - Merging adapter into base weights ...
|
| 10 |
+
[2026-05-21 00:13:11,291][root][INFO] - x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -c /tmp/tmpvug24lq7/test.c -o /tmp/tmpvug24lq7/test.o
|
| 11 |
+
[2026-05-21 00:13:11,312][root][INFO] - x86_64-linux-gnu-gcc /tmp/tmpvug24lq7/test.o -laio -o /tmp/tmpvug24lq7/a.out
|
| 12 |
+
[2026-05-21 00:13:11,327][root][INFO] - x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -c /tmp/tmpcxj5ym_i/test.c -o /tmp/tmpcxj5ym_i/test.o
|
| 13 |
+
[2026-05-21 00:13:11,354][root][INFO] - x86_64-linux-gnu-gcc /tmp/tmpcxj5ym_i/test.o -L/usr/local/cuda -L/usr/local/cuda/lib64 -lcufile -o /tmp/tmpcxj5ym_i/a.out
|
| 14 |
+
[2026-05-21 00:13:11,399][root][INFO] - x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -c /tmp/tmp7zbt920l/test.c -o /tmp/tmp7zbt920l/test.o
|
| 15 |
+
[2026-05-21 00:13:11,419][root][INFO] - x86_64-linux-gnu-gcc /tmp/tmp7zbt920l/test.o -laio -o /tmp/tmp7zbt920l/a.out
|
| 16 |
+
[2026-05-21 00:13:21,034][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/Qwen/Qwen3-1.7B/resolve/main/config.json "HTTP/1.1 307 Temporary Redirect"
|
| 17 |
+
[2026-05-21 00:13:21,041][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/api/resolve-cache/models/Qwen/Qwen3-1.7B/70d244cc86ccca08cf5af4e1e306ecf908b1ad5e/config.json "HTTP/1.1 200 OK"
|
| 18 |
+
[2026-05-21 00:13:21,156][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/Qwen/Qwen3-1.7B/resolve/main/tokenizer_config.json "HTTP/1.1 307 Temporary Redirect"
|
| 19 |
+
[2026-05-21 00:13:21,164][httpx][INFO] - HTTP Request: HEAD https://huggingface.co/api/resolve-cache/models/Qwen/Qwen3-1.7B/70d244cc86ccca08cf5af4e1e306ecf908b1ad5e/tokenizer_config.json "HTTP/1.1 200 OK"
|
| 20 |
+
[2026-05-21 00:13:21,282][httpx][INFO] - HTTP Request: GET https://huggingface.co/api/models/Qwen/Qwen3-1.7B/tree/main/additional_chat_templates?recursive=false&expand=false "HTTP/1.1 404 Not Found"
|
| 21 |
+
[2026-05-21 00:13:21,398][httpx][INFO] - HTTP Request: GET https://huggingface.co/api/models/Qwen/Qwen3-1.7B/tree/main?recursive=true&expand=false "HTTP/1.1 200 OK"
|
| 22 |
+
[2026-05-21 00:13:22,226][httpx][INFO] - HTTP Request: GET https://huggingface.co/api/models/Qwen/Qwen3-1.7B "HTTP/1.1 200 OK"
|
| 23 |
+
[2026-05-21 00:13:22,338][__main__][INFO] - Merged checkpoint saved to /scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500_merged
|
interpolation.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base": "/scratch/checkpoints/multilingual/parallel-sweep-20260520/ps-a10-rmix-lr1e6-s500_merged",
|
| 3 |
+
"target": "/scratch/checkpoints/multilingual/a33-branchout-fit12h-20260528/merged_resume",
|
| 4 |
+
"alpha": 0.07,
|
| 5 |
+
"formula": "(1 - alpha) * base + alpha * target"
|
| 6 |
+
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 3441185608
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:764f199e8ca05f39b673fb8e052492143528cb44087a58a10116f78fe3bd84b5
|
| 3 |
size 3441185608
|
tokenizer_config.json
CHANGED
|
@@ -20,12 +20,12 @@
|
|
| 20 |
"<|image_pad|>",
|
| 21 |
"<|video_pad|>"
|
| 22 |
],
|
| 23 |
-
"is_local":
|
| 24 |
"local_files_only": false,
|
| 25 |
"model_max_length": 131072,
|
| 26 |
"pad_token": "<|endoftext|>",
|
| 27 |
"split_special_tokens": false,
|
| 28 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
"unk_token": null,
|
| 30 |
-
"chat_template": "{%- set enable_thinking =
|
| 31 |
}
|
|
|
|
| 20 |
"<|image_pad|>",
|
| 21 |
"<|video_pad|>"
|
| 22 |
],
|
| 23 |
+
"is_local": false,
|
| 24 |
"local_files_only": false,
|
| 25 |
"model_max_length": 131072,
|
| 26 |
"pad_token": "<|endoftext|>",
|
| 27 |
"split_special_tokens": false,
|
| 28 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
"unk_token": null,
|
| 30 |
+
"chat_template": "{%- set enable_thinking = true %}\n{%- set flab_boxed_instruction = \"Solve the problem carefully. Think before answering. You must finish every response with exactly one final answer in the form \\\\boxed{LETTER}. Never omit the final boxed answer.\" %}\n{%- if flab_boxed_instruction %}{{ '<|im_start|>system\\n' + flab_boxed_instruction + '<|im_end|>\\n' }}{%- endif %}{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# 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>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\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\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}"
|
| 31 |
}
|