hako-mikan / sd-webui-regional-prompter

set prompt to divided region
GNU Affero General Public License v3.0
1.58k stars 133 forks source link

ModuleNotFoundError: No module named 'lora' / AttributeError: 'Script' object has no attribute 'pt' #338

Closed sjwk closed 3 months ago

sjwk commented 3 months ago

Describe the bug Any time I enable regional prompter, it errors out with: AttributeError: 'Script' object has no attribute 'pt' Looking further back in the console output I can see it also errors: ModuleNotFoundError: No module named 'lora'.

This seems to have started after updating both A1111 web-ui and the regional prompter version. I restored an earlier version of regional prompter but that was still broken, although reverting to an earlier web-ui and earlier regional prompter worked. I suspect it's down to a change in the web-ui, but it'll probably be on you to fix in the plugin....

I've tried using both SD1.5 and SDXL models, tried on a completely fresh install and have no other extensions.

Output: `Reusing loaded model sd_xl_base_1.0.safetensors [31e35c80fc] to load v1-5-pruned-emaonly.safetensors [6ce0161689] Loading weights [6ce0161689] from F:\AI\sdxl\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors Creating model from config: F:\AI\sdxl\configs\v1-inference.yaml Applying attention optimization: xformers... done. Model loaded in 5.3s (create model: 0.5s, apply weights to model: 4.3s, apply half(): 0.4s, calculate empty prompt: 0.1s). 1,1 0.2 Horizontal ** Error running process: F:\AI\sdxl\extensions\sd-webui-regional-prompter\scripts\rp.py Traceback (most recent call last): File "F:\AI\sdxl\modules\scripts.py", line 832, in process script.process(p, script_args) File "F:\AI\sdxl\extensions\sd-webui-regional-prompter\scripts\rp.py", line 507, in process unloadlorafowards(p) File "F:\AI\sdxl\extensions\sd-webui-regional-prompter\scripts\latent.py", line 574, in unloadlorafowards import lora ModuleNotFoundError: No module named 'lora'


0%| | 0/20 [00:00<?, ?it/s] Error completing request Arguments: ('task(omzq4o4qy4ijbr5)', <gradio.routes.Request object at 0x0000024602ACA560>, 'cat BREAK dog', '', [], 1, 1, 7, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 0, 20, 'DPM++ 2M', 'Automatic', False, '', 0.8, 3100819954, False, -1, 0, 0, 0, True, False, 'Matrix', 'Columns', 'Mask', 'Prompt', '1,1', '0.2', False, False, False, 'Attention', ['F', 'a', 'l', 's', 'e'], '0', '0', '0.4', None, '0', '0', False, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False, [], 30, '', 4, [], 1, '', '', '', '') {} Traceback (most recent call last): File "F:\AI\sdxl\modules\call_queue.py", line 74, in f res = list(func(*args, kwargs)) File "F:\AI\sdxl\modules\call_queue.py", line 53, in f res = func(*args, *kwargs) File "F:\AI\sdxl\modules\call_queue.py", line 37, in f res = func(args, kwargs) File "F:\AI\sdxl\modules\txt2img.py", line 109, in txt2img processed = processing.process_images(p) File "F:\AI\sdxl\modules\processing.py", line 847, in process_images res = process_images_inner(p) File "F:\AI\sdxl\modules\processing.py", line 988, in process_images_inner samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts) File "F:\AI\sdxl\modules\processing.py", line 1346, in sample samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x)) File "F:\AI\sdxl\modules\sd_samplers_kdiffusion.py", line 230, in sample samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, extra_params_kwargs)) File "F:\AI\sdxl\modules\sd_samplers_common.py", line 272, in launch_sampling return func() File "F:\AI\sdxl\modules\sd_samplers_kdiffusion.py", line 230, in samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, extra_params_kwargs)) File "F:\AI\sdxl\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(*args, kwargs) File "F:\AI\sdxl\repositories\k-diffusion\k_diffusion\sampling.py", line 594, in sample_dpmpp_2m denoised = model(x, sigmas[i] * s_in, *extra_args) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, kwargs) File "F:\AI\sdxl\modules\sd_samplers_cfg_denoiser.py", line 268, in forward x_out[a:b] = self.inner_model(x_in[a:b], sigma_in[a:b], cond=make_condition_dict(c_crossattn, image_cond_in[a:b])) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(args, kwargs) File "F:\AI\sdxl\repositories\k-diffusion\k_diffusion\external.py", line 112, in forward eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), kwargs) File "F:\AI\sdxl\repositories\k-diffusion\k_diffusion\external.py", line 138, in get_eps return self.inner_model.apply_model(*args, *kwargs) File "F:\AI\sdxl\modules\sd_hijack_utils.py", line 22, in setattr(resolved_obj, func_path[-1], lambda args, kwargs: self(*args, kwargs)) File "F:\AI\sdxl\modules\sd_hijack_utils.py", line 34, in call return self.__sub_func(self.__orig_func, args, kwargs) File "F:\AI\sdxl\modules\sd_hijack_unet.py", line 50, in apply_model result = orig_func(self, x_noisy.to(devices.dtype_unet), t.to(devices.dtype_unet), cond, kwargs) File "F:\AI\sdxl\modules\sd_hijack_utils.py", line 22, in setattr(resolved_obj, func_path[-1], lambda args, kwargs: self(*args, kwargs)) File "F:\AI\sdxl\modules\sd_hijack_utils.py", line 36, in call return self.__orig_func(args, kwargs) File "F:\AI\sdxl\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 858, in apply_model x_recon = self.model(x_noisy, t, cond) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1568, in _call_impl result = forward_call(*args, kwargs) File "F:\AI\sdxl\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 1335, in forward out = self.diffusion_model(x, t, context=cc) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(args, kwargs) File "F:\AI\sdxl\modules\sd_unet.py", line 91, in UNetModel_forward return original_forward(self, x, timesteps, context, *args, kwargs) File "F:\AI\sdxl\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\openaimodel.py", line 797, in forward h = module(h, emb, context) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(args, kwargs) File "F:\AI\sdxl\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\openaimodel.py", line 84, in forward x = layer(x, context) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "F:\AI\sdxl\modules\sd_hijack_utils.py", line 22, in setattr(resolved_obj, func_path[-1], lambda args, kwargs: self(*args, kwargs)) File "F:\AI\sdxl\modules\sd_hijack_utils.py", line 34, in call return self.__sub_func(self.__orig_func, *args, *kwargs) File "F:\AI\sdxl\modules\sd_hijack_unet.py", line 96, in spatial_transformer_forward x = block(x, context=context[i]) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, kwargs) File "F:\AI\sdxl\repositories\stable-diffusion-stability-ai\ldm\modules\attention.py", line 269, in forward return checkpoint(self._forward, (x, context), self.parameters(), self.checkpoint) File "F:\AI\sdxl\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\util.py", line 123, in checkpoint return func(inputs) File "F:\AI\sdxl\repositories\stable-diffusion-stability-ai\ldm\modules\attention.py", line 273, in _forward x = self.attn2(self.norm2(x), context=context) + x File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "F:\AI\sdxl\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) File "F:\AI\sdxl\extensions\sd-webui-regional-prompter\scripts\attention.py", line 409, in forward ox = matsepcalc(x, contexts, mask, True, 1) File "F:\AI\sdxl\extensions\sd-webui-regional-prompter\scripts\attention.py", line 152, in matsepcalc tll = self.pt if pn else self.nt AttributeError: 'Script' object has no attribute 'pt' `

Environment Web-UI version: 1.10.1 Regional Prompter version: 2024-05-26 13:54:15 (4802fac) SD Version: LoRA/LoCon/LoHa None

Other Enabled Extensions None

titlestad commented 1 month ago

... File "/media/xxx/Projects/stable-diffusion-webui-forge/extensions/sd-forge-regional-prompter/scripts/attention.py", line 420, in forward ox = matsepcalc(x, contexts, mask, True, 1) File "/media/xxx/Projects/stable-diffusion-webui-forge/extensions/sd-forge-regional-prompter/scripts/attention.py", line 163, in matsepcalc tll = self.pt if pn else self.nt AttributeError: 'Script' object has no attribute 'pt' 'Script' object has no attribute 'pt'

sjwk commented 1 month ago

I'd closed my bug report as it was down to brain failure rather than a bug. I realised that I had inadvertently disabled all the extensions except for regional prompter (ie, including Lora) when I thought I was just deselecting them for checking for updates. Re-enabled them all and all was working again. I should have left a note rather than just quietly close the issue.