Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: No module named 'LDSR' #1497

Closed
1 task done
smilerz opened this issue Oct 10, 2022 · 15 comments
Closed
1 task done

[Bug]: No module named 'LDSR' #1497

smilerz opened this issue Oct 10, 2022 · 15 comments
Labels
bug Something isn't working

Comments

@smilerz
Copy link

smilerz commented Oct 10, 2022

What happened?

After updating to commit 8f613bf I get the following error attempting to upscale in Image Lab (old UI, GoLatent mode).

I attempted to reclone latent-diffusion to /src/ and recopied project.yaml and model last.cpkt to /models/ldsr without success.

Version

0.0.1 (Default)

What browsers are you seeing the problem on?

Chrome, Microsoft Edge

Where are you running the webui?

Windows

Custom settings

No response

Relevant log output

Traceback (most recent call last):
  File "C:\xxxxx\Miniconda3\envs\ldm\lib\site-packages\gradio\routes.py", line 247, in run_predict
    output = await app.blocks.process_api(
  File "C:\xxxxx\Miniconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 641, in process_api
    predictions, duration = await self.call_function(fn_index, processed_input)
  File "C:\xxxxx\Miniconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 556, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\xxxxx\Miniconda3\envs\ldm\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\xxxxx\Miniconda3\envs\ldm\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Uxxxxx\Miniconda3\envs\ldm\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "scripts/webui.py", line 2288, in imgproc
    ModelLoader(['LDSR'],True,False) # Load used models
  File "scripts/webui.py", line 2337, in ModelLoader
    global_vars[m] = load_LDSR()
  File "scripts/webui.py", line 385, in load_LDSR
    from LDSR import LDSR
ModuleNotFoundError: No module named 'LDSR'

Code of Conduct

  • I agree to follow this project's Code of Conduct
@smilerz smilerz added the bug Something isn't working label Oct 10, 2022
@SharkyMoto
Copy link

I'm having this issue too, but unfortunately couldnt find a solution on my own

@kftX
Copy link

kftX commented Oct 12, 2022

Exact same error here, SD-GUI is fully up-to-date

Traceback (most recent call last):
File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\gradio\routes.py", line 247, in run_predict
output = await app.blocks.process_api(
File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 641, in process_api
predictions, duration = await self.call_function(fn_index, processed_input)
File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 556, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "scripts/webui.py", line 2233, in imgproc
ModelLoader(['LDSR'],True,False) # Load used models
File "scripts/webui.py", line 2337, in ModelLoader
global_vars[m] = load_LDSR()
File "scripts/webui.py", line 385, in load_LDSR
from LDSR import LDSR
ModuleNotFoundError: No module named 'LDSR'

@codedealer
Copy link
Collaborator

codedealer commented Oct 12, 2022

Two things to check:

  1. In the Model Manager in Streamlit interface check that LDSR is actually loaded; if it's not, the download button will show up.
  2. In the Settings the path to LDSR should point to the correct location listed in the Model Manager. If not, edit it manually or just reset the settings.

@smilerz
Copy link
Author

smilerz commented Oct 12, 2022

Two things to check:

  1. In the Model Manager in Streamlit interface check that LDSR is actually loaded; if it's not, the download button will show up.
  2. In the Settings the path to LDSR should point to the correct location listed in the Model Manager. If not, edit it manually or just reset the settings.

The model shows loaded in Streamlit. Also, when launching the gradio webui the console shows this:

Relauncher: Launching...
Found GFPGAN
Found RealESRGAN
Found LDSR

@codedealer
Copy link
Collaborator

the location for the LDSR model was changed in streamlit. It should be located in models/ldsr to be used there.

Gradio most likely uses the old path still which is in src/latent-diffusion/experiments... etc. You can test it by moving/symlinking the file there.

@smilerz
Copy link
Author

smilerz commented Oct 12, 2022

the location for the LDSR model was changed in streamlit. It should be located in models/ldsr to be used there.

Gradio most likely uses the old path still which is in src/latent-diffusion/experiments... etc. You can test it by moving/symlinking the file there.

I put it in both places to rule that out as the root cause.

@codedealer
Copy link
Collaborator

Judging from the code the models are in the right place (in the models folder) and I am unable to replicate this issue locally.

@kftX
Copy link

kftX commented Oct 14, 2022

the location for the LDSR model was changed in streamlit. It should be located in models/ldsr to be used there.
Gradio most likely uses the old path still which is in src/latent-diffusion/experiments... etc. You can test it by moving/symlinking the file there.

I put it in both places to rule that out as the root cause.

Can confirm I have the files in both places as well and the issue is there too. Also, just like this

the location for the LDSR model was changed in streamlit. It should be located in models/ldsr to be used there.

Gradio most likely uses the old path still which is in src/latent-diffusion/experiments... etc. You can test it by moving/symlinking the file there.

I can confirm that just like @smilerz I have the tested with files in both places, got the same error.

And just like him, when booting up SDGUI I also have:

Relauncher: Launching...
Found GFPGAN
Found RealESRGAN
Found LDSR

However I did notice that when running the upscaler, right before the error the command line logs:

Unloaded LDSR
Loaded GFPGAN
Unloaded Stable Diffusion
Unloaded GFPGAN

And then the error comes. I am using the gradio UI.

@codedealer
Copy link
Collaborator

Somebody post concrete steps to replicate this.

@smilerz
Copy link
Author

smilerz commented Oct 14, 2022

Somebody post concrete steps to replicate this.

  1. Launch webui.cmd without parameters.
  2. Navigate to Image Lab tab
  3. Select any image for source
  4. Select Upscale under Processor Selection
  5. Select GoLatent under Upscaler Selection, accept all other defaults
  6. Click Process
Relauncher: Launching...
Found GFPGAN
Found RealESRGAN
Found LDSR
Loading model from models/ldm/stable-diffusion-v1/model.ckpt
Global Step: 470000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Running on local URL:  http://localhost:7862/

To create a public link, set `share=True` in `launch()`.
Processing images...
Unloaded GFPGAN
Unloaded LDSR
Loaded RealESGAN
Couldn't find metadata on image
Couldn't find metadata on image
Couldn't find metadata on image
GoBig upscaling will process a total of 9 images tiled as 3x3 in a total of 9 batches.
[MemMon] Recording max memory usage...

Iteration: 1/1
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 16/16 [00:24<00:00,  1.56s/it]
[MemMon] Recording max memory usage...

[MemMon] Stopped recording.

Iteration: 1/1
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 16/16 [00:23<00:00,  1.50s/it]
[MemMon] Stopped recording.

[truncated]

scripts/webui.py:2106: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  mask_w = make_mask_image(np.arange(grid.overlap, dtype=np.float).reshape((1, grid.overlap)).repeat(grid.tile_h, axis=0))
scripts/webui.py:2107: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  mask_h = make_mask_image(np.arange(grid.overlap, dtype=np.float).reshape((grid.overlap, 1)).repeat(grid.image_w, axis=1))
[MemMon] Stopped recording.
Unloaded Stable Diffusion

Traceback (most recent call last):
  File "C:\Users\Chris\Miniconda3\envs\ldm\lib\site-packages\gradio\routes.py", line 247, in run_predict
    output = await app.blocks.process_api(
  File "C:\Users\Chris\Miniconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 641, in process_api
    predictions, duration = await self.call_function(fn_index, processed_input)
  File "C:\Users\Chris\Miniconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 556, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\Chris\Miniconda3\envs\ldm\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\Chris\Miniconda3\envs\ldm\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\Chris\Miniconda3\envs\ldm\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "scripts/webui.py", line 2288, in imgproc
    ModelLoader(['LDSR'],True,False) # Load used models
  File "scripts/webui.py", line 2337, in ModelLoader
    global_vars[m] = load_LDSR()
  File "scripts/webui.py", line 385, in load_LDSR
    from LDSR import LDSR
ModuleNotFoundError: No module named 'LDSR'

@kftX
Copy link

kftX commented Oct 14, 2022

Somebody post concrete steps to replicate this.

  1. Launch webui.cmd without parameters;
  2. Navigate to Image Lab tab;
  3. Select any image for source;
  4. Select Upscale under Processor Selection;
  5. Select Latent Diffusion SR under Upscaler Selection, accept all other defaults
  6. Click Process
Relauncher: Launching...
Found GFPGAN
Found RealESRGAN
Found LDSR
Loading model from models/ldm/stable-diffusion-v1/model.ckpt
Global Step: 470000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Running on local URL:  http://localhost:7860/

To create a public link, set `share=True` in `launch()`.
Processing images...
Unloaded Stable Diffusion
Unloaded GFPGAN
Traceback (most recent call last):
  File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\gradio\routes.py", line 247, in run_predict
    output = await app.blocks.process_api(
  File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 641, in process_api
    predictions, duration = await self.call_function(fn_index, processed_input)
  File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 556, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Tools\miniconda3\envs\ldm\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "scripts/webui.py", line 2233, in imgproc
    ModelLoader(['LDSR'],True,False) # Load used models
  File "scripts/webui.py", line 2337, in ModelLoader
    global_vars[m] = load_LDSR()
  File "scripts/webui.py", line 385, in load_LDSR
    from LDSR import LDSR
ModuleNotFoundError: No module named 'LDSR'

In my case, this was attempted on a completely fresh installation of SD-WebUI, after following the tutorial here. Before my previous install randomly broke, upscaling was working fine.

@ovasdi
Copy link

ovasdi commented Oct 15, 2022

Hi, same issue here. Getting ModuleNotFoundError: No module named 'LDSR' when in image lab (gradio ui) after trying to upscale using Latent Diffusion SR option, default settings.

I have latest changes on master. Fresh conda environment. LDSR models in both paths. Even followed this advice to checkout an earlier Merge commit. None have helped so far.

See #1497 (comment)

@codedealer
Copy link
Collaborator

It looks to be related to the updated requirements.txt file which fails to install LDSR correctly.

@ovasdi
Copy link

ovasdi commented Oct 19, 2022

Hi, same issue here. Getting ModuleNotFoundError: No module named 'LDSR' when in image lab (gradio ui) after trying to upscale using Latent Diffusion SR option, default settings.

I have latest changes on master. Fresh conda environment. LDSR models in both paths. Even followed this advice to checkout an earlier Merge commit. None have helped so far.

Hi again, I wanted to give an update RE this advice which actually worked for me after I did the following:

  • open conda shell and cd into sd-webui directory
  • git checkout 72fb6ffe1fc76b668c822f7a2cc0934dc7bd08af
  • git checkout -b edit
  • edit webui.cmd commenting out L60-L74
  • make whatever other changes and commit
  • remove the conda environment (ldm or ldo or whatever): conda env remove --name ldo
    • to list environments: conda env list
  • remove z_version_env.tmp
  • execute webui.cmd

After it reinstalled the packages and all I was able to use Latent Diffusion SR, gradio iu.


RE: the issue itself. I dont have time to look right now but @codedealer is on to something, I think. This change may be related.

@smilerz
Copy link
Author

smilerz commented Oct 19, 2022

I can confirm that 96148e8 fixes my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants