Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Get the current directory
- $currentDirectory = Get-Location
- $KOHYA_DIR = Convert-Path -Path "PATH\TO\sd-scripts\"
- # Get all directories in the current directory
- $directories = Get-ChildItem -Directory
- # Iterate through each directory and run your command
- foreach ($directory in $directories) {
- # Enter the directory
- Set-Location -Path $directory.FullName
- # Get the full path of the current directory
- $currentDirFullPath = (Get-Item -Path ".\").FullName
- # Get the name of the current directory
- $currentDirName = $directory.Name
- Set-Location $KOHYA_DIR
- Write-Host "Executing command in $($KOHYA_DIR)"
- & "PATH\TO\sd-scripts\venv\Scripts\Activate.ps1"
- # Build the command with modified parameters
- $command = "accelerate launch --num_cpu_threads_per_process=2 ""./sdxl_train_network.py"" --network_train_unet_only --bucket_reso_steps=64 --cache_latents --cache_latents_to_disk --caption_extension="".txt"" --debiased_estimation_loss --enable_bucket --min_bucket_reso=640 --max_bucket_reso=2048 --flip_aug --gradient_checkpointing --keep_tokens=""1"" --lr_scheduler=""cosine_with_restarts"" --lr_scheduler_num_cycles=""2"" --lr_warmup_steps=""150"" --max_data_loader_n_workers=""1"" --max_grad_norm=""1"" --resolution=""1024,1024"" --max_token_length=225 --max_train_epochs=""10"" --mixed_precision=""bf16"" --network_alpha=""4"" --network_args block_lr_zero_threshold=""0"" --network_dim=""4"" --network_module=networks.lora --network_train_unet_only --no_half_vae --noise_offset=0.02 --optimizer_type=""AdamW"" --output_dir=""$currentDirFullPath"" --output_name=""$currentDirName"" --persistent_data_loader_workers --pretrained_model_name_or_path=""PATH/TO/illustriousXL_v01.safetensors"" --save_every_n_epochs=""1"" --save_model_as=safetensors --save_precision=""bf16"" --shuffle_caption --train_batch_size=""4"" --save_last_n_epochs=""1"" --train_data_dir=""$currentDirFullPath"" --unet_lr=0.0004 --xformers"
- # Run the command
- Invoke-Expression -Command $command
- # Return to the original directory
- Set-Location -Path $currentDirectory
- }
- Write-Host "Finished!"
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement