mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
fix tgate apply/unapply
This commit is contained in:
+4
-2
@@ -21,6 +21,7 @@ class Script(scripts.Script):
|
||||
return [enabled, gate_step]
|
||||
|
||||
def run(self, p: processing.StableDiffusionProcessing, enabled, gate_step): # pylint: disable=arguments-differ
|
||||
p.gate_step = min(gate_step, p.steps) if enabled else -1
|
||||
if not enabled:
|
||||
return None
|
||||
install('tgate')
|
||||
@@ -33,11 +34,12 @@ class Script(scripts.Script):
|
||||
shared.log.warning(f'T-Gate: pipeline={shared.sd_model_type} required=sd or sdxl')
|
||||
return None
|
||||
old_pipe = shared.sd_model
|
||||
shared.sd_model = cls(shared.sd_model, gate_step=min(gate_step, p.steps))
|
||||
shared.sd_model = cls(shared.sd_model, gate_step=p.gate_step)
|
||||
sd_models.copy_diffuser_options(shared.sd_model, old_pipe)
|
||||
sd_models.move_model(shared.sd_model, devices.device) # move pipeline to device
|
||||
sd_models.set_diffuser_options(shared.sd_model, vae=None, op='model')
|
||||
shared.log.debug(f'T-Gate: pipeline={shared.sd_model.__class__.__name__} steps={gate_step}')
|
||||
shared.log.debug(f'T-Gate: pipeline={shared.sd_model.__class__.__name__} steps={p.gate_step}')
|
||||
processed = processing.process_images(p)
|
||||
shared.sd_model = old_pipe
|
||||
del shared.sd_model.tgate
|
||||
return processed
|
||||
|
||||
Reference in New Issue
Block a user