SuperAPI AI 工具集

complexa-sweep

智能体与模型

查看项目

更新于 10-16 02:33

技能介绍

complexa-sweep 用于对 Proteina-Complexa 设计流程做笛卡尔积参数扫描,并汇总排名结果。它来自 nvidia-bionemo/bionemo-agent-toolkit。

用途:选取或编写 sweeper YAML,展开成 N 份推理与评估配置,循环运行 complexa design,再把每个配置的成功指标聚合成带排名的 sweep_summary.csv 与 sweep_manifest.json,找出最佳配置和 Pareto 前沿(耗时与成功率)。注意 complexa design CLI 不接受 --sweeper,扫描必须由 script_utils/generate_inference_configs.py 驱动,它会为每个组合写出一个 configs/inference_configs/inf_{idx}_{run_name}.yaml,然后再循环 complexa design。

主要能力:使用 configs/sweeps/ 中已有的 sweeper(beam_width、bb_ca_temperature、search_replicas、example);用任意点号 Hydra 路径编写新 sweeper(顶层映射,值为列表,笛卡尔积为各列表长度之积);用 generate_inference_configs.py 生成 N 组推理+评估配置;单 GPU 串行循环或多 GPU 主机按 CUDA_VISIBLE_DEVICES 分片并行;遍历每个配置输出目录,解析 analyze 步骤 CSV;输出 sweep_summary.csv(每配置一行:轴值、成功率、mean iPAE、多样性)和 sweep_manifest.json;按成功率找最佳配置,并给出 wall-clock 与成功率的 Pareto 前沿。

使用方式:先运行 bash .claude/skills/shared/scripts/preflight.sh 并读取 ./complexa_setup/preflight.json;若 gpu.available=false 则停止。用与 complexa-design 相同的对话确定 pipeline_config_name、task_name、run_name。然后预演:python script_utils/generate_inference_configs.py --config_name search_binder_local_pipeline --sweeper configs/sweeps/my_sweep.yaml --override generation.task_name=22_DerF21 --run_name my_sweep --dryrun,确认输出显示 DRY RUN 及配置对数。去掉 --dryrun 后生成配置,再循环:for cfg in configs/inference_configs/infmy_sweep.yaml; do complexa design "$cfg" || echo "FAILED: $cfg"; done。多 GPU 时按 seq 分片并行,仅在刻意让单次调用占用多 GPU 时才加 gen_njobs/eval_njobs。结果在 ./inference/inf{idx}{run_name}/ 与 ./evaluation_results/eval{idx}{run_name}/results.csv;若没有 passes_filter,可用 i_pae<10、i_plddt>0.7、sc_rmsd<2.0 等阈值与用户确认后推导。最后用 write_manifest.py 生成 manifest。

适用场景:质量不足时扫描 beam_width × nsteps;想加速时下调 nsteps;低多样性时扫描 sc_scale_noise;奖励过拟合时调整 reward_weights 比例;需要统计稳健性时扫描 best_of_n.replicas;算法对比时扫描 search.algorithm(single-pass、best-of-n、beam-search、fk-steering)。

限制:扫描总 GPU 时间 = 配置数 × 单次运行时间,单次 search_binder_local_pipeline 在 A100 上约 30–90 分钟,需提前向用户确认成本;CPU 不可行。常见问题包括 sweeper 路径相对 CWD 解析错误、顶层必须是映射、值为空列表则不生成配置、--override 会覆盖同名扫描轴导致该轴塌缩、循环中单个配置失败会被 || echo 吞掉(需单独重跑并跳过该 config_id)。具体每个轴的典型范围与成本见 reference/sweep_axes.md,面向用户的扫描系统概览见 docs/SWEEP.md。