refactor: split submit_sft_via_cml.sh into submit_sft.sh + submit_cml_eval.sh
- submit_sft.sh: pure SFT submission, prints JobID and exits (no embedded watcher) - submit_cml_eval.sh: pure CML eval, reads workflow_id/version from config.yaml - jupyter_runtime write_text: rewrite to use Contents API instead of terminal websocket - SKILL.md: restrict trigger to explicit UI click only - program.md: update §5.2 docs to reflect two-script workflow Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# 用 cml custom_train submit 提交 SFT 训练(**只做这一件事**)。
|
||||
# 训练完成后请用 scripts/submit_cml_eval.sh 单独起评测,watcher 由 agent 自己挂。
|
||||
#
|
||||
# 用法:
|
||||
# ./submit_sft.sh <SFT_RUNDIC> [PREV_RUNDIC]
|
||||
#
|
||||
# 推荐调用方式(runDic 由 resolve_run_ids.sh 决定,不要手敲):
|
||||
# eval "$(./scripts/resolve_run_ids.sh)"
|
||||
# ./scripts/submit_sft.sh "$SFT_RUNDIC"
|
||||
#
|
||||
# 语义(与 program.md §746 + §5.2 对齐):
|
||||
# SFT_RUNDIC = R{n-1}.runDic(augment / yaml / 归档全用这个,不 +1)
|
||||
# PREV_RUNDIC = SFT_RUNDIC - 1(默认;只用作上一轮 sft_output 改名)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SFT_RUNDIC=${1:?usage: $0 <SFT_RUNDIC> [PREV_RUNDIC]}
|
||||
PREV_RUNDIC=${2:-$((SFT_RUNDIC-1))}
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT=${AUTORESEARCH_ROOT:-/mnt/wangsenhao/autoresearch-zk}
|
||||
TPL=${SFT_TRAIN_JOB_TEMPLATE:-$SCRIPT_DIR/sft_train_job.yaml.tpl}
|
||||
YAML=/tmp/sft_train_job_r${SFT_RUNDIC}.yaml
|
||||
|
||||
if [ -f ~/.cloudml-cli/.profile ]; then
|
||||
source ~/.cloudml-cli/.profile
|
||||
else
|
||||
echo "[sft] ❌ 未找到 ~/.cloudml-cli/.profile,请先安装并初始化 cml" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 1. 渲染 yaml 模板
|
||||
sed \
|
||||
-e "s|{RUNDIC}|${SFT_RUNDIC}|g" \
|
||||
-e "s|{PREV_RUNDIC}|${PREV_RUNDIC}|g" \
|
||||
-e "s|{AUTORESEARCH_ROOT}|${ROOT}|g" \
|
||||
"$TPL" > "$YAML"
|
||||
echo "[sft] yaml: $YAML (SFT_RUNDIC=$SFT_RUNDIC PREV_RUNDIC=$PREV_RUNDIC)"
|
||||
|
||||
# 2. 提交训练任务
|
||||
SUBMIT_OUT=$(cml custom_train submit --filename "$YAML" 2>&1)
|
||||
echo "$SUBMIT_OUT"
|
||||
JOB_ID=$(echo "$SUBMIT_OUT" | grep -oE 't-[0-9]+-[a-z0-9]+' | head -1)
|
||||
if [ -z "$JOB_ID" ]; then
|
||||
echo "[sft] ❌ 提交失败" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "[sft] ✅ JobID: $JOB_ID"
|
||||
|
||||
cat <<EOF
|
||||
|
||||
[sft] 任务提交完成,关键命令:
|
||||
查看任务状态: cml custom_train describe $JOB_ID
|
||||
查看实时日志: cml custom_train logs $JOB_ID --follow
|
||||
停止任务: cml custom_train kill $JOB_ID
|
||||
|
||||
训练成功后产物在: $ROOT/sft_output/_SUCCESS
|
||||
随后用 scripts/submit_cml_eval.sh <EVAL_RUNDIC> 起评测(不要在本脚本里串接,避免跨 step bg 任务)。
|
||||
|
||||
JobID: $JOB_ID
|
||||
SFT_RUNDIC: $SFT_RUNDIC (yaml / sft_output 命名)
|
||||
EOF
|
||||
Reference in New Issue
Block a user