|
#!/usr/bin/env zsh |
|
|
|
|
|
|
|
__conda_setup="$('/home/kade/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" |
|
if [ $? -eq 0 ]; then |
|
eval "$__conda_setup" |
|
else |
|
if [ -f "/home/kade/miniconda3/etc/profile.d/conda.sh" ]; then |
|
. "/home/kade/miniconda3/etc/profile.d/conda.sh" |
|
else |
|
export PATH="/home/kade/miniconda3/bin:$PATH" |
|
fi |
|
fi |
|
unset __conda_setup |
|
|
|
|
|
conda activate sdscripts |
|
|
|
NAME="friend-v1s2000" |
|
TRAINING_DIR="/home/kade/datasets/friend" |
|
OUTPUT_DIR="/home/kade/flux_output_dir" |
|
|
|
|
|
STEPS=$(echo $NAME | grep -oE '[0-9]+$') |
|
|
|
|
|
if [ -z "$STEPS" ]; then |
|
STEPS=4096 |
|
echo "No step count found in NAME. Using default value of \e[35m$STEPS\e[0m" |
|
else |
|
echo "Extracted \e[35m$STEPS\e[0m steps from NAME" |
|
fi |
|
|
|
args=( |
|
|
|
--pretrained_model_name_or_path ~/ComfyUI/models/unet/flux1-dev.safetensors |
|
--clip_l ~/ComfyUI/models/clip/clip_l.safetensors |
|
--t5xxl ~/ComfyUI/models/clip/t5xxl_fp16.safetensors |
|
--ae ~/ComfyUI/models/vae/ae.safetensors |
|
|
|
|
|
|
|
|
|
|
|
--timestep_sampling shift |
|
|
|
|
|
--discrete_flow_shift 3.1582 |
|
|
|
|
|
|
|
|
|
--model_prediction_type raw |
|
--guidance_scale 1.0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--cache_latents_to_disk |
|
--save_model_as safetensors |
|
--sdpa |
|
--persistent_data_loader_workers |
|
--max_data_loader_n_workers 2 |
|
--seed 42 |
|
--max_train_steps=$STEPS |
|
--gradient_checkpointing |
|
--mixed_precision bf16 |
|
--optimizer_type=ClybW |
|
--save_precision bf16 |
|
--network_module networks.lora_flux |
|
--network_dim 4 |
|
--learning_rate 5e-4 |
|
--cache_text_encoder_outputs |
|
--cache_text_encoder_outputs_to_disk |
|
--fp8_base |
|
--highvram |
|
--dataset_config "$TRAINING_DIR/config.toml" |
|
--output_dir $OUTPUT_DIR |
|
--output_name $NAME |
|
|
|
--sample_prompts="$TRAINING_DIR/sample-prompts.txt" |
|
--sample_every_n_steps=20 |
|
--sample_sampler="euler" |
|
--sample_at_first |
|
--save_every_n_steps=100 |
|
) |
|
|
|
cd ~/source/repos/sd-scripts-sd3 |
|
python "./flux_train_network.py" "${args[@]}" |
|
cd ~ |
|
|
|
|