forked from chenfengxu714/StreamDiffusionV2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_v2v.sh
More file actions
executable file
·97 lines (93 loc) · 3.15 KB
/
Copy pathrun_v2v.sh
File metadata and controls
executable file
·97 lines (93 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
set -eu
# Unified offline launcher for all supported video-to-video inference modes.
# Environment variables can override the default config, checkpoint, output, GPU,
# and launch parameters without having to edit the script itself.
MODE="${1:-single}"
if [ "$#" -gt 0 ]; then
shift
fi
ROOT_DIR="$(CDPATH= cd -- "$(dirname "$0")" && pwd)"
MODEL_TYPE="${MODEL_TYPE:-T2V-1.3B}"
PREV_ARG=""
for ARG in "$@"; do
if [ "$PREV_ARG" = "--model_type" ]; then
MODEL_TYPE="$ARG"
break
fi
case "$ARG" in
--model_type=*)
MODEL_TYPE="${ARG#--model_type=}"
break
;;
esac
PREV_ARG="$ARG"
done
if [ "$MODEL_TYPE" = "T2V-14B" ]; then
CONFIG_PATH="${CONFIG_PATH:-configs/wan_causal_dmd_v2v_14b.yaml}"
CHECKPOINT_FOLDER="${CHECKPOINT_FOLDER:-ckpts/wan_causal_dmd_v2v_14b}"
STEP="${STEP:-1}"
else
CONFIG_PATH="${CONFIG_PATH:-configs/wan_causal_dmd_v2v.yaml}"
CHECKPOINT_FOLDER="${CHECKPOINT_FOLDER:-ckpts/wan_causal_dmd_v2v}"
STEP="${STEP:-2}"
fi
OUTPUT_FOLDER="${OUTPUT_FOLDER:-outputs/}"
HEIGHT="${HEIGHT:-480}"
WIDTH="${WIDTH:-832}"
FPS="${FPS:-16}"
MASTER_PORT="${MASTER_PORT:-29501}"
case "$MODE" in
single|batch)
# Standard single-GPU batched inference.
CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0}" python -m streamv2v.inference \
--config_path "$ROOT_DIR/$CONFIG_PATH" \
--checkpoint_folder "$ROOT_DIR/$CHECKPOINT_FOLDER" \
--output_folder "$ROOT_DIR/$OUTPUT_FOLDER" \
--prompt_file_path "$ROOT_DIR/${PROMPT_FILE_PATH:-examples/prompt.txt}" \
--video_path "$ROOT_DIR/${VIDEO_PATH:-examples/original.mp4}" \
--height "$HEIGHT" \
--width "$WIDTH" \
--fps "$FPS" \
--step "$STEP" \
--model_type "$MODEL_TYPE" \
"$@"
;;
single-wo|wo|wo-batch)
# Single-GPU inference without batched denoising.
CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0}" python -m streamv2v.inference_wo_batch \
--config_path "$ROOT_DIR/$CONFIG_PATH" \
--checkpoint_folder "$ROOT_DIR/$CHECKPOINT_FOLDER" \
--output_folder "$ROOT_DIR/$OUTPUT_FOLDER" \
--prompt_file_path "$ROOT_DIR/${PROMPT_FILE_PATH:-examples/prompt.txt}" \
--video_path "$ROOT_DIR/${VIDEO_PATH:-examples/original.mp4}" \
--height "$HEIGHT" \
--width "$WIDTH" \
--fps "$FPS" \
--step "$STEP" \
--model_type "$MODEL_TYPE" \
"$@"
;;
pipe|parallel)
# Pipeline-parallel inference across multiple GPUs on one node.
CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1}" torchrun \
--nproc_per_node="${NPROC_PER_NODE:-2}" \
--master_port="$MASTER_PORT" \
--module streamv2v.inference_pipe \
--config_path "$ROOT_DIR/$CONFIG_PATH" \
--checkpoint_folder "$ROOT_DIR/$CHECKPOINT_FOLDER" \
--output_folder "$ROOT_DIR/$OUTPUT_FOLDER" \
--prompt_file_path "$ROOT_DIR/${PROMPT_FILE_PATH:-examples/prompt.txt}" \
--video_path "$ROOT_DIR/${VIDEO_PATH:-examples/original.mp4}" \
--height "$HEIGHT" \
--width "$WIDTH" \
--fps "$FPS" \
--step "$STEP" \
--model_type "$MODEL_TYPE" \
"$@"
;;
*)
echo "Unknown mode '$MODE'. Expected one of: single, single-wo, pipe" >&2
exit 1
;;
esac