Add ROMA frozen backbone extraction support

This commit is contained in:
Xin Wang
2026-08-27 13:35:59 +08:00
parent 1925ff71a7
commit 655d27a4ca
5 changed files with 221 additions and 17 deletions

View File

@@ -8,6 +8,7 @@ set -euo pipefail
PROJECT_ROOT="${PROJECT_ROOT:-/mnt/58462F4C462F29E8/Code/icassp2027-experiment}"
MODEL="${MODEL:-/mnt/58462F4C462F29E8/Models/Qwen2.5-Omni-3B}"
BACKBONE_LOADER="${BACKBONE_LOADER:-qwen}"
VIDEO_ROOT="${VIDEO_ROOT:-/mnt/58462F4C462F29E8/Datasets/easycom/Main/Video_Compressed}"
TARGET_ROOT="${TARGET_ROOT:-/mnt/58462F4C462F29E8/Code/EgoSpeak/dataset/EasyCom/target_perframe}"
FEATURE_ROOT="${FEATURE_ROOT:-${PROJECT_ROOT}/features/easycom_direct}"
@@ -23,6 +24,9 @@ DTYPE="${DTYPE:-bfloat16}"
DECODER="${DECODER:-decord}"
DECODER_GPU_ID="${DECODER_GPU_ID:-0}"
FRAME_CACHE_SIZE="${FRAME_CACHE_SIZE:-64}"
# Delay worker startup by GPU index to avoid eight processes reading a large
# full ROMA checkpoint at the same instant. Zero preserves the old behavior.
MODEL_LOAD_STAGGER_SECONDS="${MODEL_LOAD_STAGGER_SECONDS:-0}"
# Space-separated host GPU ids, e.g. "0" or "0 1 2 3". One session per GPU at a time.
GPUS="${GPUS:-0}"
# Optional: only run selected session ids, e.g. SESSIONS="1 2 3"
@@ -70,6 +74,7 @@ run_one() {
{
echo "$(date): GPU ${gpu} starting ${session}"
echo "model=${MODEL}"
echo "backbone_loader=${BACKBONE_LOADER}"
echo "session_dir=${session_dir}"
echo "target=${target}"
echo "output=${output}"
@@ -81,6 +86,7 @@ run_one() {
if ! CUDA_VISIBLE_DEVICES="${gpu}" PYTHONUNBUFFERED=1 \
python streaming_turn_model_directly.py \
--model-id "${MODEL}" \
--backbone-loader "${BACKBONE_LOADER}" \
--easycom-session-dir "${session_dir}" \
--target "${target}" \
--use-audio-in-video \
@@ -124,15 +130,30 @@ done
pids=()
status=0
worker_index=0
for gpu in "${GPU_ARR[@]}"; do
sids="${WORKERS[${gpu}]}"
[[ -z "${sids// }" ]] && continue
delay_seconds="$(python - "${MODEL_LOAD_STAGGER_SECONDS}" "${worker_index}" <<'PY'
import sys
print(float(sys.argv[1]) * int(sys.argv[2]))
PY
)"
(
if python - "${delay_seconds}" <<'PY'
import sys
raise SystemExit(0 if float(sys.argv[1]) > 0 else 1)
PY
then
echo "GPU ${gpu} worker waiting ${delay_seconds}s before model load"
sleep "${delay_seconds}"
fi
for sid in ${sids}; do
run_one "${gpu}" "${sid}" || exit 1
done
) &
pids+=("$!")
worker_index=$((worker_index + 1))
done
for pid in "${pids[@]}"; do