mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 08:44:33 +02:00
Merge pull request #4928 from QualiaRain/fix/lora-extract-component-selection
fix(lora-extract): stop overwriting the module selection list; fix dead no-LoRA guard
This commit is contained in:
@@ -122,7 +122,7 @@ def make_lora(fn, maxrank, auto_rank, rank_ratio, modules, overwrite):
|
||||
log.warning(msg)
|
||||
yield msg
|
||||
return
|
||||
if loaded_lora() == "":
|
||||
if not loaded_lora():
|
||||
msg = "LoRA extract: no LoRA detected"
|
||||
log.warning(msg)
|
||||
yield msg
|
||||
@@ -141,8 +141,7 @@ def make_lora(fn, maxrank, auto_rank, rank_ratio, modules, overwrite):
|
||||
with rp.Progress(rp.TextColumn('[cyan]LoRA extract'), rp.BarColumn(), rp.TaskProgressColumn(), rp.TimeRemainingColumn(), rp.TimeElapsedColumn(), rp.TextColumn('[cyan]{task.description}'), console=console) as progress:
|
||||
|
||||
if 'te' in modules and getattr(shared.sd_model, 'text_encoder', None) is not None:
|
||||
modules = shared.sd_model.text_encoder.named_modules()
|
||||
task = progress.add_task(description="te1 decompose", total=len(list(modules)))
|
||||
task = progress.add_task(description="te1 decompose", total=len(list(shared.sd_model.text_encoder.named_modules())))
|
||||
for name, module in shared.sd_model.text_encoder.named_modules():
|
||||
progress.update(task, advance=1)
|
||||
weights_backup = getattr(module, "network_weights_backup", None)
|
||||
@@ -157,8 +156,7 @@ def make_lora(fn, maxrank, auto_rank, rank_ratio, modules, overwrite):
|
||||
t1 = time.time()
|
||||
|
||||
if 'te' in modules and getattr(shared.sd_model, 'text_encoder_2', None) is not None:
|
||||
modules = shared.sd_model.text_encoder_2.named_modules()
|
||||
task = progress.add_task(description="te2 decompose", total=len(list(modules)))
|
||||
task = progress.add_task(description="te2 decompose", total=len(list(shared.sd_model.text_encoder_2.named_modules())))
|
||||
for name, module in shared.sd_model.text_encoder_2.named_modules():
|
||||
progress.update(task, advance=1)
|
||||
weights_backup = getattr(module, "network_weights_backup", None)
|
||||
@@ -172,8 +170,7 @@ def make_lora(fn, maxrank, auto_rank, rank_ratio, modules, overwrite):
|
||||
t2 = time.time()
|
||||
|
||||
if 'unet' in modules and getattr(shared.sd_model, 'unet', None) is not None:
|
||||
modules = shared.sd_model.unet.named_modules()
|
||||
task = progress.add_task(description="unet decompose", total=len(list(modules)))
|
||||
task = progress.add_task(description="unet decompose", total=len(list(shared.sd_model.unet.named_modules())))
|
||||
for name, module in shared.sd_model.unet.named_modules():
|
||||
progress.update(task, advance=1)
|
||||
weights_backup = getattr(module, "network_weights_backup", None)
|
||||
|
||||
Reference in New Issue
Block a user