JAV-Gen / scripts /bash /inference.sh
kaiw7's picture
Upload folder using huggingface_hub
e490e7e verified
#!/bin/bash
export CUDA_VISIBLE_DEVICES=0
script="scripts/inference.py"
# script="scripts/misc/inference_t2v.py"
cmd="python ${script}"
# export CUDA_VISIBLE_DEVICES=0,1,6,7
# cmd="torchrun --nproc_per_node 4 --master_port 24585 scripts/inference_multi.py"
# video_prompt="The video opens with an ATV on a dirt path in the outdoors, surrounded by rugged terrain. As the engine roars to life, the vehicle accelerates, kicking up dust and gravel in its wake. The camera follows the ATV, capturing its powerful movements as it speeds through the landscape."
# audio_prompt="The sound of the revving engine is accompanied by an upbeat electric guitar track, which enhances the sense of adrenaline and adventure. The combination of engine noise and music creates an energetic and dynamic atmosphere."
# cfg_file="configs/javisdit-v0-1/inference/debug/sample.py"
# cfg_file="configs/wan2.1/inference/sample.py"
# cfg_file="configs/wan2.1/inference/video_sample.py"
# prompt_path="assets/demo/prompts.txt"
resolution=240p # 240p
aspect_ratio="9:16"
# num_frames=4s
# save_dir="samples/audio_video_eval/javisdit_v01"
# # resolution=720p
# # num_frames=2s
# # save_dir="samples/debug_v01_sampling_720p2s"
declare -a DATASETS=("audiocaps" "javismini") #
declare -a NUM_FRAMES=(129 65) #
declare -a PROMPT_PATHS=("assets/meta/audiocaps_test.csv" "assets/meta/JavisBench-mini.csv") #
# dataset=audiocaps
# num_frames=129 # 8s
# prompt_path="assets/meta/audiocaps_test.csv"
dataset=javismini
num_frames=65 # 4s
prompt_path="assets/meta/JavisBench-mini.csv"
# cfg_file="configs/wan2.1/inference/ths/audio_sample.py"
# "0.4" "1.5" "2.0"
# declare -a steps=("7000")
# for i in "${!steps[@]}"; do
# method=${steps[$i]}
# gpu=${i}
# for i in "${!DATASETS[@]}"; do
# dataset="${DATASETS[$i]}"
# num_frames="${NUM_FRAMES[$i]}"
# prompt_path="${PROMPT_PATHS[$i]}"
# for ep in "0" "4" "9" "20" "28" "49" ; do #
for model_path in exps/audio/dualffn_nolora_pewindow/epoch* ; do
model_dir=$(dirname "${model_path}")
model_name=$(basename "${model_dir}")
model_step=$(basename "${model_path}")
# echo "${model_path} ${model_name} ${model_step}"
cfg_file="configs/wan2.1/inference/ths/ablation/audio_sample_${model_name}.py"
save_dir="samples/audio_eval/Wan2.1/${model_name}/${model_step}/${dataset}"
# cfg_file="configs/wan2.1/eval/audio/dualffn_nolora_ep${ep}_sample.py"
# save_dir="/mnt/workspace/inference/audio_eval/Wan2.1/dualffn_nolora/ep${ep}/${dataset}"
# cfg_file="configs/wan2.1/eval/audio/dualffn_nolora_ep${ep}_sample.py"
# save_dir="/mnt/workspace/inference/audio_eval/Wan2.1/dualffn_nolora/ep${ep}/${dataset}"
# cfg_file="debug/cfg/sample_dualffn_attnlora_ep${ep}.py"
# save_dir="samples/audio_video_eval/wan2.1_dualffn_attnlora/${resolution}/ep${ep}"
# resolution=240p
# num_frames=4s
# save_dir="samples/JAV-R1/test/den_cap"
# prompt_path="debug/JAV-R1/test_avgen_den_cap.csv"
# resolution=480p
# num_frames=65
# save_dir="samples/audio_video_eval/wan2.1_av_attnlora/480p4s"
# # save_dir="samples/debug/wan2.1/480p"
# prompt_path="data/eval/JavisBench/backup/meta_v0.1/JavisBench-mini.csv"
# prompt_path="data/eval/JavisBench/JavisBench-mini.csv"
rm -rf ${save_dir}
${cmd} ${cfg_file} \
--layernorm-kernel false \
--resolution ${resolution} --num-frames ${num_frames} --aspect-ratio ${aspect_ratio} \
--prompt-path ${prompt_path} --model-path ${model_path} \
--save-dir ${save_dir} --verbose 1
# # x_cond="a2v"
# # save_dir="samples/x_cond/debug/${x_cond}"
# # rm -rf ${save_dir}
# # CUDA_VISIBLE_DEVICES=6 python \
# # scripts/vaffusion/inference.py \
# # configs/opensora-syncva/inference/x_cond/${x_cond}.py \
# # --resolution 240p --num-frames 4s \
# # --save-dir ${save_dir} --verbose 1
# python -m tools.datasets.convert video ${save_dir} --output ${save_dir}/meta.csv
# python -m tools.datasets.datautil ${save_dir}/meta.csv --num-workers 8 --extract-audio --audio-sr 16000
# rm -f ${save_dir}/meta*.csv
done
# done