ActionRoPE / code /scripts /infer_demo.sh
teawhite's picture
add docs+code
880dff9 verified
Raw History Blame Contribute Delete
2.1 kB
#!/usr/bin/env bash
# ActionRoPE 推理示例。两条命令:① replay 一条 val clip(sidecar 真值 + 该 clip 首帧 + 原 prompt,
# 与 GT 比 PSNR);② 自造指令:同一首帧,玩家向屏幕右走 1.0× 步速 21 个 cell。
# 不给 --ckpt 就是基座权重(流程冒烟用);训练产物 outputs/<run>/step-N.safetensors 用 --ckpt 传入,
# mask 通道按 ckpt 键集自动判断。--arm plain 是对照臂(普通 RoPE + 文本带动作)。
set -euo pipefail
ROOT=/opt/dlami/nvme/zhiyangdeng/ActionRoPE
PY=$ROOT/.venv/bin/python
export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-4}
export DIFFSYNTH_SKIP_DOWNLOAD=True
CKPT=${CKPT:-} # 例:CKPT=$ROOT/outputs/arope_run/step-2000.safetensors
CKPT_ARG=${CKPT:+--ckpt $CKPT}
CLIP=${CLIP:-clip_Eybx_200000958_000273} # val_eybx,21 个 cell 动作全为 7,tidal_flats
STEPS=${STEPS:-50}
# ① replay:指令来自 sidecar 真值,输出 outputs/samples/replay_<clip>.mp4 + _frame0.png + .json
$PY -m actionrope.infer $CKPT_ARG --replay "$CLIP" --steps "$STEPS" \
--out "$ROOT/outputs/samples/replay_${CLIP}.mp4"
# ② 自造:首帧取该 clip 的第 0 帧(也可给 png / mp4 路径),场景 tidal_flats,向右 1.0× 走满 21 个 cell
# 速度取 sidecar meta 的 walk_speed_px_s(≈71 px/s ⇒ 5 s 走 356 px),实测位移打印在最后一行
$PY -m actionrope.infer $CKPT_ARG --first_frame "$CLIP" --scene tidal_flats --actions "right:1.0:21" \
--steps "$STEPS" --seed 0 --out "$ROOT/outputs/samples/right_x1_${CLIP}.mp4"
# 其它写法:
# --actions "right:1.0:10,left:1.0:11" 分段(cell 数合计 21)
# --actions "71,0:21" 直接给 (dx,dy) px/s
# --trigger "burn:wills_farm:8:2" cell 8–9 用转场从句,之后切成 wills_farm
# --cfg 3.0 CFG(负条件:arope 臂 NULL_PROMPT,plain 臂逐 cell 裸动作串)
# --arm plain 对照臂:普通 RoPE + 文本带动作(动作词 = 真实屏幕方向,--label_mode literal)