Advertisement
Guest User

Untitled

a guest
May 30th, 2023
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. # https://github.com/kohya-ss/sd-scripts
  2. # merge loras with ratios -> resize
  3. # output files will appear next to input file
  4.  
  5. # Config Start
  6.  
  7. $inputs = @(
  8.     @( "X:\SD\voldy\models\Lora\Wagashi928-v4.safetensors", 0.5),
  9.     @( "X:\SD\voldy\models\Lora\EnvyCuteMix03.safetensors", 0.5),
  10.     @( "X:\SD\voldy\models\Lora\santasunflower-000003.safetensors", 0.5)
  11. );
  12.  
  13. $new_rank = 32
  14.  
  15. # Config End
  16.  
  17. Clear-Host
  18. $models = @($inputs | ForEach-Object {$_[0]})
  19. $ratios = @($inputs | ForEach-Object {[Math]::Pow($_[1],0.5)})
  20.  
  21. Write-Host $models
  22. Write-Host $ratios
  23.  
  24. $output_name = ($inputs | ForEach-Object { (Get-Item $_[0]).Basename + "_" + $_[1] }) -join "__"
  25.  
  26. .\venv\Scripts\activate
  27.  
  28. $model_saved = Join-Path -Path (Split-Path ($inputs[0][0])) -ChildPath "$($output_name).safetensors"
  29. Write-Host $model_saved
  30.  
  31. python .\networks\svd_merge_lora.py `
  32.     --save_to=$model_saved `
  33.     --new_rank=$new_rank `
  34.     --models $models `
  35.     --ratios $ratios
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement