| 12 | return True |
| 13 | |
| 14 | def apply(self): |
| 15 | from scripts import layerdiffuse # pylint: disable=no-name-in-module |
| 16 | if not shared.sd_loaded: |
| 17 | log.error('LayerDiffuse: model not loaded') |
| 18 | return self.is_active() |
| 19 | if shared.sd_model_type != 'sd' and shared.sd_model_type != 'sdxl': |
| 20 | log.error(f'LayerDiffuse: incorrect base model: class={shared.sd_model.__class__.__name__} type={shared.sd_model_type}') |
| 21 | return self.is_active() |
| 22 | if hasattr(shared.sd_model, 'layerdiffusion'): |
| 23 | log.warning('LayerDiffuse: already applied') |
| 24 | return self.is_active() |
| 25 | layerdiffuse.apply_layerdiffuse() |
| 26 | return self.is_active() |
| 27 | |
| 28 | def reload(self): |
| 29 | sd_models.reload_model_weights(force=True) |