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] Extension seems incompatible with TheLastBen's Colab webui instance #11

Open
if-ai opened this issue Dec 25, 2022 · 102 comments
Open
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation external There is some external dependency for this issue wontfix This will not be worked on

Comments

@if-ai
Copy link

if-ai commented Dec 25, 2022

Internal Server Error?

My guess is that is not yet implemented to run in colab notebooks but install flawlessly this thing looks great I wish I could use it inside colab too

@if-ai if-ai added the enhancement New feature or request label Dec 25, 2022
@seijihariki
Copy link
Collaborator

Hi, actually, it seems someone was able to run this on colab, although as an extension: #6 not sure how. @Lesteriax, did you use a publicly available notebook for stable diffusion webui?

@Lesteriax
Copy link

Lesteriax commented Dec 26, 2022

Hi @seijihariki, I'm actually using paperspace gradient notebook, not colab, my mistake sorry. The fix happened as follows:

I removed --gradio-debug (not sure where this would be found in other notebooks)
added --api in userbat
added --cors-allow-origins=https://1234567886.gradio.ap in userbat

I would basically launch the webui to get the link and then add it in userbat and refresh

@seijihariki
Copy link
Collaborator

Makes sense, thanks for your input! @jvoxel, would you be able to provide us the notebook you used for this error to crop up? Mostly to investigate the issue further.

@seijihariki
Copy link
Collaborator

A similar issue seems to have cropped up on another user of thelastben's colab.

As this seems to be extension related, will move this issue to the extension's repo and mark the other issue as duplicate.

@seijihariki seijihariki transferred this issue from zero01101/openOutpaint Dec 26, 2022
@seijihariki seijihariki added bug Something isn't working and removed enhancement New feature or request labels Dec 26, 2022
@seijihariki
Copy link
Collaborator

So, instructions for reproducing this bug were provided by @createperhaps on #10:

Describe the bug When I click the openoutpaint tab I see Internal Server Error. The log says "index.html does not exist" but it does.

To Reproduce I ran TheLastBen colab. I click the extensions tab and scroll to openOutpaint Click "install". Click "refresh GUI". Go to the openOutpaint tab. "internal server error" is displayed.

Expected behavior I expect to see the outpaint GUI.

Screenshots If applicable, add screenshots to help explain your problem.

The notebook seems to live at https://github.com/TheLastBen/fast-stable-diffusion. Will try to reproduce this later today.

I'm centralizing discussion on this problem in this issue here.

@createperhaps
Copy link

createperhaps commented Dec 26, 2022

Thanks @seijihariki, let me know if you have any questions if anything is unclear. I didn't try to reinstall all of Automatic/SD (given it is more widespread, I doubt that would fix it), though I did restart the collab instance and it didn't sort itself out.

I also tried to see if I could run the cor command and see if I could run it from https://zero01101.github.io/openOutpaint/ but I am not super familiar with Python.

@createperhaps
Copy link

TheLastBen offers two servers, I am using the gradio checkbox if that makes a difference.

@seijihariki seijihariki changed the title not compatible A1111 last ben colab? [bug] Extension seems incompatible with TheLastBen's Colab webui instance Dec 26, 2022
@seijihariki
Copy link
Collaborator

Is there a way for us to see the “Internal Server Error” you are getting? If you could help us with a screenshot, it would be great! I am currently testing here, but I guess I need to upload a model to gdrive...

@createperhaps
Copy link

createperhaps commented Dec 26, 2022

Hey Seiji, theLastBen actually downloads the model automatically, but sure.

Here is the log that I see in my colab while I wait, I will get a screenshot in a moment.

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/responses.py", line 331, in __call__
    stat_result = await anyio.to_thread.run_sync(os.stat, self.path)
  File "/usr/local/lib/python3.8/dist-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
FileNotFoundError: [Errno 2] No such file or directory: '/content/gdrive/.shortcut-targets-by-id/1eQNT1dJ_FuqEB3Q6vFiZpTVHuVFZ20dr/sd/stablediffusion/extensions/openOutpaint-webUI-extension/app/index.html'

During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 404, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/gzip.py", line 24, in __call__
    await responder(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/gzip.py", line 43, in __call__
    await self.app(scope, receive, self.send_with_gzip)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/exceptions.py", line 75, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/exceptions.py", line 64, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/usr/local/lib/python3.8/dist-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 680, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 275, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 68, in app
    await response(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/responses.py", line 334, in __call__
    raise RuntimeError(f"File at path {self.path} does not exist.")
RuntimeError: File at path /content/gdrive/.shortcut-targets-by-id/1eQNT1dJ_FuqEB3Q6vFiZpTVHuVFZ20dr/sd/stablediffusion/extensions/openOutpaint-webUI-extension/app/index.html does not exist.
ERROR:uvicorn.error:Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/responses.py", line 331, in __call__
    stat_result = await anyio.to_thread.run_sync(os.stat, self.path)
  File "/usr/local/lib/python3.8/dist-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
FileNotFoundError: [Errno 2] No such file or directory: '/content/gdrive/.shortcut-targets-by-id/1eQNT1dJ_FuqEB3Q6vFiZpTVHuVFZ20dr/sd/stablediffusion/extensions/openOutpaint-webUI-extension/app/index.html

@zero01101
Copy link
Owner

yeah, i was actually just trying this all myself; looks like it starts in the install script actually, it's not even finding launch.py??

Error running install.py for extension /content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/openOutpaint-webUI-extension.
Command: "/usr/bin/python3" "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/openOutpaint-webUI-extension/install.py"
Error code: 1
stdout: <empty>
stderr: Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/openOutpaint-webUI-extension/install.py", line 3, in <module>
    from launch import run
ModuleNotFoundError: No module named 'launch'

filesystem wonkiness? i honestly never use colabs so i have next to zero familiarity with them...

@createperhaps
Copy link

Just throwing out ideas here, but it looks like your script plugs into the API via the web. Given that Gradio generates a URL at runtime, can it plug in if there is no URL? I am assuming local automatic111 is a static link, but maybe not. Of course, that wouldn't explain why a local file cannot be found.

Anyway, back to the topic. I started running my colab again, I noticed the cell writes:

openOutpaint init

LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading weights [288ccaa5] from /content/gdrive/.shortcut-targets-by-id/1eQNT1dJ_FuqEB3Q6vFiZpTVHuVFZ20dr/sd/stable-diffusion-webui/models/Stable-diffusion/SF_EB_1.1_SD50_ema_vae.ckpt
Applying xformers cross attention optimization.
Model loaded.
Loaded a total of 0 textual inversion embeddings.
Embeddings: 
Running on local URL:  IP removed for privacy
Running on public URL: IP removed for privacy

The bottom link is the one that has been working for me. When I click it I get the error code I mentioned above, about the file not found.
The error code is pathetically not helpful, which is why I didn't include a screenshot in my original post. Refresh button repeats the error code I posted above.
image

@zero01101
Copy link
Owner

zero01101 commented Dec 26, 2022

just out of curiosity i tried installing the dreambooth and dreamartist extensions to the colab and got very similar failures

Error running install.py for extension /content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_dreambooth_extension.
Command: "/usr/bin/python3" "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_dreambooth_extension/install.py"
Error code: 1
stdout: <empty>
stderr: Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_dreambooth_extension/install.py", line 10, in <module>
    from launch import run
ModuleNotFoundError: No module named 'launch'
Closing server running on port: 7860
Reloading extensions
Reloading custom scripts
Error loading script: api.py
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 195, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, in load_module
    exec(compiled, module.__dict__)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_dreambooth_extension/scripts/api.py", line 10, in <module>
    from extensions.sd_dreambooth_extension.dreambooth.sd_to_diff import extract_checkpoint
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/sd_to_diff.py", line 36, in <module>
    from diffusers import (
ImportError: cannot import name 'HeunDiscreteScheduler' from 'diffusers' (/usr/local/lib/python3.8/dist-packages/diffusers/__init__.py)

Error loading script: main.py
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 195, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, in load_module
    exec(compiled, module.__dict__)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_dreambooth_extension/scripts/main.py", line 8, in <module>
    from extensions.sd_dreambooth_extension.dreambooth.sd_to_diff import extract_checkpoint
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/sd_to_diff.py", line 36, in <module>
    from diffusers import (
ImportError: cannot import name 'HeunDiscreteScheduler' from 'diffusers' (/usr/local/lib/python3.8/dist-packages/diffusers/__init__.py)

Reloading modules: modules.ui
Refreshing Model List
Restarting Gradio
Running on local URL:  http://127.0.0.1:7860/
Running on public URL: https://blahblahblah.gradio.app/

This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
Error running install.py for extension /content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/DreamArtist-sd-webui-extension.
Command: "/usr/bin/python3" "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/DreamArtist-sd-webui-extension/install.py"
Error code: 1
stdout: <empty>
stderr: Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/DreamArtist-sd-webui-extension/install.py", line 1, in <module>
    import launch
ModuleNotFoundError: No module named 'launch'

kinda wondering if this is more of a general extensions vs colab thing

@createperhaps
Copy link

Not sure, Tim. I am using aesthetic gradients successfully, web browser successfully, and Dynamic prompts. @zero01101 do you mind confirming if these 3 work for you? Just so we can see if we're on the same page?

@zero01101
Copy link
Owner

hah, google started yelling at me for going over my storage allotment so i kinda deleted my gdrive's SD and colab folders, let me spin those up again to check - assuming "web browser" is the image browser extension?

@createperhaps
Copy link

createperhaps commented Dec 26, 2022 via email

@seijihariki
Copy link
Collaborator

seijihariki commented Dec 26, 2022

From what you guys are describing we would only need to make our extension not have to run command line programs.

[Edit]
In this case, specifically, the git submodule pull

@seijihariki
Copy link
Collaborator

Also, yeah, I was using the wrong ipynb it seems.

@seijihariki
Copy link
Collaborator

Worst case, we can use a try catch to catch import exceptions and just run it using import os when it triggers for compatibility.

@createperhaps
Copy link

If space is an issue I can share my models folder with you. Sd itself is a few gb, but it would at least clear it up a bit.

@zero01101
Copy link
Owner

no worries on space, thanks though :)

dynamic prompts returned an error on install:

Error running install.py for extension /content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-dynamic-prompts.
Command: "/usr/bin/python3" "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-dynamic-prompts/install.py"
Error code: 1
stdout: <empty>
stderr: Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-dynamic-prompts/install.py", line 1, in <module>
    import launch
ModuleNotFoundError: No module named 'launch'

but otherwise does appear to run as expected... it's also the only one of the three with an install.py script whatsoever lol

Worst case, we can use a try catch to catch import exceptions and just run it using import os when it triggers for compatibility.

:badpokerface: uhhh i will take your word as gospel on that lol, i am still super noob re: all things python

seijihariki added a commit that referenced this issue Dec 27, 2022
Updates app reference

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
@seijihariki
Copy link
Collaborator

@createperhaps give this new version of the extension a try

@seijihariki
Copy link
Collaborator

seijihariki commented Dec 31, 2022

No problem! Glad to help! But the thing is... I didn't do anything; the repo also has not changed since a day ago ; )

This is an issue that would affect only people who updated the extension in the ~4 hour time window I was writing the cache busting code, as those were the commits replaced with the branch force push.

It seems it may also be transient, then! Still, the easiest and fastest way to get this fixed for now, if you have the problem, is to delete the extension altogether and reinstall it.

@createperhaps
Copy link

This is odd-I didn't update when the error hit me. I also actually had the issue, and noticed I was behind, I thought the update may have fixed my issue. Alas, it didn't.

@zero01101
Copy link
Owner

@zero01101, can you modify the install script to only fetch the main branch of the submodule? Preferably, actually, only origin/main HEAD.

...huh, so i thought that's specifically what

was doing; otherwise both install and main just run pretty much the same submodule update request :/ it's hugely likely i've missed the point however, i'm quite adept at that lol

@cerarslan
Copy link

Guys in the extension tab keep getting {"detail":"Not Found"} error. How can ı fix?

@seijihariki
Copy link
Collaborator

@cerarslan open devtools (F12) and run the following command:

console.debug(document.getElementById("openoutpaint-iframe").src)

If you copy-paste, the browser will not allow you to until you type whatever it is asking you to.

I recommend you just type it out. Post here an screenshot of the result

@cerarslan
Copy link

which platform ı have to use for devtools (F12) sir?

@createperhaps
Copy link

createperhaps commented Dec 31, 2022 via email

@zero01101
Copy link
Owner

@cerarslan devtools would just be in your web browser of choice, just push the f12 key on your keyboard. it's pretty universal between all of them. did you add the directory switch as shown in #11 (comment) ?

for what it's worth, i've just spun up my gdrive copy of the colab with openOutpaint as the only installed extension and i'm not able to reproduce neither the .githooks/precommit weirdness, nor the {detail:not found} issue - however i did just consider that i'm not using the most up-to-date colab version at this point if ben updated it...

@createperhaps
Copy link

createperhaps commented Dec 31, 2022 via email

@seijihariki
Copy link
Collaborator

@zero01101, can you modify the install script to only fetch the main branch of the submodule? Preferably, actually, only origin/main HEAD.

...huh, so i thought that's specifically what


was doing; otherwise both install and main just run pretty much the same submodule update request :/ it's hugely likely i've missed the point however, i'm quite adept at that lol

Maybe it is? I hadn't looked into the code more specifically when requesting that, so it may be that only people who have at some point checked out the testing branch are affected. From what I see from the command being run, it seems to indeed only fetch main head.

@createperhaps
Copy link

@zero01101, can you modify the install script to only fetch the main branch of the submodule? Preferably, actually, only origin/main HEAD.

...huh, so i thought that's specifically what

was doing; otherwise both install and main just run pretty much the same submodule update request :/ it's hugely likely i've missed the point however, i'm quite adept at that lol

Maybe it is? I hadn't looked into the code more specifically when requesting that, so it may be that only people who have at some point checked out the testing branch are affected. From what I see from the command being run, it seems to indeed only fetch main head.

Nay, I never got the test branch.

@seijihariki
Copy link
Collaborator

@zero01101 I noticed just now that we ended up not adding anything to the README regarding the colab fix... I think we should add something there.

@zero01101
Copy link
Owner

zero01101 commented Jan 6, 2023

ACK yeah that's probably a good idea, hold pls added now to both repos

@cerarslan
Copy link

cerarslan commented Jan 7, 2023

guys sorry to bother you again but in extension tab (openOutpaint) I get ' openOutpaint init
Submodule path 'app': checked out 'dbcd588e29270be325a7f419d966773e0d0fbc80'

and colab side display

openOutpaint init
Submodule path 'app': checked out 'dbcd588e29270be325a7f419d966773e0d0fbc80'

edit: When I just restart to ui, submodule path error is gone but I see still {"detail":"Not Found"} error on extension tab.

@seijihariki
Copy link
Collaborator

Try deleting the whole extension from gdrive and reinstalling via webui

@cerarslan
Copy link

Try deleting the whole extension from gdrive and reinstalling via webui

Not working this time sir :/

@seijihariki
Copy link
Collaborator

@cerarslan open devtools (F12) and run the following command:

console.debug(document.getElementById("openoutpaint-iframe").src)

If you copy-paste, the browser will not allow you to until you type whatever it is asking you to.

I recommend you just type it out. Post here an screenshot of the result

Can you try doing this?

@seijihariki
Copy link
Collaborator

And also, check if the %cd still is there. If you reloaded from thelastben's git it will have resetted.

@cerarslan
Copy link

cerarslan commented Jan 7, 2023

I always compare the latest version of TheLastBen with my own. Enable_API= TRUE and %cd check done. I also changed my lines in webui-user.bat and .sh to COMMANDLINE_ARGS="--api --cors-allow-origins=http://127.0.0.1:3456" this.

When I write on devtools(F12) to console.debug(document.getElementById("openoutpaint-iframe").src) I get syntax error I guess. Btw I didn't copy paste.

Adsız

@seijihariki
Copy link
Collaborator

seijihariki commented Jan 7, 2023

Oh, there are two ' in each side in yours. It must a single quote (') or a double quote (") in each side.

'' Is different from "

@cerarslan
Copy link

I did but I thnik I missed something :/

Adsız2

@seijihariki
Copy link
Collaborator

It's getelementbyid, you are missing the get

@cerarslan
Copy link

Okay, I'm really sorry about that. I pretty new around. Now:

Adsız3

@seijihariki
Copy link
Collaborator

Oh... Sorry, can you replace 'document' with 'gradioApp()'?

@cerarslan
Copy link

cerarslan commented Jan 7, 2023

I'm sorry I made mistakes all the time because I wanted to be fast for you. Here is the last one:

asdasdpng

@seijihariki
Copy link
Collaborator

No issues whatsoever, it was my mistake after all. Hm... I will be offline for some hours here... For now, an undefined src is an issue that I did not expect. Can you do it again but without .src?

Also, I may ask you to join our discord for more help afterwards.

@cerarslan
Copy link

Without src same issue. I'm posting it here to verify. Also, I'd love to help!
asdsadasdasd

@seijihariki
Copy link
Collaborator

Okay... If the iframe does not exist whatsoever we have a bigger problem in our hands.

@cerarslan, can you enter in this discord?
https://discord.gg/bYS3fy6G

@cerarslan
Copy link

Oww, this is sad :/ . I'm in discord buddy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation external There is some external dependency for this issue wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

6 participants