#!/usr/bin/env bash # MiniMax-H3 FL2VA NF4 launcher. usage: ./run.sh [args for t2va.py ...] # ./run.sh 1 # turbo 4-step, 480x832x124f # ./run.sh 1 --no-turbo --steps 50 # full quality # ./run.sh 2 --prompt "..." --seed 7 set -euo pipefail B=/data/models/minimax-h3 GPU="${1:-1}"; shift || true export CUDA_VISIBLE_DEVICES="$GPU" export DIFFSYNTH_ATTENTION_IMPLEMENTATION=torch # sm_75: no flash/sage; pin instead of auto-picking xformers export DIFFSYNTH_MODEL_BASE_PATH="$B/models" export MODELSCOPE_CACHE="$B/.mscache" export PYTHONUNBUFFERED=1 # 22GB 卡上激活与权重贴着上限,碎片会直接压垮它(实测 reserved-but-unallocated 达 2.49GB) export PYTORCH_ALLOC_CONF=expandable_segments:True # NOTE: deliberately NOT setting PYTHONNOUSERSITE -- the venv's site-packages already # precedes ~/.local in sys.path, so our bitsandbytes 0.50.1 shadows the broken 0.45.1 there. # GPU0/1 sit on NUMA0, GPU2/3 on NUMA1 -- keep the CPU-offloaded weights on the near node. case "$GPU" in 0|1) NODE=0 ;; 2|3) NODE=1 ;; *) NODE="" ;; esac BIND=(); if [ -n "$NODE" ] && command -v numactl >/dev/null 2>&1; then BIND=(numactl --cpunodebind="$NODE" --membind="$NODE"); fi LOG="$B/logs/gpu${GPU}_$(date +%Y%m%d-%H%M%S).log" echo "[run] GPU=$GPU numa=${NODE:-none} log=$LOG" "${BIND[@]}" "$B/venv/bin/python" "$B/scripts/t2va.py" "$@" 2>&1 | tee "$LOG"