Files
Video-Tree-TRM5/scripts/generate_questions_v2.sh
T
iomgaa eecb86e27a feat(question_gen): add generate-v2 CLI subcommand and experiment script
- Add generate-v2 subparser with --config, --store-dir, --db-path,
  --seed, and --dry-run arguments to tools/generate_questions.py
- Implement _run_generate_v2 async handler: config loading, video
  discovery, DI client construction, TreeIndex loading, pipeline
  invocation, and result persistence
- Add scripts/generate_questions_v2.sh following build_trees.sh
  conventions (source .env, conda run python path, MODE=mock support)
- Update app/question_gen/__init__.py to export full v2 public API:
  run_pipeline_v2, PipelineConfig, PipelineResult, QuestionFamilySpec,
  ALL_FAMILIES, CandidateQuestion, generate_one_v2, GateReport, run_gates
- Add QuestionGenStore.load_progress() for pipeline resumption
- Add integration tests for CLI help and dry-run behavior
- Update test_question_gen_api to match expanded __all__

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-12 00:04:42 -04:00

46 lines
1.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# v2 出题管线实验脚本
# 职责:调用 generate-v2 子命令,基于家族特化 + 四门质量检查生成新题目。
#
# 用法:
# bash scripts/generate_questions_v2.sh # 全量生成
# MODE=mock bash scripts/generate_questions_v2.sh # smoke testmock LLM/VLM
# SEED=123 bash scripts/generate_questions_v2.sh # 指定种子
# CONFIG=config/custom.yaml bash scripts/generate_questions_v2.sh # 自定义配置
#
# 环境变量:
# STORE_DIR — store 根目录(默认 store
# CONFIG — 管线配置 YAML(默认 config/default.yaml
# DB_PATH — QuestionGenStore SQLite 路径(默认 logs/question_gen.db
# SEED — 随机种子(可选,覆盖 config 中的 seed
# MODE — 设为 "mock" 启用 LLM/VLM mock 模式
#
# 日志输出:
# stderr → 终端实时显示
# logs/generate_questions.log → 完整日志
# logs/generate_v2_telemetry.db → LLM/VLM 调用遥测
# logs/question_gen.db → 出题管线运行日志
set -euo pipefail
cd "$(dirname "$0")/.."
STORE_DIR="${STORE_DIR:-store}"
CONFIG="${CONFIG:-config/default.yaml}"
DB_PATH="${DB_PATH:-logs/question_gen.db}"
export PYTHONUNBUFFERED=1
# shellcheck source=../.env
source .env
[ "${MODE:-}" = "mock" ] && export LLM_MOCK=1 VLM_MOCK=1
PYTHON="$(conda run -n Video-Tree-TRM which python)"
"${PYTHON}" tools/generate_questions.py generate-v2 \
--store-dir "$STORE_DIR" \
--config "$CONFIG" \
--db-path "$DB_PATH" \
${SEED:+--seed "$SEED"}