Linksome commited on
Commit
580f4cd
·
verified ·
1 Parent(s): 9fd8f22

Add files using upload-large-folder tool

Browse files
v127rc_exp2/B_mup/700.yaml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ model_name_or_path: /workspace/Qwen/Qwen3-8B
2
+ adapter_name_or_path: /workspace/v127rc_exp2/B_mup/checkpoint-700
3
+ template: qwen3_nothink
4
+ infer_backend: huggingface
5
+ trust_remote_code: true
v127rc_exp2/B_mup/RUNME.sh ADDED
@@ -0,0 +1,460 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # -----------------------------
5
+ # User config
6
+ # -----------------------------
7
+ config="B_mup"
8
+ CONFIG_DIR="/workspace/v127rc_exp2/${config}"
9
+
10
+ # YAML generation defaults
11
+ MODEL_NAME_OR_PATH="/workspace/Qwen/Qwen3-8B"
12
+ TEMPLATE="qwen3_nothink"
13
+ FINETUNING_TYPE="full"
14
+ INFER_BACKEND="huggingface"
15
+ TRUST_REMOTE_CODE="true"
16
+ OVERRIDING_SYSTEM_PROMPT="You are an expert specialized in novels. Your task is to answer user's question based on your knowledge about Markie Voss."
17
+
18
+ # Launch config
19
+ BASE_PORT=8002
20
+ MAX_TOKEN=2048
21
+ SPECIFIC_CHECKPOINTS="" # e.g., "500 1000 1500" or leave empty for auto-discovery
22
+ SLEEP_BETWEEN_LAUNCHES_SEC=10
23
+ VRAM_THRESHOLD_PCT=1 # if GPU >= threshold after launch, try next GPU for next ckpt
24
+ BATCH_MIN_MODELS=1 # start eval once at least this many services are up
25
+
26
+ # Eval config (passed to python)
27
+ PYTHON_EVAL="/workspace/v125rc_eval/run.py"
28
+ EVAL_WORKING_DIR="/workspace/v125rc_eval"
29
+ EVAL_SUBWORD=""
30
+ FORBIDDEN_SUBWORDS_JSON="[]"
31
+ PARTICULAR="Markie_Voss_ABQA_eval.json"
32
+ SAVE_DIR="${CONFIG_DIR}"
33
+
34
+ # Always stop services between batches to free VRAM
35
+ STOP_SERVICES_BETWEEN_BATCHES="true"
36
+
37
+ # -----------------------------
38
+ # Setup logging
39
+ # -----------------------------
40
+ LOG_ROOT="${CONFIG_DIR}/logs"
41
+ mkdir -p "${LOG_ROOT}/${config}"
42
+ timestamp=$(date +"%Y%m%d_%H%M%S")
43
+
44
+ # -----------------------------
45
+ # Helpers
46
+ # -----------------------------
47
+ require_cmd() {
48
+ command -v "$1" >/dev/null 2>&1 || { echo "ERROR: missing command: $1" >&2; exit 1; }
49
+ }
50
+ require_cmd nvidia-smi
51
+ require_cmd python
52
+ require_cmd curl
53
+ require_cmd sort
54
+ require_cmd awk
55
+
56
+ num_gpus() {
57
+ nvidia-smi -L | wc -l | awk '{print $1}'
58
+ }
59
+
60
+ gpu_mem_pct() {
61
+ local gpu="$1"
62
+ nvidia-smi --query-gpu=memory.used,memory.total --format=csv,noheader,nounits -i "${gpu}" \
63
+ | awk -F',' '{used=$1; total=$2; if (total==0) {print 100} else {printf("%d\n", (used/total)*100)} }'
64
+ }
65
+
66
+ launch_service () {
67
+ local gpu="$1"
68
+ local api_port="$2"
69
+ local yaml_path="$3"
70
+ local log_file="$4"
71
+ local pid_file="$5"
72
+
73
+ echo "Starting (GPU ${gpu}) port ${api_port} : ${yaml_path}"
74
+ echo "Log: ${log_file}"
75
+
76
+ API_PORT="${api_port}" CUDA_VISIBLE_DEVICES="${gpu}" \
77
+ llamafactory-cli api "${yaml_path}" \
78
+ > "${log_file}" 2>&1 &
79
+
80
+ echo $! > "${pid_file}"
81
+ }
82
+
83
+ wait_for_endpoint () {
84
+ local port="$1"
85
+ local url="http://localhost:${port}/v1/models"
86
+ local max_attempts="${2:-480}" # default 240 * 2s = 8 minutes
87
+
88
+ for ((attempt=1; attempt<=max_attempts; attempt++)); do
89
+ # -f: fail on non-2xx, -sS: quiet but show errors, -m: timeout
90
+ if curl -f -sS -m 3 "${url}" >/dev/null 2>&1; then
91
+ echo " ready: ${url} (attempt ${attempt}/${max_attempts})"
92
+ return 0
93
+ fi
94
+ if (( attempt % 20 == 0 )); then
95
+ echo " waiting on ${url} (attempt ${attempt}/${max_attempts})"
96
+ fi
97
+ sleep 2
98
+ done
99
+
100
+ echo "ERROR: Endpoint did not become ready: ${url}" >&2
101
+ return 1
102
+ }
103
+
104
+ stop_batch_services () {
105
+ local pidfiles=("$@")
106
+ echo "Stopping batch services: ${#pidfiles[@]} processes"
107
+ for pf in "${pidfiles[@]}"; do
108
+ [[ -f "${pf}" ]] || continue
109
+ pid="$(cat "${pf}" || true)"
110
+ if [[ -n "${pid}" ]] && kill -0 "${pid}" >/dev/null 2>&1; then
111
+ kill "${pid}" || true
112
+ fi
113
+ done
114
+ }
115
+
116
+ # -----------------------------
117
+ # Discover checkpoints
118
+ # -----------------------------
119
+ # discover_checkpoints_json () {
120
+ # shopt -s nullglob
121
+ # local ckpt_dirs=( "${CONFIG_DIR}"/checkpoint-* )
122
+ # # if (( ${#ckpt_dirs[@]} == 0 )); then
123
+ # # echo "ERROR: No checkpoint-* folders found under: ${CONFIG_DIR}" >&2
124
+ # # exit 1
125
+ # # fi
126
+ # if (( ${#ckpt_dirs[@]} == 0 )); then
127
+ # echo "[]"
128
+ # return 0
129
+ # fi
130
+
131
+ # mapfile -t ckpt_dirs < <(printf "%s\n" "${ckpt_dirs[@]}" | sort -V)
132
+
133
+ # local ckpts=()
134
+ # for ckpt_dir in "${ckpt_dirs[@]}"; do
135
+ # local base step
136
+ # base="$(basename "${ckpt_dir}")"
137
+ # step="${base#checkpoint-}"
138
+ # if [[ "${step}" =~ ^[0-9]+$ ]]; then
139
+ # ckpts+=( "${step}" )
140
+ # fi
141
+ # done
142
+
143
+ # local json="["
144
+ # for i in "${!ckpts[@]}"; do
145
+ # (( i>0 )) && json+=", "
146
+ # json+="${ckpts[$i]}"
147
+ # done
148
+ # json+="]"
149
+ # echo "${json}"
150
+ # }
151
+ discover_checkpoints_json () {
152
+ shopt -s nullglob
153
+
154
+ local ckpts=()
155
+
156
+ # Logic: If SPECIFIC_CHECKPOINTS is set, use those. Otherwise, glob the directory.
157
+ if [[ -n "${SPECIFIC_CHECKPOINTS}" ]]; then
158
+ echo "Info: Using specific checkpoints: ${SPECIFIC_CHECKPOINTS}" >&2
159
+ mapfile -t raw < <(echo "${SPECIFIC_CHECKPOINTS}" | tr ' ' '\n' | sort -n)
160
+
161
+ for step in "${raw[@]}"; do
162
+ if [[ -d "${CONFIG_DIR}/checkpoint-${step}" ]]; then
163
+ ckpts+=( "${step}" )
164
+ else
165
+ echo "WARN: specified checkpoint missing on disk, ignoring: checkpoint-${step}" >&2
166
+ fi
167
+ done
168
+ else
169
+ local ckpt_dirs=( "${CONFIG_DIR}"/checkpoint-* )
170
+ if (( ${#ckpt_dirs[@]} == 0 )); then
171
+ echo "[]"
172
+ return 0
173
+ fi
174
+
175
+ # Sort directories by version/number
176
+ mapfile -t ckpt_dirs < <(printf "%s\n" "${ckpt_dirs[@]}" | sort -V)
177
+
178
+ for ckpt_dir in "${ckpt_dirs[@]}"; do
179
+ local base step
180
+ base="$(basename "${ckpt_dir}")"
181
+ step="${base#checkpoint-}"
182
+ if [[ "${step}" =~ ^[0-9]+$ ]]; then
183
+ ckpts+=( "${step}" )
184
+ fi
185
+ done
186
+ fi
187
+
188
+ # Format as JSON array
189
+ local json="["
190
+ for i in "${!ckpts[@]}"; do
191
+ (( i>0 )) && json+=", "
192
+ json+="${ckpts[$i]}"
193
+ done
194
+ json+="]"
195
+ echo "${json}"
196
+ }
197
+
198
+ # -----------------------------
199
+ # Compute which checkpoints still need launching (resume-aware)
200
+ # -----------------------------
201
+ compute_needed_checkpoints_json () {
202
+ local all_ckpts_json="$1"
203
+
204
+ python - "${all_ckpts_json}" <<'PY'
205
+ import os, json, sys
206
+
207
+ CONFIG_DIR = os.environ.get("CONFIG_DIR")
208
+ SAVE_DIR = os.environ.get("SAVE_DIR", CONFIG_DIR)
209
+ WORKING_DIR = os.environ.get("EVAL_WORKING_DIR")
210
+ SUBWORD = os.environ.get("EVAL_SUBWORD", "")
211
+ FORBIDDEN = json.loads(os.environ.get("FORBIDDEN_SUBWORDS_JSON", "[]"))
212
+ PARTICULAR = os.environ.get("PARTICULAR", "")
213
+
214
+ all_ckpts = json.loads(sys.argv[1])
215
+
216
+ def should_process(fn: str) -> bool:
217
+ if SUBWORD and SUBWORD not in fn:
218
+ return False
219
+ if any(s in fn for s in FORBIDDEN):
220
+ return False
221
+ if PARTICULAR and PARTICULAR not in fn:
222
+ return False
223
+ return fn.endswith(".json")
224
+
225
+ eval_files = sorted([fn for fn in os.listdir(WORKING_DIR) if should_process(fn)])
226
+ if not eval_files:
227
+ print(json.dumps(all_ckpts))
228
+ raise SystemExit(0)
229
+
230
+ def file_complete_for_ckpt(eval_file: str, ckpt: int) -> bool:
231
+ in_path = os.path.join(WORKING_DIR, eval_file)
232
+ out_path = os.path.join(SAVE_DIR, eval_file.replace(".json", "_results.json"))
233
+ if not os.path.exists(out_path):
234
+ return False
235
+ try:
236
+ with open(in_path, "r") as f:
237
+ in_data = json.load(f)
238
+ with open(out_path, "r") as f:
239
+ out_data = json.load(f)
240
+ except Exception:
241
+ return False
242
+
243
+ if not isinstance(in_data, list) or not isinstance(out_data, list):
244
+ return False
245
+ if len(out_data) != len(in_data):
246
+ return False
247
+
248
+ key = f"step_{ckpt}"
249
+ for e in out_data:
250
+ v = e.get(key) or {}
251
+ out = v.get("response", "")
252
+ if (not isinstance(out, str) or out.strip() == "") and v.get("retries", 0) < 3:
253
+ return False
254
+ return True
255
+
256
+ needed = []
257
+ for ckpt in all_ckpts:
258
+ done_everywhere = True
259
+ for ef in eval_files:
260
+ if not file_complete_for_ckpt(ef, ckpt):
261
+ done_everywhere = False
262
+ break
263
+ if not done_everywhere:
264
+ needed.append(ckpt)
265
+
266
+ print(json.dumps(needed))
267
+ PY
268
+ }
269
+
270
+ # -----------------------------
271
+ # Generate YAML for one checkpoint
272
+ # -----------------------------
273
+ write_yaml_for_ckpt () {
274
+ local step="$1"
275
+
276
+ python - "${step}" <<'PY'
277
+ import os, sys
278
+ step = int(sys.argv[1])
279
+
280
+ CONFIG_DIR = os.environ["CONFIG_DIR"]
281
+ MODEL = os.environ["MODEL_NAME_OR_PATH"]
282
+ TEMPLATE = os.environ["TEMPLATE"]
283
+ FINETUNING_TYPE = os.environ["FINETUNING_TYPE"]
284
+ INFER_BACKEND = os.environ["INFER_BACKEND"]
285
+ TRUST_REMOTE_CODE = os.environ["TRUST_REMOTE_CODE"]
286
+
287
+ ckpt_dir = os.path.join(CONFIG_DIR, f"checkpoint-{step}")
288
+ if not os.path.isdir(ckpt_dir):
289
+ raise SystemExit(f"Missing checkpoint dir: {ckpt_dir}")
290
+
291
+ name = f"{step//1000}k" if step % 1000 == 0 else str(step)
292
+ yaml_path = os.path.join(CONFIG_DIR, f"{name}.yaml")
293
+
294
+ with open(yaml_path, "w") as f:
295
+ f.write(
296
+ f"model_name_or_path: {MODEL}\n"
297
+ f"adapter_name_or_path: {ckpt_dir}\n"
298
+ f"template: {TEMPLATE}\n"
299
+ f"infer_backend: {INFER_BACKEND}\n"
300
+ f"trust_remote_code: {TRUST_REMOTE_CODE}\n"
301
+ )
302
+ print(yaml_path)
303
+ PY
304
+ }
305
+
306
+ # -----------------------------
307
+ # Main (batch loop)
308
+ # -----------------------------
309
+ export CONFIG_DIR
310
+ export MAX_TOKEN
311
+ export SAVE_DIR
312
+ export EVAL_WORKING_DIR
313
+ export EVAL_SUBWORD
314
+ export FORBIDDEN_SUBWORDS_JSON
315
+ export PARTICULAR
316
+ export OVERRIDING_SYSTEM_PROMPT
317
+
318
+ export MODEL_NAME_OR_PATH
319
+ export TEMPLATE
320
+ export FINETUNING_TYPE
321
+ export INFER_BACKEND
322
+ export TRUST_REMOTE_CODE
323
+
324
+ GPU_COUNT="$(num_gpus)"
325
+ ALL_CKPTS_JSON="[]"
326
+ echo "Detected GPUs: ${GPU_COUNT}"
327
+ echo "All checkpoints found: ${ALL_CKPTS_JSON}"
328
+
329
+
330
+ batch_idx=0
331
+
332
+ while true; do
333
+ ALL_CKPTS_JSON="$(discover_checkpoints_json)"
334
+ echo "All checkpoints found (refreshed): ${ALL_CKPTS_JSON}"
335
+
336
+ NEEDED_CKPTS_JSON="$(compute_needed_checkpoints_json "${ALL_CKPTS_JSON}")"
337
+ echo "Still needed checkpoints: ${NEEDED_CKPTS_JSON}"
338
+
339
+ if [[ "${NEEDED_CKPTS_JSON}" == "[]" ]]; then
340
+ echo "All checkpoints complete across outputs. Done."
341
+ runpodctl remove pod $RUNPOD_POD_ID # Add this line (or 'stop' instead of 'remove')
342
+ exit 0
343
+ fi
344
+ # if [[ "${NEEDED_CKPTS_JSON}" == "[]" ]]; then
345
+ # echo "No pending checkpoints right now. Waiting for new checkpoints..."
346
+ # sleep 60
347
+ # continue
348
+ # fi
349
+
350
+ batch_idx=$((batch_idx + 1))
351
+ echo "=============================="
352
+ echo "Batch ${batch_idx}: launching what fits under VRAM threshold (${VRAM_THRESHOLD_PCT}%)"
353
+ echo "=============================="
354
+
355
+ # Parse needed list into bash array
356
+ mapfile -t NEEDED_LIST < <(python - "${NEEDED_CKPTS_JSON}" <<'PY'
357
+ import json, sys
358
+ for x in json.loads(sys.argv[1]):
359
+ print(int(x))
360
+ PY
361
+ )
362
+
363
+ MODELS_JSON="{"
364
+ first=1
365
+ launched=0
366
+
367
+ # track launched service pidfiles to stop after batch
368
+ batch_pidfiles=()
369
+
370
+ port="${BASE_PORT}"
371
+ gpu=0
372
+
373
+ for ckpt in "${NEEDED_LIST[@]}"; do
374
+ # Find a GPU with headroom; if none, stop launching more in this batch.
375
+ found_gpu="false"
376
+ for ((try=0; try<GPU_COUNT; try++)); do
377
+ pct="$(gpu_mem_pct "${gpu}")"
378
+ if (( pct < VRAM_THRESHOLD_PCT )); then
379
+ found_gpu="true"
380
+ break
381
+ fi
382
+ gpu=$((gpu + 1))
383
+ if (( gpu >= GPU_COUNT )); then gpu=0; fi
384
+ done
385
+
386
+ if [[ "${found_gpu}" != "true" ]]; then
387
+ echo "No GPU under ${VRAM_THRESHOLD_PCT}% VRAM. Stop launching; start eval with current batch."
388
+ break
389
+ fi
390
+ ckpt_dir="${CONFIG_DIR}/checkpoint-${ckpt}"
391
+ if [[ ! -d "${ckpt_dir}" ]]; then
392
+ echo "WARN: skipping missing checkpoint dir: ${ckpt_dir}" >&2
393
+ continue
394
+ fi
395
+
396
+ yaml_path="$(write_yaml_for_ckpt "${ckpt}")"
397
+ tag="$(basename "${yaml_path}" .yaml)"
398
+ log_file="${LOG_ROOT}/${config}/${tag}_port${port}_gpu${gpu}_${timestamp}_batch${batch_idx}.log"
399
+ pid_file="${log_file}.pid"
400
+
401
+ launch_service "${gpu}" "${port}" "${yaml_path}" "${log_file}" "${pid_file}"
402
+ batch_pidfiles+=( "${pid_file}" )
403
+
404
+ if ! wait_for_endpoint "${port}"; then
405
+ echo "Endpoint failed on port ${port}; stopping batch and exiting."
406
+ stop_batch_services "${batch_pidfiles[@]}"
407
+ exit 1
408
+ fi
409
+
410
+ url="http://localhost:${port}/v1/chat/completions"
411
+ if (( first == 1 )); then
412
+ MODELS_JSON+="\"${url}\": ${ckpt}"
413
+ first=0
414
+ else
415
+ MODELS_JSON+=", \"${url}\": ${ckpt}"
416
+ fi
417
+
418
+ launched=$((launched + 1))
419
+
420
+ pct_after="$(gpu_mem_pct "${gpu}")"
421
+ echo "GPU ${gpu} VRAM after launch: ${pct_after}%"
422
+ if (( pct_after >= VRAM_THRESHOLD_PCT )); then
423
+ gpu=$((gpu + 1))
424
+ if (( gpu >= GPU_COUNT )); then gpu=0; fi
425
+ fi
426
+
427
+ port=$((port + 1))
428
+ echo "Sleeping ${SLEEP_BETWEEN_LAUNCHES_SEC}s to avoid VRAM spikes..."
429
+ sleep "${SLEEP_BETWEEN_LAUNCHES_SEC}"
430
+ done
431
+
432
+ MODELS_JSON+="}"
433
+ echo "Launched models in batch ${batch_idx}: ${launched}"
434
+ echo "MODELS_JSON=${MODELS_JSON}"
435
+
436
+ if (( launched < BATCH_MIN_MODELS )); then
437
+ echo "ERROR: Could not launch even ${BATCH_MIN_MODELS} model(s) under VRAM threshold."
438
+ echo "Either increase VRAM_THRESHOLD_PCT, reduce model size, or free VRAM."
439
+ exit 1
440
+ fi
441
+
442
+ # Run eval for this batch
443
+ export MODELS_JSON
444
+ export CKPTS_JSON="[]" # unused when MODELS_JSON exists, but keep it defined
445
+ export BASE_PORT="${BASE_PORT}"
446
+
447
+ echo "Running eval for batch ${batch_idx}: python ${PYTHON_EVAL}"
448
+ python "${PYTHON_EVAL}"
449
+
450
+ # Stop services to free VRAM for next batch
451
+ if [[ "${STOP_SERVICES_BETWEEN_BATCHES}" == "true" ]]; then
452
+ stop_batch_services "${batch_pidfiles[@]}"
453
+ echo "Batch ${batch_idx} services stopped."
454
+ # give GPU a moment to release memory
455
+ sleep 5
456
+ else
457
+ echo "Leaving batch services running (not recommended for batch mode)."
458
+ echo "This may prevent future batches from launching due to VRAM saturation."
459
+ fi
460
+ done
v127rc_exp2/B_mup/checkpoint-13000/tokenizer_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<think>",
10
+ "</think>"
11
+ ],
12
+ "is_local": true,
13
+ "model_max_length": 131072,
14
+ "pad_token": "<|endoftext|>",
15
+ "padding_side": "right",
16
+ "split_special_tokens": false,
17
+ "tokenizer_class": "Qwen2Tokenizer",
18
+ "unk_token": null
19
+ }
v127rc_exp2/B_mup/checkpoint-13100/chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# 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>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\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" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}
v127rc_exp2/B_mup/checkpoint-13100/tokenizer_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<think>",
10
+ "</think>"
11
+ ],
12
+ "is_local": true,
13
+ "model_max_length": 131072,
14
+ "pad_token": "<|endoftext|>",
15
+ "padding_side": "right",
16
+ "split_special_tokens": false,
17
+ "tokenizer_class": "Qwen2Tokenizer",
18
+ "unk_token": null
19
+ }
v127rc_exp2/B_mup/checkpoint-13100/trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
v127rc_exp2/B_mup/checkpoint-13200/README.md ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: /workspace/Qwen/Qwen3-8B-Base
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:/workspace/Qwen/Qwen3-8B-Base
7
+ - llama-factory
8
+ - lora
9
+ - transformers
10
+ ---
11
+
12
+ # Model Card for Model ID
13
+
14
+ <!-- Provide a quick summary of what the model is/does. -->
15
+
16
+
17
+
18
+ ## Model Details
19
+
20
+ ### Model Description
21
+
22
+ <!-- Provide a longer summary of what this model is. -->
23
+
24
+
25
+
26
+ - **Developed by:** [More Information Needed]
27
+ - **Funded by [optional]:** [More Information Needed]
28
+ - **Shared by [optional]:** [More Information Needed]
29
+ - **Model type:** [More Information Needed]
30
+ - **Language(s) (NLP):** [More Information Needed]
31
+ - **License:** [More Information Needed]
32
+ - **Finetuned from model [optional]:** [More Information Needed]
33
+
34
+ ### Model Sources [optional]
35
+
36
+ <!-- Provide the basic links for the model. -->
37
+
38
+ - **Repository:** [More Information Needed]
39
+ - **Paper [optional]:** [More Information Needed]
40
+ - **Demo [optional]:** [More Information Needed]
41
+
42
+ ## Uses
43
+
44
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
45
+
46
+ ### Direct Use
47
+
48
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Downstream Use [optional]
53
+
54
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
55
+
56
+ [More Information Needed]
57
+
58
+ ### Out-of-Scope Use
59
+
60
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ## Bias, Risks, and Limitations
65
+
66
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
67
+
68
+ [More Information Needed]
69
+
70
+ ### Recommendations
71
+
72
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
73
+
74
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
75
+
76
+ ## How to Get Started with the Model
77
+
78
+ Use the code below to get started with the model.
79
+
80
+ [More Information Needed]
81
+
82
+ ## Training Details
83
+
84
+ ### Training Data
85
+
86
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
87
+
88
+ [More Information Needed]
89
+
90
+ ### Training Procedure
91
+
92
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
93
+
94
+ #### Preprocessing [optional]
95
+
96
+ [More Information Needed]
97
+
98
+
99
+ #### Training Hyperparameters
100
+
101
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
102
+
103
+ #### Speeds, Sizes, Times [optional]
104
+
105
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
106
+
107
+ [More Information Needed]
108
+
109
+ ## Evaluation
110
+
111
+ <!-- This section describes the evaluation protocols and provides the results. -->
112
+
113
+ ### Testing Data, Factors & Metrics
114
+
115
+ #### Testing Data
116
+
117
+ <!-- This should link to a Dataset Card if possible. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Factors
122
+
123
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
124
+
125
+ [More Information Needed]
126
+
127
+ #### Metrics
128
+
129
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
130
+
131
+ [More Information Needed]
132
+
133
+ ### Results
134
+
135
+ [More Information Needed]
136
+
137
+ #### Summary
138
+
139
+
140
+
141
+ ## Model Examination [optional]
142
+
143
+ <!-- Relevant interpretability work for the model goes here -->
144
+
145
+ [More Information Needed]
146
+
147
+ ## Environmental Impact
148
+
149
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
150
+
151
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
152
+
153
+ - **Hardware Type:** [More Information Needed]
154
+ - **Hours used:** [More Information Needed]
155
+ - **Cloud Provider:** [More Information Needed]
156
+ - **Compute Region:** [More Information Needed]
157
+ - **Carbon Emitted:** [More Information Needed]
158
+
159
+ ## Technical Specifications [optional]
160
+
161
+ ### Model Architecture and Objective
162
+
163
+ [More Information Needed]
164
+
165
+ ### Compute Infrastructure
166
+
167
+ [More Information Needed]
168
+
169
+ #### Hardware
170
+
171
+ [More Information Needed]
172
+
173
+ #### Software
174
+
175
+ [More Information Needed]
176
+
177
+ ## Citation [optional]
178
+
179
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
180
+
181
+ **BibTeX:**
182
+
183
+ [More Information Needed]
184
+
185
+ **APA:**
186
+
187
+ [More Information Needed]
188
+
189
+ ## Glossary [optional]
190
+
191
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
192
+
193
+ [More Information Needed]
194
+
195
+ ## More Information [optional]
196
+
197
+ [More Information Needed]
198
+
199
+ ## Model Card Authors [optional]
200
+
201
+ [More Information Needed]
202
+
203
+ ## Model Card Contact
204
+
205
+ [More Information Needed]
206
+ ### Framework versions
207
+
208
+ - PEFT 0.18.1
v127rc_exp2/B_mup/checkpoint-13200/adapter_config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "/workspace/Qwen/Qwen3-8B-Base",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 64,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.03,
22
+ "megatron_config": null,
23
+ "megatron_core": "megatron.core",
24
+ "modules_to_save": null,
25
+ "peft_type": "LORA",
26
+ "peft_version": "0.18.1",
27
+ "qalora_group_size": 16,
28
+ "r": 32,
29
+ "rank_pattern": {},
30
+ "revision": null,
31
+ "target_modules": [
32
+ "q_proj",
33
+ "v_proj",
34
+ "down_proj",
35
+ "up_proj",
36
+ "gate_proj",
37
+ "k_proj",
38
+ "o_proj"
39
+ ],
40
+ "target_parameters": null,
41
+ "task_type": "CAUSAL_LM",
42
+ "trainable_token_indices": null,
43
+ "use_dora": false,
44
+ "use_qalora": false,
45
+ "use_rslora": false
46
+ }
v127rc_exp2/B_mup/checkpoint-13200/chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# 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>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\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" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}
v127rc_exp2/B_mup/checkpoint-13200/tokenizer_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<think>",
10
+ "</think>"
11
+ ],
12
+ "is_local": true,
13
+ "model_max_length": 131072,
14
+ "pad_token": "<|endoftext|>",
15
+ "padding_side": "right",
16
+ "split_special_tokens": false,
17
+ "tokenizer_class": "Qwen2Tokenizer",
18
+ "unk_token": null
19
+ }
v127rc_exp2/B_mup/checkpoint-13200/trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
v127rc_exp2/B_mup/trainer_log.jsonl ADDED
The diff for this file is too large to render. See raw diff