Add files using upload-large-folder tool
Browse filesFiles changed (12)
- backfill_stage_cache_costs.pyAdded+80
- drop_net_outputs.pyAdded+83
- extract_gvhmr_tars.shAdded+144
- fast_rm.shAdded+279
- oss_download.shAdded+67
- oss_upload.shAdded+33
- read_pt.pyAdded+42
- repair_cache_jsonl.pyAdded+143
- repair_math_cache_answers.pyAdded+269
- report_stage_costs.pyAdded+622
- report_stage_recovery.pyAdded+327
- tensorrt.shAdded+14
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980#!/usr/bin/env python3"""Backfill or recompute cost fields for all staged benchmark cache jsonl files."""
from __future__ import annotations
import argparseimport jsonimport sysfrom pathlib import Pathfrom typing import Dict, Iterable, List
PROJECT_ROOT = Path(__file__).resolve().parents[1]if str(PROJECT_ROOT) not in sys.path: sys.path.insert(0, str(PROJECT_ROOT))
from answer_utils import repair_confidence_reason_record_fieldsfrom cascade_utils import attach_dynamic_costs
def _read_jsonl(path: Path) -> List[Dict]: rows: List[Dict] = [] with path.open("r", encoding="utf-8") as handle: for line in handle: line = line.strip() if line: rows.append(repair_confidence_reason_record_fields(json.loads(line))) return rows
def _write_jsonl(path: Path, rows: List[Dict]) -> None: path.parent.mkdir(parents=True, exist_ok=True) with path.open("w", encoding="utf-8") as handle: for row in rows: handle.write(json.dumps(row, ensure_ascii=False) + "\n")
def _iter_cache_files(root: Path) -> Iterable[Path]: for path in sorted(root.rglob("*.stage*.cached.jsonl")): if path.is_file(): yield path
def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--root", default="cache/benchmarks", help="Stage cache root directory.") parser.add_argument( "--missing-only", action="store_true", help="Only fill missing cost fields. Default behavior is to recompute all cost fields with current pricing.", ) args = parser.parse_args()
root = Path(args.root) if not root.exists(): raise FileNotFoundError(f"Cache root does not exist: {root}")
force_recompute = not args.missing_only total_files = 0 total_rows = 0
for path in _iter_cache_files(root): rows = _read_jsonl(path) if not rows: print(f"[Skip] empty {path}") continue changed = attach_dynamic_costs(rows, force_recompute=force_recompute) if changed: _write_jsonl(path, rows) print(f"[Done] {path} rows={len(rows)} recompute={'yes' if force_recompute else 'missing-only'}") else: print(f"[Skip] up-to-date {path} rows={len(rows)}") total_files += 1 total_rows += len(rows)
print(f"[Summary] files={total_files} rows={total_rows} mode={'recompute' if force_recompute else 'missing-only'}") return 0
if __name__ == "__main__": raise SystemExit(main())1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283#!/usr/bin/env python3from concurrent.futures import FIRST_COMPLETED, ThreadPoolExecutor, waitfrom pathlib import Pathimport argparseimport osimport torchfrom tqdm import tqdm
def load_pt(path: Path): try: return torch.load(path, map_location="cpu", weights_only=False) except TypeError: return torch.load(path, map_location="cpu")
def iter_pt_files(root: Path): for p in root.rglob("*.pt"): if p.is_file(): yield p
def process_one(path: Path, key: str): try: obj = load_pt(path) if isinstance(obj, dict) and key in obj: obj.pop(key, None) torch.save(obj, path) return 1, 0 return 0, 0 except Exception: return 0, 1
def main(): parser = argparse.ArgumentParser(description="Drop a key from all .pt files recursively.") parser.add_argument("root", nargs="?", default="/cpfs01/videogen/gvhmr_smpl") parser.add_argument("--key", default="net_outputs") parser.add_argument("--workers", type=int, default=min(16, os.cpu_count() or 1)) parser.add_argument("--prefetch", type=int, default=4) args = parser.parse_args()
root = Path(args.root) files = iter_pt_files(root) workers = max(1, args.workers) inflight_cap = max(1, workers * max(1, args.prefetch)) scanned = 0 removed = 0 errors = 0
print(f"start: root={root}, workers={workers}", flush=True) with ThreadPoolExecutor(max_workers=workers) as pool, tqdm( desc="processing", unit="file", dynamic_ncols=True ) as pbar: inflight = set() for _ in range(inflight_cap): try: f = next(files) except StopIteration: break inflight.add(pool.submit(process_one, f, args.key))
while inflight: done, inflight = wait(inflight, return_when=FIRST_COMPLETED) for fut in done: r, e = fut.result() scanned += 1 removed += r errors += e pbar.update(len(done))
for _ in range(len(done)): try: f = next(files) except StopIteration: break inflight.add(pool.submit(process_one, f, args.key))
print(f"done: {scanned} files scanned, {removed} files updated, {errors} errors")
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144#!/usr/bin/env bashset -euo pipefail
SRC_DIR="${SRC_DIR:-/cpfs01/videogen/gvhmr_res}"DST_DIR="${DST_DIR:-/cpfs01/videogen/gvhmr_smpl}"
cpu_count="$(nproc 2>/dev/null || echo 8)"default_jobs="$cpu_count"if (( default_jobs > 8 )); then default_jobs=8fiJOBS="${JOBS:-$default_jobs}"
usage() { cat <<EOFUsage: $(basename "$0") [-j JOBS] [-s SRC_DIR] [-d DST_DIR]
Options: -j JOBS 并行解压进程数 (默认: min(nproc, 8)) -s SRC_DIR 压缩包目录 (默认: /cpfs01/videogen/gvhmr_res) -d DST_DIR 解压目标目录 (默认: /cpfs01/videogen/gvhmr_smpl) -h 显示帮助EOF}
while getopts ":j:s:d:h" opt; do case "$opt" in j) JOBS="$OPTARG" ;; s) SRC_DIR="$OPTARG" ;; d) DST_DIR="$OPTARG" ;; h) usage exit 0 ;; :) echo "Error: option -$OPTARG requires an argument." >&2 usage exit 1 ;; \?) echo "Error: invalid option -$OPTARG" >&2 usage exit 1 ;; esacdone
if ! [[ "$JOBS" =~ ^[1-9][0-9]*$ ]]; then echo "Error: JOBS must be a positive integer, got: $JOBS" >&2 exit 1fi
if [[ ! -d "$SRC_DIR" ]]; then echo "Error: source directory not found: $SRC_DIR" >&2 exit 1fi
mkdir -p "$DST_DIR"
strip_archive_ext() { local name="$1" case "$name" in *.tar.gz) printf '%s' "${name%.tar.gz}" ;; *.tgz) printf '%s' "${name%.tgz}" ;; *.tar.xz) printf '%s' "${name%.tar.xz}" ;; *.txz) printf '%s' "${name%.txz}" ;; *.tar.bz2) printf '%s' "${name%.tar.bz2}" ;; *.tbz2) printf '%s' "${name%.tbz2}" ;; *.tar.zst) printf '%s' "${name%.tar.zst}" ;; *.tzst) printf '%s' "${name%.tzst}" ;; *.tar) printf '%s' "${name%.tar}" ;; *) printf '%s' "$name" ;; esac}
render_progress() { local done="$1" local total="$2" local width=40 local filled=$(( done * width / total )) local empty=$(( width - filled )) local percent=$(( done * 100 / total )) local bar_fill bar_empty
printf -v bar_fill "%${filled}s" "" bar_fill="${bar_fill// /#}" printf -v bar_empty "%${empty}s" "" bar_empty="${bar_empty// /-}"
printf "\r[%s%s] %d/%d (%3d%%)" "$bar_fill" "$bar_empty" "$done" "$total" "$percent"}
extract_one() { local tar_file="$1" local rel stem out_dir
rel="${tar_file#"$SRC_DIR"/}" if [[ "$rel" == "$tar_file" ]]; then rel="$(basename "$tar_file")" fi
stem="$(strip_archive_ext "$rel")" out_dir="$DST_DIR/$stem"
mkdir -p "$out_dir" tar -xf "$tar_file" -C "$out_dir" printf '%s\n' "$tar_file"}
export SRC_DIR DST_DIRexport -f strip_archive_ext extract_one
mapfile -d '' TAR_FILES < <( find "$SRC_DIR" -type f \ \( -name '*.tar' -o -name '*.tar.gz' -o -name '*.tgz' -o -name '*.tar.xz' -o -name '*.txz' -o -name '*.tar.bz2' -o -name '*.tbz2' -o -name '*.tar.zst' -o -name '*.tzst' \) \ -print0 | sort -z)
TOTAL="${#TAR_FILES[@]}"if (( TOTAL == 0 )); then echo "No tar archives found in: $SRC_DIR" exit 0fi
echo "Source: $SRC_DIR"echo "Target: $DST_DIR"echo "Archives: $TOTAL"echo "Jobs: $JOBS"
start_ts="$(date +%s)"done_count=0render_progress 0 "$TOTAL"
printf '%s\0' "${TAR_FILES[@]}" \ | xargs -0 -n1 -P "$JOBS" bash -c 'extract_one "$1"' _ \ | while IFS= read -r _; do done_count=$((done_count + 1)) render_progress "$done_count" "$TOTAL" done
echoend_ts="$(date +%s)"elapsed="$((end_ts - start_ts))"echo "Done in ${elapsed}s."123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279#!/usr/bin/env bashset -euo pipefail
usage() { echo "Usage: bash $0 TARGET_DIR [JOBS]" >&2 exit 2}
die() { echo "fast_rm: $*" >&2 exit 2}
format_bytes() { awk -v bytes="${1:-0}" 'BEGIN { split("B KiB MiB GiB TiB PiB", units, " ") value = bytes + 0 unit = 1 while (value >= 1024 && unit < 6) { value /= 1024 unit++ } if (unit == 1) { printf "%.0f %s", value, units[unit] } else { printf "%.2f %s", value, units[unit] } }'}
fs_avail_bytes() { df -B1 --output=avail "$1" 2>/dev/null | awk 'NR==2 {print $1}'}
progress_bar() { local freed=$1 local total=$2 local items=$3 local final=${4:-0} local now elapsed percent filled empty bar rate capped local width=30
now=$(date +%s) elapsed=$((now - start_ts)) [ "$elapsed" -gt 0 ] || elapsed=1 [ "$freed" -ge 0 ] || freed=0 rate=$(awk -v b="$freed" -v s="$elapsed" 'BEGIN { if (s <= 0) s = 1; printf "%.0f", b / s }')
if [ "$total" -gt 0 ]; then capped=$freed [ "$capped" -le "$total" ] || capped=$total percent=$((capped * 100 / total)) [ "$percent" -le 100 ] || percent=100 else percent=0 fi
if [ "$total" -gt 0 ]; then filled=$((percent * width / 100)) empty=$((width - filled)) bar=$(printf '%*s' "$filled" '' | tr ' ' '#') bar=$bar$(printf '%*s' "$empty" '' | tr ' ' '-') printf '\rfast_rm: [%s] %3d%% freed %s/%s rate %s/s items %d' \ "$bar" "$percent" "$(format_bytes "$freed")" "$(format_bytes "$total")" "$(format_bytes "$rate")" "$items" >&2 else printf '\rfast_rm: freed %s rate %s/s items %d' \ "$(format_bytes "$freed")" "$(format_bytes "$rate")" "$items" >&2 fi
if [ "$final" = 1 ]; then printf '\n' >&2 fi}
monitor_progress() { local total=$1 local watch_path=$2 local start_avail=$3 local current_avail=0 local freed=0 local max_freed=0 local items=0 local last_render=0 local now msg
while true; do if IFS= read -r -t "$progress_interval" msg; then [ "$msg" != "__FAST_RM_DONE__" ] || break items=$((items + 1)) fi
current_avail=$(fs_avail_bytes "$watch_path") case "$current_avail" in ''|*[!0-9]*) current_avail=$start_avail ;; esac freed=$((current_avail - start_avail)) [ "$freed" -ge 0 ] || freed=0 if [ "$freed" -gt "$max_freed" ]; then max_freed=$freed fi
now=$(date +%s) if [ $((now - last_render)) -ge "$progress_interval" ]; then progress_bar "$max_freed" "$total" "$items" 0 last_render=$now fi done
current_avail=$(fs_avail_bytes "$watch_path") case "$current_avail" in ''|*[!0-9]*) current_avail=$start_avail ;; esac freed=$((current_avail - start_avail)) [ "$freed" -ge 0 ] || freed=0 if [ "$freed" -gt "$max_freed" ]; then max_freed=$freed fi progress_bar "$max_freed" "$total" "$items" 1}
delete_stage() { local min_depth=$1 local max_depth=$2
if [ "$progress" = 1 ]; then find "$trash" -mindepth "$min_depth" -maxdepth "$max_depth" -print0 \ | FAST_RM_PROGRESS_FIFO=$progress_fifo xargs -0 -r -n 1 -P "$jobs" bash -c ' set -e for path do rm -rf -- "$path" printf "1\n" > "$FAST_RM_PROGRESS_FIFO" || true done ' _ else find "$trash" -mindepth "$min_depth" -maxdepth "$max_depth" -print0 \ | xargs -0 -r -n 1 -P "$jobs" rm -rf -- fi}
[ "$#" -ge 1 ] && [ "$#" -le 2 ] || usage
target=$1jobs=${2:-${FAST_RM_JOBS:-$(nproc 2>/dev/null || echo 32)}}shard_depth=${FAST_RM_SHARD_DEPTH:-3}progress=${FAST_RM_PROGRESS:-1}progress_interval=${FAST_RM_PROGRESS_INTERVAL:-1}exact_total=${FAST_RM_EXACT_TOTAL:-0}
case "$jobs" in ''|*[!0-9]*) die "JOBS must be a positive integer" ;;esaccase "$shard_depth" in ''|*[!0-9]*) die "FAST_RM_SHARD_DEPTH must be a positive integer" ;;esaccase "$progress" in 0|1) ;; *) die "FAST_RM_PROGRESS must be 0 or 1" ;;esaccase "$exact_total" in 0|1) ;; *) die "FAST_RM_EXACT_TOTAL must be 0 or 1" ;;esaccase "$progress_interval" in ''|*[!0-9]*) die "FAST_RM_PROGRESS_INTERVAL must be a positive integer" ;;esac
[ "$jobs" -gt 0 ] || die "JOBS must be > 0"[ "$shard_depth" -gt 0 ] || die "FAST_RM_SHARD_DEPTH must be > 0"[ "$progress_interval" -gt 0 ] || die "FAST_RM_PROGRESS_INTERVAL must be > 0"
while [ "$target" != "/" ] && [ "${target%/}" != "$target" ]; do target=${target%/}done
[ -n "$target" ] || die "empty target"[ "$target" != "/" ] || die "refuse to delete /"
parent=$(dirname -- "$target")base=$(basename -- "$target")[ "$base" != "." ] && [ "$base" != ".." ] || die "bad target: $target"
parent_abs=$(realpath -- "$parent")target_abs=$parent_abs/$base
if [ ! -e "$target_abs" ] && [ ! -L "$target_abs" ]; then echo "fast_rm: not found: $target_abs" exit 0fi
home_abs=$(realpath -- "${HOME:-/nonexistent}" 2>/dev/null || true)case "$target_abs" in "/"|"/cpfs01"|"/cpfs01/users"|"/cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/yetinghong"|"/mnt"|"/mnt/workspace") die "refuse to delete protected path: $target_abs" ;;esac[ -z "$home_abs" ] || [ "$target_abs" != "$home_abs" ] || die "refuse to delete HOME: $target_abs"
mount_point=$(findmnt -T "$target_abs" -n -o TARGET 2>/dev/null || true)[ -z "$mount_point" ] || [ "$mount_point" != "$target_abs" ] || die "refuse to delete mount point: $target_abs"
cwd=$(pwd -P)case "$cwd/" in "$target_abs"/*|"$target_abs/"*) die "refuse to delete current working tree: $target_abs" ;;esac
if [ ! -d "$target_abs" ] || [ -L "$target_abs" ]; then rm -f -- "$target_abs" exit 0fi
progress_fifo=progress_pid=progress_keepalive_fd=cleanup_progress() { if [ -n "$progress_pid" ]; then kill "$progress_pid" 2>/dev/null || true fi if [ -n "$progress_keepalive_fd" ]; then exec {progress_keepalive_fd}>&- 2>/dev/null || true fi if [ -n "$progress_fifo" ]; then rm -f -- "$progress_fifo" fi}trap cleanup_progress EXIT
safe_base=$(printf '%s' "$base" | tr -c 'A-Za-z0-9._-' '_')if [[ "$base" == .deleting_* ]]; then trash=$target_abselse trash=$parent_abs/.deleting_${safe_base}.$(date +%Y%m%d_%H%M%S).$$ mv -- "$target_abs" "$trash"fi
echo "fast_rm: deleting $trash with jobs=$jobs shard_depth=$shard_depth"
if [ "$progress" = 1 ]; then total_bytes=0 if [ "$exact_total" = 1 ]; then echo "fast_rm: exact sizing target..." >&2 total_bytes=$(du -sB1 -- "$trash" 2>/dev/null | awk 'NR==1 {print $1}') case "$total_bytes" in ''|*[!0-9]*) total_bytes=0 ;; esac echo "fast_rm: total $(format_bytes "$total_bytes")" >&2 else echo "fast_rm: skip exact sizing; showing freed space estimate" >&2 fi start_avail=$(fs_avail_bytes "$parent_abs") case "$start_avail" in ''|*[!0-9]*) start_avail=0 ;; esac progress_fifo=$(mktemp -u "${TMPDIR:-/tmp}/fast_rm_progress.XXXXXX") mkfifo "$progress_fifo" start_ts=$(date +%s) monitor_progress "$total_bytes" "$parent_abs" "$start_avail" < "$progress_fifo" & progress_pid=$! exec {progress_keepalive_fd}>"$progress_fifo"fi
if [ "$shard_depth" -gt 1 ]; then delete_stage "$shard_depth" "$shard_depth"fi
delete_stage 1 1
rmdir -- "$trash" 2>/dev/null || rm -rf -- "$trash"
if [ "$progress" = 1 ]; then printf '%s\n' "__FAST_RM_DONE__" >&$progress_keepalive_fd || true wait "$progress_pid" 2>/dev/null || true progress_pid= exec {progress_keepalive_fd}>&- 2>/dev/null || true progress_keepalive_fd= rm -f -- "$progress_fifo" progress_fifo=fi
echo "fast_rm: done"12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667# 用cp只有几m每秒,特别慢,但是用api就特别快# TODO: 封装成一个下载目录的脚本
# cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/packages/ossutil-2.2.0-linux-amd64# ./ossutil cp -r \# oss://cpfs-to-new-cpfs/VideoGen/user_data/buwendong/code/UniAnimate-DiT/wan/v11-20260202-204134/epoch=4-step=1600.ckpt \# /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/code/UniAnimate-DiT/wan/v11-20260202-204134 \# --parallel 32
# cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/packages/ossutil-2.2.0-linux-amd64# ./ossutil cp -r \# oss://cpfs-to-new-cpfs/VideoGen/user_data/buwendong/code/UniAnimate-DiT/wan/vae-20260123-085324/epoch=99-step=34000.ckpt \# /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/code/UniAnimate-DiT/wan/vae-20260123-085324 \# --parallel 32
# 这样下载好像有问题,会在文件末尾写入类似5.546607(s) elapsed的字符# cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/packages/ossutil-2.2.0-linux-amd64# ./ossutil api get-object \# --bucket cpfs-to-new-cpfs \# --key VideoGen/user_data/buwendong/code/UniAnimate-DiT/wan/v11-20260202-204134/epoch=4-step=1600.ckpt/output_dir/model-00013-of-00013.safetensors \# > /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/code/UniAnimate-DiT/wan/v11-20260202-204134/epoch=4-step=1600.ckpt/output_dir/model-00013-of-00013.safetensors
BUCKET="cpfs-to-new-cpfs"OSS_PREFIX="VideoGen/user_data/buwendong/code/UniAnimate-DiT/wan/v15-20260224-013149-step3500-ae/"LOCAL_DIR="/cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/code/UniAnimate-DiT/wan/v15-20260224-013149-step3500-ae/"
mkdir -p "$LOCAL_DIR"cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/packages/ossutil-2.2.0-linux-amd64
./ossutil -c .ossutilconfig ls "oss://$BUCKET/$OSS_PREFIX" | grep -o "oss://$BUCKET/.*" | grep -v "/$" | while read -r OSS_URI; do KEY="${OSS_URI#oss://$BUCKET/}" RELATIVE_PATH="${KEY#$OSS_PREFIX}" LOCAL_FILE="$LOCAL_DIR$RELATIVE_PATH" LOCAL_SUBDIR=$(dirname "$LOCAL_FILE") if [ ! -d "$LOCAL_SUBDIR" ]; then mkdir -p "$LOCAL_SUBDIR" fi echo "downloading: $RELATIVE_PATH" ./ossutil -c .ossutilconfig api get-object \ --bucket "$BUCKET" \ --key "$KEY" \ > "$LOCAL_FILE" if [ $? -eq 0 ]; then python3 -c "import sys, rewith open(sys.argv[1], 'r+b') as f: f.seek(0, 2) size = f.tell() if size == 0: sys.exit(0) chunk = min(4096, size) f.seek(-chunk, 2) tail = f.read() m = re.search(br'(?:\s*[0-9]+\.[0-9]+\(s\) elapsed\s*)+$', tail) if m: f.truncate(size - len(m.group(0)))" "$LOCAL_FILE" echo "成功 -> $RELATIVE_PATH" else echo "失败 -> $KEY" echo "失败 -> $RELATIVE_PATH" fidone123456789101112131415161718192021222324252627282930313233# cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/packages/ossutil-2.2.0-linux-amd64# ./ossutil cp -r \# /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/code/UniAnimate-DiT/v6x/ \# oss://cpfs-to-new-cpfs/VideoGen/user_data/buwendong/code/UniAnimate-DiT/wan
# cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/packages/ossutil-2.2.0-linux-amd64# ./ossutil cp -r \# /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/code/UniAnimate-DiT/2026011x/ \# oss://cpfs-to-new-cpfs/VideoGen/user_data/buwendong/code/UniAnimate-DiT/wan
# cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/packages/ossutil-2.2.0-linux-amd64# ./ossutil cp -r \# /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/code/UniAnimate-DiT/loading_oss/ \# oss://cpfs-to-new-cpfs/VideoGen/user_data/buwendong/code/UniAnimate-DiT/wan
cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/yetinghong/packages/ossutil-2.2.0-linux-amd64./ossutil -c .ossutilconfig \ cp -r \ /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/yetinghong/datasets/HumanML3D_token \ oss://cpfs-to-new-cpfs/VideoGen/user_data/yetinghong/datasets/HumanML3D_token
# cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/packages/ossutil-2.2.0-linux-amd64# ./ossutil cp -r \# /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/code/dance_2858_pose_embed_v2/ \# oss://cpfs-to-new-cpfs/VideoGen/user_data/buwendong/code/dance_2858_pose_embed_v2
# cd /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/packages/ossutil-2.2.0-linux-amd64# ./ossutil cp -r \# /cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/buwendong/user/code/UniAnimate-DiT/dance_1723_new/ \# oss://cpfs-to-new-cpfs/VideoGen/user_data/buwendong/code/UniAnimate-DiT/dance_1723_new
123456789101112131415161718192021222324252627282930313233343536373839404142import torch
# 1. 你的文件路径file_path = "/cpfs01/videogen/gvhmr_smpl/part_10/--9DvmkocUk_00010_44_171/hmr4d_results.pt"
# 2. 加载数据data = torch.load(file_path)
# 3. 指定要检查的四个 keykeys_to_check = ['smpl_params_global', 'smpl_params_incam', 'K_fullimg', 'net_outputs']
print(f"正在检查文件结构...")print("=" * 50)
# 4. 开始遍历检查for key in keys_to_check: if key not in data: print(f"❌ 找不到: {key}") continue val = data[key] # 情况 A:直接是张量 (例如 K_fullimg) if isinstance(val, torch.Tensor): print(f"✅ 【{key}】 (直接是张量) \n └── 形状: {val.shape}") # 情况 B:是嵌套字典 (例如 smpl_params_global, net_outputs) elif isinstance(val, dict): print(f"📦 【{key}】 (嵌套字典) 里面包含:") for sub_k, sub_v in val.items(): if isinstance(sub_v, torch.Tensor): print(f" ├── {sub_k}: {sub_v.shape}") elif isinstance(sub_v, dict): print(f" ├── {sub_k}: [又是一个字典] 包含 keys -> {list(sub_v.keys())}") else: print(f" ├── {sub_k}: [其他类型] {type(sub_v)}") # 情况 C:其他未知类型 else: print(f"❓ 【{key}】 (其他类型: {type(val)})") print("-" * 50)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143#!/usr/bin/env python3"""Repair cached confidence/reason fields in JSONL files in place."""
from __future__ import annotations
import argparseimport jsonimport sysfrom collections import Counterfrom pathlib import Pathfrom tempfile import NamedTemporaryFilefrom typing import Dict, Iterable, Iterator, List, Tuple
ROOT = Path(__file__).resolve().parent.parentif str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT))
from answer_utils import repair_confidence_reason_record_fields
def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser( description="Repair cache JSONL files by backfilling conf/reason from raw output." ) parser.add_argument( "paths", nargs="*", default=["cache/benchmarks"], help="Files or directories to scan. Defaults to cache/benchmarks.", ) parser.add_argument( "--dry-run", action="store_true", help="Scan and report changes without rewriting files.", ) parser.add_argument( "--verbose", action="store_true", help="Print per-file repair counts.", ) return parser.parse_args()
def iter_jsonl_files(paths: Iterable[str]) -> Iterator[Path]: seen = set() for raw_path in paths: path = Path(raw_path) if path.is_file() and path.suffix == ".jsonl": resolved = path.resolve() if resolved not in seen: seen.add(resolved) yield path continue if path.is_dir(): for item in sorted(path.rglob("*.jsonl")): resolved = item.resolve() if resolved in seen: continue seen.add(resolved) yield item
def changed_field_counts(before: Dict, after: Dict) -> Counter: counts: Counter = Counter() keys = set(before.keys()) | set(after.keys()) for key in keys: if before.get(key) == after.get(key): continue if key == "conf" or key.endswith("_conf"): counts["conf_fields"] += 1 elif key == "reason" or key.endswith("_reason"): counts["reason_fields"] += 1 else: counts["other_fields"] += 1 return counts
def repair_file(path: Path, dry_run: bool = False) -> Tuple[bool, Counter]: file_counts: Counter = Counter() repaired_lines: List[str] = []
with path.open("r", encoding="utf-8") as handle: for line_no, raw_line in enumerate(handle, start=1): stripped = raw_line.strip() if not stripped: repaired_lines.append(raw_line) continue try: record = json.loads(stripped) except json.JSONDecodeError as exc: raise ValueError(f"{path}:{line_no}: invalid json: {exc}") from exc
repaired = repair_confidence_reason_record_fields(record) if repaired != record: file_counts["records_changed"] += 1 file_counts.update(changed_field_counts(record, repaired)) repaired_lines.append(json.dumps(repaired, ensure_ascii=False) + "\n")
changed = bool(file_counts["records_changed"]) if changed and not dry_run: with NamedTemporaryFile("w", encoding="utf-8", dir=path.parent, delete=False) as tmp: tmp.writelines(repaired_lines) tmp_path = Path(tmp.name) tmp_path.replace(path)
return changed, file_counts
def main() -> int: args = parse_args() totals: Counter = Counter() files = list(iter_jsonl_files(args.paths))
if not files: print("No .jsonl files found.") return 0
for path in files: changed, file_counts = repair_file(path, dry_run=args.dry_run) totals["files_scanned"] += 1 if changed: totals["files_changed"] += 1 totals.update(file_counts) if args.verbose and changed: rel = path.as_posix() print( f"{rel}: records={file_counts['records_changed']} " f"conf={file_counts['conf_fields']} reason={file_counts['reason_fields']}" )
mode = "dry-run" if args.dry_run else "rewritten" print( f"[{mode}] files_scanned={totals['files_scanned']} " f"files_changed={totals['files_changed']} " f"records_changed={totals['records_changed']} " f"conf_fields={totals['conf_fields']} " f"reason_fields={totals['reason_fields']}" ) return 0
if __name__ == "__main__": raise SystemExit(main())123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269#!/usr/bin/env python3"""Repair math benchmark cache predictions/correct flags in place using current answer parsing."""
from __future__ import annotations
import argparseimport jsonimport sysfrom collections import Counter, defaultdictfrom pathlib import Pathfrom tempfile import NamedTemporaryFilefrom typing import Any, Dict, Iterable, Iterator, List, Tuple
PROJECT_ROOT = Path(__file__).resolve().parents[1]if str(PROJECT_ROOT) not in sys.path: sys.path.insert(0, str(PROJECT_ROOT))
from answer_utils import ( check_answer, extract_answer, extract_confidence_reason, repair_confidence_reason_record_fields,)
def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "--root", default="cache/benchmarks/math", help="Math benchmark cache root to repair. Default: cache/benchmarks/math", ) parser.add_argument( "--dry-run", action="store_true", help="Report intended changes without rewriting files.", ) parser.add_argument( "--verbose", action="store_true", help="Print per-file change counts.", ) return parser.parse_args()
def _safe_str(value: Any) -> str: if value is None: return "" return str(value).strip()
def _iter_stage_files(root: Path) -> Iterator[Path]: for path in sorted(root.rglob("*.stage*.cached.jsonl")): if path.is_file(): yield path
def _iter_only_files(root: Path) -> Iterator[Path]: for path in sorted(root.rglob("only/*/*.jsonl")): if path.is_file(): yield path
def _write_lines_atomic(path: Path, lines: List[str]) -> None: with NamedTemporaryFile("w", encoding="utf-8", dir=path.parent, delete=False) as tmp: tmp.writelines(lines) tmp_path = Path(tmp.name) tmp_path.replace(path)
def _repair_stage_record(record: Dict[str, Any], counts: Counter) -> Dict[str, Any]: updated = repair_confidence_reason_record_fields(record) task = _safe_str(updated.get("task")).lower() if task != "math": return updated
gold = updated.get("label") for stage_idx in (1, 2, 3): raw_key = f"stage{stage_idx}_raw" pred_key = f"stage{stage_idx}_pred" correct_key = f"stage{stage_idx}_correct" raw_text = _safe_str(updated.get(raw_key)) if raw_text: new_pred = _safe_str(extract_answer(task, raw_text)) if new_pred != _safe_str(updated.get(pred_key)): updated[pred_key] = new_pred counts[f"stage{stage_idx}_pred_changed"] += 1 new_correct = bool(check_answer(task, new_pred, gold)) if bool(updated.get(correct_key, False)) != new_correct: updated[correct_key] = new_correct counts[f"stage{stage_idx}_correct_changed"] += 1
if stage_idx >= 3: continue retry_raw_key = f"stage{stage_idx}_retry_raw" retry_pred_key = f"stage{stage_idx}_retry_pred" retry_correct_key = f"stage{stage_idx}_retry_correct" retry_raw = _safe_str(updated.get(retry_raw_key)) if retry_raw: new_retry_pred = _safe_str(extract_answer(task, retry_raw)) if new_retry_pred != _safe_str(updated.get(retry_pred_key)): updated[retry_pred_key] = new_retry_pred counts[f"stage{stage_idx}_retry_pred_changed"] += 1 new_retry_correct = bool(check_answer(task, new_retry_pred, gold)) if bool(updated.get(retry_correct_key, False)) != new_retry_correct: updated[retry_correct_key] = new_retry_correct counts[f"stage{stage_idx}_retry_correct_changed"] += 1 return updated
def repair_stage_file(path: Path, dry_run: bool = False) -> Counter: counts: Counter = Counter() out_lines: List[str] = [] changed = False
with path.open("r", encoding="utf-8") as handle: for raw_line in handle: stripped = raw_line.strip() if not stripped: out_lines.append(raw_line) continue record = json.loads(stripped) updated = _repair_stage_record(record, counts) if updated != record: changed = True counts["records_changed"] += 1 out_lines.append(json.dumps(updated, ensure_ascii=False) + "\n")
if changed and not dry_run: _write_lines_atomic(path, out_lines) if changed: counts["files_changed"] += 1 counts["files_scanned"] += 1 return counts
def _only_report_for_rows(path: Path, rows: List[Dict[str, Any]]) -> Dict[str, Any]: total = len(rows) correct = sum(int(bool(row.get("correct", False))) for row in rows) report_path = path.with_suffix(".report.json") existing = json.loads(report_path.read_text(encoding="utf-8")) if report_path.exists() else {} report = dict(existing) report.update( { "path": str(path), "split": path.stem, "total": total, "correct": correct, "accuracy": (correct / total) if total else 0.0, } ) by_task = defaultdict(lambda: {"total": 0, "correct": 0}) for row in rows: task = _safe_str(row.get("task")) by_task[task]["total"] += 1 by_task[task]["correct"] += int(bool(row.get("correct", False))) if existing.get("by_task"): merged = {} for task_name, stats in dict(existing["by_task"]).items(): merged[task_name] = dict(stats) for task_name, stats in by_task.items(): merged.setdefault(task_name, {}) merged[task_name]["total"] = stats["total"] merged[task_name]["correct"] = stats["correct"] report["by_task"] = merged else: report["by_task"] = dict(by_task) return report
def _repair_only_record(record: Dict[str, Any], counts: Counter) -> Dict[str, Any]: updated = repair_confidence_reason_record_fields(record) task = _safe_str(updated.get("task")).lower() if task != "math": return updated
raw_text = _safe_str(updated.get("raw")) if raw_text: new_pred = _safe_str(extract_answer(task, raw_text)) if new_pred != _safe_str(updated.get("pred")): updated["pred"] = new_pred counts["pred_changed"] += 1 conf, reason = extract_confidence_reason(raw_text) if float(updated.get("conf", 0.0) or 0.0) != float(conf): updated["conf"] = float(conf) counts["conf_changed"] += 1 if _safe_str(updated.get("reason")) != _safe_str(reason): updated["reason"] = _safe_str(reason) counts["reason_changed"] += 1 new_correct = bool(check_answer(task, new_pred, updated.get("label"))) if bool(updated.get("correct", False)) != new_correct: updated["correct"] = new_correct counts["correct_changed"] += 1 return updated
def repair_only_file(path: Path, dry_run: bool = False) -> Counter: counts: Counter = Counter() out_lines: List[str] = [] changed = False rows: List[Dict[str, Any]] = []
with path.open("r", encoding="utf-8") as handle: for raw_line in handle: stripped = raw_line.strip() if not stripped: out_lines.append(raw_line) continue record = json.loads(stripped) updated = _repair_only_record(record, counts) rows.append(updated) if updated != record: changed = True counts["records_changed"] += 1 out_lines.append(json.dumps(updated, ensure_ascii=False) + "\n")
report = _only_report_for_rows(path, rows) report_path = path.with_suffix(".report.json") old_report = json.loads(report_path.read_text(encoding="utf-8")) if report_path.exists() else None report_changed = old_report != report
if (changed or report_changed) and not dry_run: if changed: _write_lines_atomic(path, out_lines) report_path.write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8")
if changed: counts["files_changed"] += 1 if report_changed: counts["reports_changed"] += 1 counts["files_scanned"] += 1 return counts
def main() -> int: args = parse_args() root = Path(args.root) if not root.exists(): raise FileNotFoundError(f"Root does not exist: {root}")
totals: Counter = Counter()
for path in _iter_stage_files(root): file_counts = repair_stage_file(path, dry_run=args.dry_run) totals.update(file_counts) if args.verbose and (file_counts["records_changed"] or file_counts["files_changed"]): print(f"{path}: stage_records_changed={file_counts['records_changed']}")
for path in _iter_only_files(root): file_counts = repair_only_file(path, dry_run=args.dry_run) totals.update(file_counts) if args.verbose and (file_counts["records_changed"] or file_counts["reports_changed"]): print( f"{path}: only_records_changed={file_counts['records_changed']} " f"reports_changed={file_counts['reports_changed']}" )
mode = "dry-run" if args.dry_run else "rewritten" print( f"[{mode}] files_scanned={totals['files_scanned']} files_changed={totals['files_changed']} " f"reports_changed={totals['reports_changed']} records_changed={totals['records_changed']}" ) for key in sorted(k for k in totals if k not in {"files_scanned", "files_changed", "reports_changed", "records_changed"}): print(f"{key}={totals[key]}") return 0
if __name__ == "__main__": raise SystemExit(main())123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622#!/usr/bin/env python3"""Report per-stage cascade/only cost and accuracy statistics from benchmark caches."""
from __future__ import annotations
import argparseimport jsonimport osimport sysfrom pathlib import Pathfrom typing import Dict, Iterable, List, Optional, Sequence, Tuple
PROJECT_ROOT = Path(__file__).resolve().parents[1]if str(PROJECT_ROOT) not in sys.path: sys.path.insert(0, str(PROJECT_ROOT))
from transformers import AutoTokenizer
from answer_utils import check_answer, repair_confidence_reason_record_fields, task_instructionfrom cascade_utils import ( build_router_prompt_for_cost, count_tokens, iter_stage_indices, render_chat, safe_str, stage_correct_key, stage_output_exists, stage_pred_key, stage_raw_key, stage_retry_correct_key, stage_retry_output_exists, stage_retry_pred_key, stage_retry_raw_key,)from config import MODEL_GROUPS, SYSTEM_MESSAGE_DEFAULT
def _read_jsonl(path: Path) -> List[Dict]: rows: List[Dict] = [] with path.open("r", encoding="utf-8") as handle: for line in handle: line = line.strip() if line: rows.append(repair_confidence_reason_record_fields(json.loads(line))) return rows
def _price_per_token(price_per_million: float) -> float: return float(price_per_million) / 1_000_000.0
def _parse_tokenizer_overrides(values: Sequence[str]) -> Dict[Tuple[str, str], str]: overrides: Dict[Tuple[str, str], str] = {} for value in values: raw = safe_str(value) if not raw: continue if "=" not in raw or ":" not in raw.split("=", 1)[0]: raise ValueError( f"Invalid --tokenizer-source {value!r}. Expected format: <group>:<stage>=<source>" ) key_part, source = raw.split("=", 1) group, stage = key_part.split(":", 1) group = safe_str(group).lower() stage = safe_str(stage).lower() source = safe_str(source) if not group or not stage or not source: raise ValueError( f"Invalid --tokenizer-source {value!r}. Expected format: <group>:<stage>=<source>" ) overrides[(group, stage)] = source return overrides
def _resolve_tokenizer_source( stage_cfg: Dict, group: str, stage_name: str, overrides: Dict[Tuple[str, str], str],) -> Tuple[str, bool]: override = overrides.get((group, stage_name.lower())) if override: return override, os.path.isdir(override)
candidates = [ safe_str(stage_cfg.get("tokenizer_path")), safe_str(stage_cfg.get("model_path")), safe_str(stage_cfg.get("model_name")), ] for candidate in candidates: if candidate and os.path.isdir(candidate): return candidate, True for candidate in candidates: if candidate and not os.path.isabs(candidate) and ("/" in candidate or Path(candidate).exists()): return candidate, False
raise FileNotFoundError( "No usable tokenizer source found for " f"group={group} stage={stage_name}. " f"Checked candidates={candidates}. " "Pass --tokenizer-source <group>:<stage>=<source> to override." )
def _load_tokenizer( stage_cfg: Dict, group: str, stage_name: str, overrides: Dict[Tuple[str, str], str],): source, local_files_only = _resolve_tokenizer_source(stage_cfg, group, stage_name, overrides) tokenizer = AutoTokenizer.from_pretrained( source, trust_remote_code=True, local_files_only=local_files_only, use_fast=False, ) tokenizer.padding_side = "left" if tokenizer.pad_token is None and tokenizer.eos_token is not None: tokenizer.pad_token = tokenizer.eos_token return tokenizer
def _compute_stage_cost(sample: Dict, stage_cfg: Dict, stage_index: int, tokenizer, retry: bool = False) -> float: task_name = safe_str(sample.get("task")) question = safe_str(sample.get("headline")) rendered = render_chat( tokenizer, safe_str(stage_cfg.get("system_message")) or SYSTEM_MESSAGE_DEFAULT, build_router_prompt_for_cost(question, task_name, stage_index, sample, retry=retry), ) if retry: raw_text = safe_str(sample.get(stage_retry_raw_key(stage_index))) or safe_str(sample.get(stage_retry_pred_key(stage_index))) else: raw_text = safe_str(sample.get(stage_raw_key(stage_index))) or safe_str(sample.get(stage_pred_key(stage_index))) input_unit = _price_per_token(float(stage_cfg["input_cost_per_mtoken"])) output_unit = _price_per_token(float(stage_cfg["output_cost_per_mtoken"])) return count_tokens(tokenizer, rendered) * input_unit + count_tokens(tokenizer, raw_text) * output_unit
def _build_only_prompt(question: str, task_name: str) -> str: return f"{task_instruction(task_name)}\n\nQuestion:\n{question}\n"
def _compute_only_cost(sample: Dict, stage_cfg: Dict, tokenizer) -> float: task_name = safe_str(sample.get("task")) question = safe_str(sample.get("headline")) raw_text = safe_str(sample.get("raw")) or safe_str(sample.get("pred")) rendered = render_chat( tokenizer, safe_str(stage_cfg.get("system_message")) or SYSTEM_MESSAGE_DEFAULT, _build_only_prompt(question, task_name), ) input_unit = _price_per_token(float(stage_cfg["input_cost_per_mtoken"])) output_unit = _price_per_token(float(stage_cfg["output_cost_per_mtoken"])) return count_tokens(tokenizer, rendered) * input_unit + count_tokens(tokenizer, raw_text) * output_unit
def _empty_stats(applicable: bool = True) -> Dict[str, Optional[float]]: return { "applicable": bool(applicable), "samples": 0, "correct": 0, "accuracy": None, "total_cost": 0.0, "avg_cost": None, }
def _finalize_stats(stats: Dict[str, Optional[float]]) -> Dict[str, Optional[float]]: samples = int(stats["samples"]) if not samples: stats["accuracy"] = None stats["avg_cost"] = None return stats stats["accuracy"] = float(stats["correct"]) / samples stats["avg_cost"] = float(stats["total_cost"]) / samples return stats
def _stage_slot_name(stage_index: int) -> str: return f"stage{stage_index + 1}"
def _init_stage_summary() -> Dict[str, Dict[str, Dict[str, Optional[float]]]]: summary: Dict[str, Dict[str, Dict[str, Optional[float]]]] = {} for stage_index in iter_stage_indices(): stage_name = _stage_slot_name(stage_index) summary[stage_name] = { "first": _empty_stats(applicable=True), "rerun": _empty_stats(applicable=(stage_index < 2)), } return summary
def _merge_stats(dst: Dict[str, Optional[float]], src: Dict[str, Optional[float]]) -> None: dst["samples"] = int(dst["samples"]) + int(src["samples"]) dst["correct"] = int(dst["correct"]) + int(src["correct"]) dst["total_cost"] = float(dst["total_cost"]) + float(src["total_cost"])
def _iter_cascade_targets( root: Path, benchmarks: Sequence[str], groups: Sequence[str], splits: Sequence[str],) -> Iterable[Tuple[str, str, str, Path]]: for benchmark in benchmarks: for group in groups: for split in splits: path = root / benchmark / group / f"{split}.stage3.cached.jsonl" if path.exists(): yield benchmark, group, split, path
def _iter_only_targets( root: Path, benchmarks: Sequence[str], splits: Sequence[str],) -> Iterable[Tuple[str, str, str, Path]]: for benchmark in benchmarks: only_dir = root / benchmark / "only" if not only_dir.exists(): continue for model_dir in sorted(path for path in only_dir.iterdir() if path.is_dir()): for split in splits: path = model_dir / f"{split}.jsonl" if path.exists(): yield benchmark, model_dir.name, split, path
def _build_cascade_rows( root: Path, benchmarks: Sequence[str], groups: Sequence[str], splits: Sequence[str], tokenizer_overrides: Dict[Tuple[str, str], str], recompute_costs: bool,) -> List[Dict]: tokenizer_cache: Dict[Tuple[str, str], object] = {} rows: List[Dict] = [] aggregate: Dict[Tuple[str, str], Dict] = {}
for benchmark, group, split, path in _iter_cascade_targets(root, benchmarks, groups, splits): stage_cfgs = MODEL_GROUPS[group]["stages"] samples = _read_jsonl(path) if not samples: continue
stage_summary = _init_stage_summary() for sample in samples: for stage_index in iter_stage_indices(): stage_name = _stage_slot_name(stage_index) if stage_output_exists(sample, stage_index): stats = stage_summary[stage_name]["first"] stats["samples"] = int(stats["samples"]) + 1 stats["correct"] = int(stats["correct"]) + int(bool(sample.get(stage_correct_key(stage_index), False))) cost_key = f"{stage_name}_cost" if not recompute_costs and cost_key in sample: cost_value = float(sample.get(cost_key, 0.0)) else: tok_key = (group, stage_name) if tok_key not in tokenizer_cache: tokenizer_cache[tok_key] = _load_tokenizer(stage_cfgs[stage_index], group, stage_name, tokenizer_overrides) cost_value = _compute_stage_cost( sample, stage_cfgs[stage_index], stage_index, tokenizer_cache[tok_key], retry=False ) stats["total_cost"] = float(stats["total_cost"]) + cost_value
if stage_index < 2 and stage_retry_output_exists(sample, stage_index): stats = stage_summary[stage_name]["rerun"] stats["samples"] = int(stats["samples"]) + 1 stats["correct"] = int(stats["correct"]) + int(bool(sample.get(stage_retry_correct_key(stage_index), False))) retry_cost_key = f"{stage_name}_retry_cost" if not recompute_costs and retry_cost_key in sample: cost_value = float(sample.get(retry_cost_key, 0.0)) else: tok_key = (group, stage_name) if tok_key not in tokenizer_cache: tokenizer_cache[tok_key] = _load_tokenizer(stage_cfgs[stage_index], group, stage_name, tokenizer_overrides) cost_value = _compute_stage_cost( sample, stage_cfgs[stage_index], stage_index, tokenizer_cache[tok_key], retry=True ) stats["total_cost"] = float(stats["total_cost"]) + cost_value
for stage_name, slot_map in stage_summary.items(): for attempt_name, stats in slot_map.items(): _finalize_stats(stats)
row = { "kind": "cascade", "benchmark": benchmark, "group": group, "split": split, "samples": len(samples), "combo": safe_str(MODEL_GROUPS[group].get("display_name")) or group, "stage_models": { _stage_slot_name(idx): safe_str(stage_cfgs[idx].get("cache_id") or stage_cfgs[idx].get("model_name")) for idx in iter_stage_indices() }, "stages": stage_summary, } rows.append(row)
agg_key = (benchmark, group) bucket = aggregate.setdefault( agg_key, { "samples": 0, "stage_models": row["stage_models"], "combo": row["combo"], "stages": _init_stage_summary(), }, ) bucket["samples"] += len(samples) for stage_name, slot_map in stage_summary.items(): for attempt_name, stats in slot_map.items(): _merge_stats(bucket["stages"][stage_name][attempt_name], stats)
final_rows: List[Dict] = [] for benchmark, group in sorted(aggregate): bucket = aggregate[(benchmark, group)] for stage_name, slot_map in bucket["stages"].items(): for attempt_name, stats in slot_map.items(): _finalize_stats(stats) final_rows.append( { "kind": "cascade", "benchmark": benchmark, "group": group, "split": "all", "samples": bucket["samples"], "combo": bucket["combo"], "stage_models": bucket["stage_models"], "stages": bucket["stages"], } )
rows.sort(key=lambda item: (item["benchmark"], item["group"], item["split"])) final_rows.extend(rows) return final_rows
def _load_only_report(path: Path) -> Optional[Dict]: report_path = path.with_suffix(".report.json") if not report_path.exists(): return None return json.loads(report_path.read_text(encoding="utf-8"))
def _resolve_only_model_specs() -> Dict[str, Tuple[str, str, Dict]]: specs: Dict[str, Tuple[str, str, Dict]] = {} for group, group_cfg in MODEL_GROUPS.items(): for stage_index, stage_cfg in enumerate(group_cfg["stages"]): model_id = safe_str(stage_cfg.get("cache_id")) if not model_id: continue stage_name = _stage_slot_name(stage_index) model_key = model_id.lower() existing = specs.get(model_key) if existing is None: specs[model_key] = (group, stage_name, dict(stage_cfg)) continue existing_group, existing_stage_name, existing_cfg = existing comparable_keys = ( "tokenizer_path", "model_path", "model_name", "input_cost_per_mtoken", "output_cost_per_mtoken", "system_message", ) if any(safe_str(existing_cfg.get(key)) != safe_str(stage_cfg.get(key)) for key in comparable_keys): raise ValueError( f"Conflicting only model config for {model_id}: " f"{existing_group}/{existing_stage_name} vs {group}/{stage_name}" ) return specs
def _build_only_rows( root: Path, benchmarks: Sequence[str], splits: Sequence[str], tokenizer_overrides: Dict[Tuple[str, str], str],) -> List[Dict]: model_specs = _resolve_only_model_specs() tokenizer_cache: Dict[Tuple[str, str], object] = {} rows: List[Dict] = [] aggregate: Dict[Tuple[str, str], Dict[str, float]] = {}
for benchmark, model_id, split, path in _iter_only_targets(root, benchmarks, splits): samples = _read_jsonl(path) if not samples: continue
model_key = model_id.lower() if model_key not in model_specs: raise KeyError(f"Missing current config for only model: {model_id}") group, stage_name, stage_cfg = model_specs[model_key] tok_key = (group, stage_name) if tok_key not in tokenizer_cache: tokenizer_cache[tok_key] = _load_tokenizer(stage_cfg, group, stage_name, tokenizer_overrides)
total = len(samples) correct = 0 total_cost = 0.0 for sample in samples: pred = safe_str(sample.get("pred")) gold = sample.get("label") task_name = safe_str(sample.get("task")) correct += int(check_answer(task_name, pred, gold)) total_cost += _compute_only_cost(sample, stage_cfg, tokenizer_cache[tok_key])
accuracy = (correct / total) if total > 0 else None avg_cost = (total_cost / total) if total > 0 else None model_name = safe_str(samples[0].get("model_name")) or safe_str(stage_cfg.get("model_name")) or model_id
row = { "kind": "only", "benchmark": benchmark, "group": "only", "split": split, "samples": total, "model_id": model_id, "model_name": model_name, "correct": correct, "accuracy": accuracy, "total_cost": total_cost, "avg_cost": avg_cost, } rows.append(row)
agg_key = (benchmark, model_id) bucket = aggregate.setdefault( agg_key, { "samples": 0, "correct": 0, "total_cost": 0.0, "model_name": model_name, }, ) bucket["samples"] += total bucket["correct"] += correct bucket["total_cost"] += total_cost
final_rows: List[Dict] = [] for benchmark, model_id in sorted(aggregate): bucket = aggregate[(benchmark, model_id)] samples = int(bucket["samples"]) accuracy = (int(bucket["correct"]) / samples) if samples > 0 else None avg_cost = (float(bucket["total_cost"]) / samples) if samples > 0 else None final_rows.append( { "kind": "only", "benchmark": benchmark, "group": "only", "split": "all", "samples": samples, "model_id": model_id, "model_name": bucket["model_name"], "correct": int(bucket["correct"]), "accuracy": accuracy, "total_cost": float(bucket["total_cost"]), "avg_cost": avg_cost, } )
rows.sort(key=lambda item: (item["benchmark"], item["model_id"], item["split"])) final_rows.extend(rows) return final_rows
def _print_cascade_table(rows: Sequence[Dict]) -> None: headers = [ "benchmark", "group", "split", "samples", "s1_first_acc", "s1_rerun_acc", "s2_first_acc", "s2_rerun_acc", "s3_first_acc", "s3_rerun_acc", "s1_first_cost", "s1_rerun_cost", "s2_first_cost", "s2_rerun_cost", "s3_first_cost", "s3_rerun_cost", ] str_rows: List[Dict[str, str]] = [] for row in rows: if row.get("kind") != "cascade": continue stages = row["stages"] str_rows.append( { "benchmark": str(row["benchmark"]), "group": str(row["group"]), "split": str(row["split"]), "samples": str(row["samples"]), "s1_first_acc": _fmt(stages["stage1"]["first"]["accuracy"]), "s1_rerun_acc": _fmt(stages["stage1"]["rerun"]["accuracy"]), "s2_first_acc": _fmt(stages["stage2"]["first"]["accuracy"]), "s2_rerun_acc": _fmt(stages["stage2"]["rerun"]["accuracy"]), "s3_first_acc": _fmt(stages["stage3"]["first"]["accuracy"]), "s3_rerun_acc": _fmt(stages["stage3"]["rerun"]["accuracy"]), "s1_first_cost": _fmt(stages["stage1"]["first"]["avg_cost"]), "s1_rerun_cost": _fmt(stages["stage1"]["rerun"]["avg_cost"]), "s2_first_cost": _fmt(stages["stage2"]["first"]["avg_cost"]), "s2_rerun_cost": _fmt(stages["stage2"]["rerun"]["avg_cost"]), "s3_first_cost": _fmt(stages["stage3"]["first"]["avg_cost"]), "s3_rerun_cost": _fmt(stages["stage3"]["rerun"]["avg_cost"]), } ) if not str_rows: return widths = { header: max(len(header), *(len(item[header]) for item in str_rows)) if str_rows else len(header) for header in headers } print(" ".join(header.ljust(widths[header]) for header in headers)) print(" ".join("-" * widths[header] for header in headers)) for row in str_rows: print(" ".join(row[header].ljust(widths[header]) for header in headers))
def _print_only_table(rows: Sequence[Dict]) -> None: headers = ["benchmark", "model_id", "split", "samples", "accuracy", "avg_cost"] str_rows: List[Dict[str, str]] = [] for row in rows: if row.get("kind") != "only": continue str_rows.append( { "benchmark": str(row["benchmark"]), "model_id": str(row["model_id"]), "split": str(row["split"]), "samples": str(row["samples"]), "accuracy": _fmt(row["accuracy"]), "avg_cost": _fmt(row["avg_cost"]), } ) if not str_rows: return print() widths = { header: max(len(header), *(len(item[header]) for item in str_rows)) if str_rows else len(header) for header in headers } print(" ".join(header.ljust(widths[header]) for header in headers)) print(" ".join("-" * widths[header] for header in headers)) for row in str_rows: print(" ".join(row[header].ljust(widths[header]) for header in headers))
def _fmt(value: Optional[float]) -> str: if value is None: return "-" return f"{float(value):.8f}"
def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--root", default="cache/benchmarks", help="Benchmark cache root directory.") parser.add_argument("--benchmarks", nargs="*", help="Benchmarks to include. Default: all under cache root.") parser.add_argument("--groups", nargs="*", choices=sorted(MODEL_GROUPS), help="Cascade model groups to include. Default: all.") parser.add_argument("--splits", nargs="*", default=["train", "test"], help="Splits to include. Default: train test.") parser.add_argument( "--tokenizer-source", action="append", default=[], help="Override tokenizer source. Format: <group>:<stage>=<source>, e.g. qwen:stage1=/path/to/tokenizer", ) parser.add_argument( "--recompute-costs", action="store_true", help="Ignore stored cost fields and recompute costs from tokenizer/pricing config.", ) parser.add_argument("--output-json", help="Optional path to write JSON results.") args = parser.parse_args()
root = Path(args.root) if not root.exists(): raise FileNotFoundError(f"Benchmark cache root does not exist: {root}")
benchmarks = list(args.benchmarks) if args.benchmarks else sorted( path.name for path in root.iterdir() if path.is_dir() and path.name != "only" ) groups = list(args.groups) if args.groups else sorted(MODEL_GROUPS) splits = [str(split).strip() for split in args.splits if str(split).strip()] tokenizer_overrides = _parse_tokenizer_overrides(args.tokenizer_source)
cascade_rows = _build_cascade_rows(root, benchmarks, groups, splits, tokenizer_overrides, args.recompute_costs) only_rows = _build_only_rows(root, benchmarks, splits, tokenizer_overrides) final_rows = cascade_rows + only_rows
_print_cascade_table(cascade_rows) _print_only_table(only_rows)
if args.output_json: output_path = Path(args.output_json) output_path.parent.mkdir(parents=True, exist_ok=True) payload = { "root": str(root), "benchmarks": benchmarks, "groups": groups, "splits": splits, "cascade_results": cascade_rows, "only_results": only_rows, "results": final_rows, } output_path.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8")
return 0
if __name__ == "__main__": raise SystemExit(main())123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327#!/usr/bin/env python3"""Report conditional correction rates for cascade upgrades versus only models."""
from __future__ import annotations
import argparseimport jsonimport sysfrom pathlib import Pathfrom typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple
PROJECT_ROOT = Path(__file__).resolve().parents[1]if str(PROJECT_ROOT) not in sys.path: sys.path.insert(0, str(PROJECT_ROOT))
from answer_utils import check_answerfrom config import MODEL_GROUPS
def _safe_str(value: Any) -> str: if value is None: return "" return str(value).strip()
def _read_jsonl(path: Path) -> List[Dict[str, Any]]: rows: List[Dict[str, Any]] = [] with path.open("r", encoding="utf-8") as handle: for line in handle: line = line.strip() if line: rows.append(json.loads(line)) return rows
def _cache_key(row: Dict[str, Any], fallback_index: int) -> int: raw_key = row.get("_cache_index") if raw_key is None: return int(fallback_index) return int(raw_key)
def _bool_correct(task: str, pred: Any, gold: Any) -> bool: return bool(check_answer(task, _safe_str(pred), gold))
def _stage_pred(row: Dict[str, Any], stage_index: int) -> str: return _safe_str(row.get(f"stage{stage_index + 1}_pred"))
def _stage_correct(row: Dict[str, Any], stage_index: int) -> bool: return _bool_correct(_safe_str(row.get("task")), _stage_pred(row, stage_index), row.get("label"))
def _only_pred(row: Dict[str, Any]) -> str: return _safe_str(row.get("pred"))
def _only_correct(row: Dict[str, Any]) -> bool: return _bool_correct(_safe_str(row.get("task")), _only_pred(row), row.get("label"))
def _iter_benchmarks(root: Path, requested: Optional[Sequence[str]]) -> List[str]: if requested: return [str(name).strip() for name in requested if str(name).strip()] return sorted(path.name for path in root.iterdir() if path.is_dir())
def _load_stage_rows(root: Path, benchmark: str, group: str, split: str) -> List[Dict[str, Any]]: path = root / benchmark / group / f"{split}.stage3.cached.jsonl" if not path.exists(): raise FileNotFoundError(path) return _read_jsonl(path)
def _load_only_rows(root: Path, benchmark: str, model_id: str, split: str) -> Dict[int, Dict[str, Any]]: path = root / benchmark / "only" / model_id.lower() / f"{split}.jsonl" if not path.exists(): raise FileNotFoundError(path) rows = _read_jsonl(path) indexed: Dict[int, Dict[str, Any]] = {} for fallback_index, row in enumerate(rows): indexed[_cache_key(row, fallback_index)] = row return indexed
def _make_bucket() -> Dict[str, Any]: return { "denominator": 0, "cascade_correct": 0, "only_correct": 0, "both_correct": 0, "cascade_only_correct": 0, "only_only_correct": 0, "both_wrong": 0, "missing_only": 0, "mismatched_examples": 0, }
def _finalize_bucket( benchmark: str, group: str, split: str, prev_stage_index: int, next_stage_index: int, prev_model_id: str, next_model_id: str, only_model_id: str, bucket: Dict[str, Any],) -> Dict[str, Any]: denom = int(bucket["denominator"]) cascade_rate = (int(bucket["cascade_correct"]) / denom) if denom else None only_rate = (int(bucket["only_correct"]) / denom) if denom else None delta = (cascade_rate - only_rate) if (cascade_rate is not None and only_rate is not None) else None return { "benchmark": benchmark, "group": group, "split": split, "transition": f"stage{prev_stage_index + 1}_wrong_to_stage{next_stage_index + 1}_correct", "prev_stage": f"stage{prev_stage_index + 1}", "next_stage": f"stage{next_stage_index + 1}", "prev_model_id": prev_model_id, "next_model_id": next_model_id, "only_model_id": only_model_id, "denominator": denom, "cascade_correct": int(bucket["cascade_correct"]), "cascade_rate": cascade_rate, "only_correct": int(bucket["only_correct"]), "only_rate": only_rate, "delta_cascade_minus_only": delta, "both_correct": int(bucket["both_correct"]), "cascade_only_correct": int(bucket["cascade_only_correct"]), "only_only_correct": int(bucket["only_only_correct"]), "both_wrong": int(bucket["both_wrong"]), "missing_only": int(bucket["missing_only"]), "mismatched_examples": int(bucket["mismatched_examples"]), }
def _analyze_transition( benchmark: str, group: str, split: str, stage_rows: List[Dict[str, Any]], only_rows: Dict[int, Dict[str, Any]], prev_stage_index: int, next_stage_index: int, prev_model_id: str, next_model_id: str, only_model_id: str,) -> Dict[str, Any]: bucket = _make_bucket() for fallback_index, row in enumerate(stage_rows): if _stage_correct(row, prev_stage_index): continue bucket["denominator"] += 1 cache_index = _cache_key(row, fallback_index) only_row = only_rows.get(cache_index) if only_row is None: bucket["missing_only"] += 1 continue
if ( _safe_str(only_row.get("headline")) != _safe_str(row.get("headline")) or _safe_str(only_row.get("label")) != _safe_str(row.get("label")) ): bucket["mismatched_examples"] += 1
cascade_ok = _stage_correct(row, next_stage_index) only_ok = _only_correct(only_row) bucket["cascade_correct"] += int(cascade_ok) bucket["only_correct"] += int(only_ok) if cascade_ok and only_ok: bucket["both_correct"] += 1 elif cascade_ok: bucket["cascade_only_correct"] += 1 elif only_ok: bucket["only_only_correct"] += 1 else: bucket["both_wrong"] += 1
return _finalize_bucket( benchmark=benchmark, group=group, split=split, prev_stage_index=prev_stage_index, next_stage_index=next_stage_index, prev_model_id=prev_model_id, next_model_id=next_model_id, only_model_id=only_model_id, bucket=bucket, )
def _iter_rows( root: Path, benchmarks: Sequence[str], groups: Sequence[str], splits: Sequence[str],) -> Iterable[Dict[str, Any]]: for benchmark in benchmarks: for group in groups: stage_cfgs = MODEL_GROUPS[group]["stages"] for split in splits: try: stage_rows = _load_stage_rows(root, benchmark, group, split) except FileNotFoundError: continue for prev_stage_index, next_stage_index in ((0, 1), (1, 2)): only_model_id = _safe_str(stage_cfgs[next_stage_index].get("cache_id")) if not only_model_id: continue try: only_rows = _load_only_rows(root, benchmark, only_model_id, split) except FileNotFoundError: continue yield _analyze_transition( benchmark=benchmark, group=group, split=split, stage_rows=stage_rows, only_rows=only_rows, prev_stage_index=prev_stage_index, next_stage_index=next_stage_index, prev_model_id=_safe_str(stage_cfgs[prev_stage_index].get("cache_id")), next_model_id=_safe_str(stage_cfgs[next_stage_index].get("cache_id")), only_model_id=only_model_id, )
def _fmt_rate(value: Optional[float]) -> str: if value is None: return "-" return f"{100.0 * float(value):.2f}%"
def _fmt_count_rate(count: int, denom: int) -> str: if not denom: return "0/0" return f"{int(count)}/{int(denom)} ({_fmt_rate(count / denom)})"
def _print_rows(rows: Sequence[Dict[str, Any]]) -> None: headers = [ "benchmark", "group", "split", "transition", "subset", "cascade", "only", "delta", "overlap", ] printable: List[Dict[str, str]] = [] for row in rows: denom = int(row["denominator"]) printable.append( { "benchmark": str(row["benchmark"]), "group": str(row["group"]), "split": str(row["split"]), "transition": f"{row['prev_model_id']} wrong -> {row['next_model_id']} correct", "subset": str(denom), "cascade": _fmt_count_rate(int(row["cascade_correct"]), denom), "only": _fmt_count_rate(int(row["only_correct"]), denom), "delta": _fmt_rate(row["delta_cascade_minus_only"]), "overlap": ( f"both={row['both_correct']} " f"c_only={row['cascade_only_correct']} " f"o_only={row['only_only_correct']} " f"none={row['both_wrong']}" ), } )
if not printable: return
widths = { header: max(len(header), *(len(item[header]) for item in printable)) for header in headers } print(" ".join(header.ljust(widths[header]) for header in headers)) print(" ".join(("-" * widths[header]) for header in headers)) for row in printable: print(" ".join(row[header].ljust(widths[header]) for header in headers))
def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--root", default="cache/benchmarks", help="Benchmark cache root.") parser.add_argument("--benchmarks", nargs="*", help="Benchmarks to include. Default: all.") parser.add_argument("--groups", nargs="*", choices=sorted(MODEL_GROUPS), help="Cascade groups to include. Default: all.") parser.add_argument("--splits", nargs="*", default=["test"], help="Splits to include. Default: test.") parser.add_argument("--output-json", help="Optional path to write JSON results.") args = parser.parse_args()
root = Path(args.root) if not root.exists(): raise FileNotFoundError(f"Benchmark cache root does not exist: {root}")
benchmarks = _iter_benchmarks(root, args.benchmarks) groups = list(args.groups) if args.groups else sorted(MODEL_GROUPS) splits = [str(split).strip() for split in args.splits if str(split).strip()] rows = list(_iter_rows(root, benchmarks, groups, splits)) rows.sort(key=lambda item: (item["benchmark"], item["group"], item["split"], item["prev_stage"], item["next_stage"]))
_print_rows(rows)
if args.output_json: output_path = Path(args.output_json) output_path.parent.mkdir(parents=True, exist_ok=True) payload = { "root": str(root), "benchmarks": benchmarks, "groups": groups, "splits": splits, "rows": rows, } output_path.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8") return 0
if __name__ == "__main__": raise SystemExit(main())1234567891011121314TENSORRT_ROOT=/cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/yetinghong/packages/TensorRT-10.13.0.35
grep -q 'export TensorRT_ROOT=/cpfs01/thscc/sharestorage/AIGC-06-01/Hithink_VideoGen_Group/user_workspace/yetinghong/packages/TensorRT-10.13.0.35' ~/.bashrc || cat >> ~/.bashrc <<EOF
# TensorRTexport TensorRT_ROOT=$TENSORRT_ROOTexport LD_LIBRARY_PATH=\$TensorRT_ROOT/lib:\${LD_LIBRARY_PATH}EOF
source ~/.bashrc
# 检查echo $TensorRT_ROOTecho $LD_LIBRARY_PATHbackfill_stage_cache_costs.pyAdded+80
drop_net_outputs.pyAdded+83
extract_gvhmr_tars.shAdded+144
fast_rm.shAdded+279
oss_download.shAdded+67
oss_upload.shAdded+33
read_pt.pyAdded+42
repair_cache_jsonl.pyAdded+143
repair_math_cache_answers.pyAdded+269
report_stage_costs.pyAdded+622
report_stage_recovery.pyAdded+327
tensorrt.shAdded+14