ModuleNotFoundError: No module named 'ldm' (webui regional prompter)
*** Error loading script: attention.py
Traceback (most recent call last):
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\modules\scripts.py", line 525, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\modules\script_loading.py", line 13, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\extensions\sd-webui-regional-prompter\scripts\attention.py", line 3, in <module>
import ldm.modules.attention as atm
ModuleNotFoundError: No module named 'ldm'
---
*** Error loading script: latent.py
Traceback (most recent call last):
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\modules\scripts.py", line 525, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\modules\script_loading.py", line 13, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\extensions\sd-webui-regional-prompter\scripts\latent.py", line 11, in <module>
import scripts.attention as att
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\extensions\sd-webui-regional-prompter\scripts\attention.py", line 3, in <module>
import ldm.modules.attention as atm
ModuleNotFoundError: No module named 'ldm'
---
*** Error loading script: rp.py
Traceback (most recent call last):
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\modules\scripts.py", line 525, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\modules\script_loading.py", line 13, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\extensions\sd-webui-regional-prompter\scripts\rp.py", line 15, in <module>
import scripts.attention
File "C:\Users\ZeroCool22\Desktop\webui_forge\webui\extensions\sd-webui-regional-prompter\scripts\attention.py", line 3, in <module>
import ldm.modules.attention as atm
ModuleNotFoundError: No module named 'ldm'
---
https://github.com/hako-mikan/sd-webui-regional-prompter
Who need to make it compatible to works with the new Forge, the autor of the extension or you?
Thx.
In my experience, Regional Prompter has been buggy with Forge for ages unfortunately, it keeps merging the regions
I solved this by installing ldm The process is not simple and it requires downloading packages. Here is how I went:
Move to forge directory or for Windows open CMD in the forge root folder (where you see run.bat, environment.bat, system, webui etc.
cd /path/to/forge
Forge doesn't use venv but its own local python tree. To have this work instead of activating venv, run environment.bat from the console:
environment.bat
This should finish without any output.
Now you have the environment set up and you can install ldm. While still in forge root folder, run
git clone https://github.com/CompVis/stable-diffusion.git
cd to the cloned directory (yes it's confusingly just called "stable-diffusion"
cd stable-diffusion
Use the python that comes with forge to install the module.
/path/to/forge/system/python/python -m pip install -e .
Test if the module was installed
/path/to/forge/system/python/python -c "import ldm"
This should not produce any output which means ldm was installed.
Now restart forge and hope that the error is gone.
Note: I did not check yet if further errors with the extension happen. I just see the extension in my WebUI after this process.
I solved this by installing ldm The process is not simple and it requires downloading packages. Here is how I went:
Move to forge directory or for Windows open CMD in the forge root folder (where you see run.bat, environment.bat, system, webui etc.
cd /path/to/forgeForge doesn't use venv but its own local python tree. To have this work instead of activating venv, run environment.bat from the console:
environment.batThis should finish without any output.
Now you have the environment set up and you can install ldm. While still in forge root folder, run
git clone https://github.com/CompVis/stable-diffusion.gitcd to the cloned directory (yes it's confusingly just called "stable-diffusion"
cd stable-diffusionUse the python that comes with forge to install the module.
/path/to/forge/system/python/python -m pip install -e .Test if the module was installed
/path/to/forge/system/python/python -c "import ldm"This should not produce any output which means ldm was installed.
Now restart forge and hope that the error is gone.
Note: I did not check yet if further errors with the extension happen. I just see the extension in my WebUI after this process.
Tried this manual install before, it loads the extension in the gui and appears to work, but it won't actually work. Errors galore once you try to use it.
Yes, there is an issue in StableDiffusionModelHijack, where in A1111 has a embedding_db attribute, the class in Forge does not. So the issue is caused by Forge changing the class.
Edit: I just saw, the class is completely disabled in Forge. It only consists of pass for all methods. I don't know why Forge decided to cripple the class completely, maybe it caused issues at another place.
Without this class, there is probably no chance to get it running at all in current Forge versions. Regional-prompter wasn't updated in 4 months, I don't know if the project is even still active.
shows up but still getting this error myself *** Error running process: C:\webforge\webui\extensions\sd-webui-regional-prompter\scripts\rp.py Traceback (most recent call last): File "C:\webforge\webui\modules\scripts.py", line 844, in process script.process(p, *script_args) File "C:\webforge\webui\extensions\sd-webui-regional-prompter\scripts\rp.py", line 502, in process self.handle = hook_forwards(self, p.sd_model.model.diffusion_model) AttributeError: 'StableDiffusionXL' object has no attribute 'model'
On Sat, Sep 7, 2024 at 12:03 PM maniac-0s @.***> wrote:
Yes, there is an issue in StableDiffusionModelHijack, where in A1111 has a embedding_db attribute, the class in Forge does not. So the issue is caused by Forge changing the class.
— Reply to this email directly, view it on GitHub https://github.com/lllyasviel/stable-diffusion-webui-forge/issues/1407#issuecomment-2336407691, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHN7U7ZK77QB2353XM6STLDZVNEXJAVCNFSM6AAAAABM6MXY42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZWGQYDONRZGE . You are receiving this because you are subscribed to this thread.Message ID: @.*** .com>
Yes due to changes in one or more classes (I got another error after tinkering with it a little more yesterday) regional-prompter can't be used at all in Forge.
Really hope this one gets fixed
On Sun, Sep 8, 2024, 12:46 PM maniac-0s @.***> wrote:
Yes due to changes in one or more classes (I got another error after tinkering with it a little more yesterday) regional-prompter can't be used at all in Forge.
— Reply to this email directly, view it on GitHub https://github.com/lllyasviel/stable-diffusion-webui-forge/issues/1407#issuecomment-2336802634, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHN7U7443FJLYGJG5U66E4DZVSSSHAVCNFSM6AAAAABM6MXY42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZWHAYDENRTGQ . You are receiving this because you commented.Message ID: @.*** com>
I don't have much hopes for that. Regional prompter hasn't seen a commit in 4 months and I guess Forge had some reason to disable whole classes, replacing all the methods with pass (means "do nothing") and remove all attributes. Although the previous code was commented out and not deleted, maybe there was plan to rework the code again sometimes later but who knows...
I don't have much hopes for that. Regional prompter hasn't seen a commit in 4 months and I guess Forge had some reason to disable whole classes, replacing all the methods with
pass(means "do nothing") and remove all attributes. Although the previous code was commented out and not deleted, maybe there was plan to rework the code again sometimes later but who knows...
Most people are switching to https://github.com/Haoming02/sd-forge-couple as a replacement. The dev is very friendly and active too.
I don't have much hopes for that. Regional prompter hasn't seen a commit in 4 months and I guess Forge had some reason to disable whole classes, replacing all the methods with
pass(means "do nothing") and remove all attributes. Although the previous code was commented out and not deleted, maybe there was plan to rework the code again sometimes later but who knows...Most people are switching to https://github.com/Haoming02/sd-forge-couple as a replacement. The dev is very friendly and active too.
Thanks for the hint. Works pretty well most of the time and is actually simpler to use then RP or LC.