File size: 2,370 Bytes
0d8b1b0
3287bb5
1f00881
0d7be29
 
 
3287bb5
 
 
 
 
 
 
 
 
 
 
a723a7c
64dddc1
 
 
a723a7c
 
 
64dddc1
 
c6aa3f7
0718f3e
a723a7c
 
 
 
 
 
 
 
81ae4f9
20aa7e9
a723a7c
170bc28
3287bb5
0718f3e
0d8b1b0
43c6d07
1f00881
 
 
 
3124b04
1f00881
 
59def2d
 
 
1f00881
 
 
 
 
 
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
#!/bin/bash
# --- Final Definitive Startup Script (v25 - Fixes git 'dubious ownership' error) ---

set -e
echo "--- Startup Script Initialized ---"

# --- FIX for 'dubious ownership' error ---
# This tells Git that the /code directory is safe to use, even with different user ownership.
echo "--- Applying Git security exception for /code directory... ---"
git config --global --add safe.directory /code

# --- CRITICAL STEP: Force checkout of Git LFS files in the repo ---
echo "--- Ensuring all dataset images are fully downloaded (git lfs pull)... ---"
git lfs pull
echo "--- LFS checkout complete. Verifying file sizes: ---"
ls -lh /code/dataset/ebPhotos-001/

MODELS_DIR="/data/models"
OUTPUT_DIR="/data/output"
mkdir -p $MODELS_DIR
mkdir -p $OUTPUT_DIR

DIT_PATH="$MODELS_DIR/wan2.1_i2v_720p_14B_fp8_e4m3fn.safetensors"
VAE_PATH="$MODELS_DIR/Wan2.1_VAE.pth"
CLIP_PATH="$MODELS_DIR/models_clip_open-clip-xlm-roberta-large-vit-huge-14.pth"
T5_PATH="$MODELS_DIR/models_t5_umt5-xxl-enc-bf16.pth"

echo "--- Checking for model files... ---"
if [ ! -f "$DIT_PATH" ]; then
    huggingface-cli download jujutechnology/WANfortraining wan2.1_i2v_720p_14B_fp8_e4m3fn.safetensors --local-dir $MODELS_DIR --local-dir-use-symlinks False
fi
if [ ! -f "$VAE_PATH" ]; then
    huggingface-cli download jujutechnology/WANfortraining Wan2.1_VAE.pth --local-dir $MODELS_DIR --local-dir-use-symlinks False
fi
if [ ! -f "$CLIP_PATH" ]; then
    huggingface-cli download jujutechnology/WANfortraining models_clip_open-clip-xlm-roberta-large-vit-huge-14.pth --local-dir $MODELS_DIR --local-dir-use-symlinks False
fi
if [ ! -f "$T5_PATH" ]; then
    huggingface-cli download jujutechnology/WANfortraining models_t5_umt5-xxl-enc-bf16.pth --local-dir $MODELS_DIR --local-dir-use-symlinks False
fi
echo "--- Models are present. Starting training... ---"

accelerate launch wan_train_network.py \
    --task="i2v-14B" \
    --dit="$DIT_PATH" \
    --vae="$VAE_PATH" \
    --clip="$CLIP_PATH" \
    --t5="$T5_PATH" \
    --dataset_config="dataset/huggingfacetoml.toml" \
    --output_dir="$OUTPUT_DIR" \
    --output_name="my-I2V-Lora" \
    --network_module="networks.lora_wan" \
    --network_dim="32" \
    --network_alpha="4" \
    --max_train_epochs="70" \
    --learning_rate="1e-5" \
    --optimizer_type="adamw" \
    --mixed_precision="bf16" \
    --gradient_checkpointing \
    --sdpa