From d947e8e5286e3289e7b1471a2e5e48f53dc05ac5 Mon Sep 17 00:00:00 2001 From: Travor <3488616445@qq.com> Date: Fri, 29 May 2026 00:30:48 +0800 Subject: [PATCH] fix(script): export CUDA devices in fast runner --- .gitattributes | 1 + run_fast.sh | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfdb8b7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.sh text eol=lf diff --git a/run_fast.sh b/run_fast.sh index 7e5388d..4371f39 100644 --- a/run_fast.sh +++ b/run_fast.sh @@ -1,32 +1,41 @@ +#!/usr/bin/env bash +set -euo pipefail +set -x -set -x +if [ "$#" -ne 2 ]; then + echo "Usage: bash run_fast.sh " >&2 + exit 2 +fi WEIGHT_DIR=$1 FRAME=$2 +CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7} +NPROC_PER_NODE=${NPROC_PER_NODE:-8} +export CUDA_VISIBLE_DEVICES # case1 -CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7; torchrun --nproc_per_node=8 generate_fast.py \ +torchrun --nproc_per_node=${NPROC_PER_NODE} generate_fast.py \ --task i2v-A14B \ --size 480*832 \ - --ckpt_dir ${WEIGHT_DIR} \ + --ckpt_dir "${WEIGHT_DIR}" \ --image examples/03/image.jpg \ --action_path examples/03 \ --dit_fsdp \ --t5_fsdp \ - --ulysses_size 8 \ - --frame_num ${FRAME} \ + --ulysses_size "${NPROC_PER_NODE}" \ + --frame_num "${FRAME}" \ --prompt "A serene lakeside scene with a lone tree standing in calm water, surrounded by distant snow-capped mountains under a bright blue sky with drifting white clouds — gentle ripples reflect the tree and sky, creating a tranquil, meditative atmosphere." # case2 -CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7; torchrun --nproc_per_node=8 generate_fast.py \ +torchrun --nproc_per_node=${NPROC_PER_NODE} generate_fast.py \ --task i2v-A14B \ --size 480*832 \ - --ckpt_dir ${WEIGHT_DIR} \ + --ckpt_dir "${WEIGHT_DIR}" \ --image examples/04/image.jpg \ --action_path examples/04 \ --dit_fsdp \ --t5_fsdp \ - --ulysses_size 8 \ - --frame_num ${FRAME} \ + --ulysses_size "${NPROC_PER_NODE}" \ + --frame_num "${FRAME}" \ --prompt "A sweeping cinematic journey along the Great Wall of China, winding through golden autumn hills under a brilliant blue sky — stone pathways stretch into the distance, watchtowers stand sentinel, and vibrant foliage blankets the mountainsides as the camera glides smoothly forward, capturing the grandeur and timeless majesty of this ancient wonder."