File size: 4,291 Bytes
d6162c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

echo "正在启动 8 个并行的独立任务,并为每个任务分配不同参数..."
# echo "等待 1 小时后启动任务..."
# sleep 3600  # 等待 3600 秒,即 1 小时
source activate wan
export LD_LIBRARY_PATH=/usr/local/cuda/lib64

# 1. 在这里预先定义你的参数数组 (a_i)
#    数组元素的数量应该与你的任务数量(8)相匹配。
#    参数可以是任何字符串,比如文件名、配置名、数值等。
save_folder='validation_samples/samples_vbench2_all_wan_aug'
sampler_name='Flow'
num_generated_videos=-1
prompt_list_path1='/nfs/ywang29/Reward_finetuning/VideoX-Fun/VBench/VBench-2.0/prompts/prompt_aug/Wanx_full_text_aug_part1.txt'
prompt_list_path2='/nfs/ywang29/Reward_finetuning/VideoX-Fun/VBench/VBench-2.0/prompts/prompt_aug/Wanx_full_text_aug_part2.txt'

save_folder_videogen='validation_samples/samples_videogen_eval'
prompt_list_path3='/nfs/ywang29/Reward_finetuning/VideoX-Fun/VideoGen-Eval.txt'

# enable_teacache=False
# num_inference_steps=50


save_folder_div='validation_samples/samples_vbench2_all_wan_aug/Diversity'
prompt_list_path_div='/nfs/ywang29/Reward_finetuning/VideoX-Fun/VBench/VBench-2.0/prompts/prompt_aug/wanx_aug_prompt/Diversity_dup.txt'

model_name='sd_7b_3'
steps=3000


params=(
    "--transformer_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_${model_name}/checkpoint-${steps}/transformer/diffusion_pytorch_model.safetensors --seed -1 --save_folder ${save_folder}/r1_p1 --prompt_list_path ${prompt_list_path1}"
    "--transformer_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_${model_name}/checkpoint-${steps}/transformer/diffusion_pytorch_model.safetensors --seed -1 --save_folder ${save_folder}/r2_p1 --prompt_list_path ${prompt_list_path1}"
    "--transformer_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_${model_name}/checkpoint-${steps}/transformer/diffusion_pytorch_model.safetensors --seed -1 --save_folder ${save_folder}/r3_p1 --prompt_list_path ${prompt_list_path1}"
    "--transformer_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_${model_name}/checkpoint-${steps}/transformer/diffusion_pytorch_model.safetensors --seed -1 --save_folder ${save_folder}/r1_p2 --prompt_list_path ${prompt_list_path2}"
    "--transformer_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_${model_name}/checkpoint-${steps}/transformer/diffusion_pytorch_model.safetensors --seed -1 --save_folder ${save_folder}/r2_p2 --prompt_list_path ${prompt_list_path2}"
    "--transformer_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_${model_name}/checkpoint-${steps}/transformer/diffusion_pytorch_model.safetensors --seed -1 --save_folder ${save_folder}/r3_p2 --prompt_list_path ${prompt_list_path2}"
    "--transformer_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_${model_name}/checkpoint-${steps}/transformer/diffusion_pytorch_model.safetensors --seed 42 --save_folder ${save_folder_videogen} --prompt_list_path ${prompt_list_path3}"
    "--transformer_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_${model_name}/checkpoint-${steps}/transformer/diffusion_pytorch_model.safetensors --seed -1 --save_folder ${save_folder_div}/r1 --prompt_list_path ${prompt_list_path_div}"
)
# 2. 修改循环以遍历数组的索引
#    ${!params[@]} 会获取数组 params 的所有索引 (0 1 2 3 4 5 6 7)
for i in "${!params[@]}"
do
  # 从数组中获取当前索引对应的参数值
  current_param="${params[$i]}"

  # CUDA_VISIBLE_DEVICES=$i 告诉程序只能“看见”并使用第 i 张 GPU
  # python X.py --p "$current_param" 将当前参数传递给脚本
  # & 让命令在后台运行
  echo "启动任务 $i (GPU $i),参数为: $current_param"
  CUDA_VISIBLE_DEVICES=$i python ./examples/wan2.1/predict_t2v_val_sd.py --num_generated_videos $num_generated_videos --sampler_name $sampler_name $current_param &
done

# 'wait' 命令会等待所有后台任务都执行完毕
echo "所有任务已启动。等待它们全部完成..."
wait
echo "所有任务已完成。"

python /nfs/ywang29/Reward_finetuning/VideoX-Fun/validation_samples/rename_v1.py --model_name ${model_name} --steps ${steps}

source activate vbench2
cd /nfs/ywang29/Reward_finetuning/VideoX-Fun/VBench/VBench-2.0
bash ./run_evaluate.sh "wan1.3b_rwft_${model_name}_${steps}_wan_aug1"