From 75016c48929e0635ecb619079c630b8167b9a348 Mon Sep 17 00:00:00 2001 From: iomgaa Date: Thu, 9 Jul 2026 22:53:28 -0400 Subject: [PATCH] =?UTF-8?q?feat(scripts):=20generate=5Fquestions.sh=20?= =?UTF-8?q?=E9=A2=98=E7=9B=AE=E7=94=9F=E6=88=90=E5=AE=9E=E9=AA=8C=E5=85=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/generate_questions.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/generate_questions.sh diff --git a/scripts/generate_questions.sh b/scripts/generate_questions.sh new file mode 100755 index 0000000..fa6212c --- /dev/null +++ b/scripts/generate_questions.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# 赛题生成实验 +# 职责:基于 300 棵视频树 + VLM 生成训练题目,写入 store/questions/generated/。 +# 用法: +# bash scripts/generate_questions.sh # 默认参数 +# PER_TYPE=5 bash scripts/generate_questions.sh # 每题型 5 道(smoke test) +# CONCURRENCY=4 bash scripts/generate_questions.sh # 低并发(省 API) +# SEED=42 bash scripts/generate_questions.sh # 指定随机种子 +set -euo pipefail + +cd "$(dirname "$0")/.." + +CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0}" +export CUDA_VISIBLE_DEVICES + +# Embedding 模型已缓存本地,跳过 HuggingFace Hub 在线检查 +export HF_HUB_OFFLINE=1 +export TRANSFORMERS_OFFLINE=1 + +# 加载环境变量(API key 等) +set -a +source .env +set +a + +PYTHON="$(conda run -n Video-Tree-TRM which python)" + +"${PYTHON}" tools/generate_questions.py generate \ + --store-dir store \ + --output-dir store/questions/generated \ + --per-type "${PER_TYPE:-20}" \ + --similarity-threshold "${SIM_THRESHOLD:-0.85}" \ + --max-retries "${MAX_RETRIES:-3}" \ + --concurrency "${CONCURRENCY:-8}" \ + --seed "${SEED:-2026}"