File size: 2,946 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
#!/bin/bash

echo "正在启动 8 个并行的独立任务,并为每个任务分配不同参数..."

# 1. 在这里预先定义你的参数数组 (a_i)
#    数组元素的数量应该与你的任务数量(8)相匹配。
#    参数可以是任何字符串,比如文件名、配置名、数值等。
save_folder='samples7'
sampler_name='Flow_Unipc'
# enable_teacache=False
params=(
    "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct8_3/checkpoint-1400.safetensors --lora_weight 1.0"
    "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct8/checkpoint-1700.safetensors --lora_weight 1.0"
    "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct8_1/checkpoint-1700.safetensors --lora_weight 1.0"
    "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct8_2/checkpoint-500.safetensors --lora_weight 1.0"
    "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct8_2/checkpoint-2000.safetensors --lora_weight 1.0"
    "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct8_2/checkpoint-1500.safetensors --lora_weight 1.0"
    "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct8_2/checkpoint-1000.safetensors --lora_weight 1.0"
    "--lora_path None"
)
# params=(
#     "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Sep28_2/checkpoint-1500.safetensors --lora_weight 0.55 "
#     "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_videoalign/output_Oct5/checkpoint-1000.safetensors --lora_weight 0.55"
#     "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct7_2/checkpoint-1000.safetensors --lora_weight 0.55"
#     "--lora_path None"
#     "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct7_2/checkpoint-2000.safetensors --lora_weight 0.55"
#     "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Sep28_2/checkpoint-2900.safetensors --lora_weight 0.55 "
#     "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct6_3/checkpoint-1500.safetensors --lora_weight 0.55"
#     "--lora_path /nfs/ywang29/Reward_finetuning/VideoX-Fun/output_Oct6_3/checkpoint-1000.safetensors --lora_weight 0.55"
# )

# 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.py --save_folder $save_folder --sampler_name $sampler_name $current_param &
done

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