DominikDoom / a1111-sd-webui-tagcomplete

Booru style tag autocompletion for AUTOMATIC1111's Stable Diffusion web UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tag frequency database error - "module scripts.tag_frequency_db not in sys.modules"

ErickFRL opened this issue · comments

error keeps coming up, I don't know much about how this works

ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 69, in call
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 273, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 122, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 184, in call
raise exc
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 162, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py", line 92, in call
await self.simple_response(scope, receive, send, request_headers=headers)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py", line 147, in simple_response
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/gzip.py", line 24, in call
await responder(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/gzip.py", line 44, in call
await self.app(scope, receive, self.send_with_gzip)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 79, in call
raise exc
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 21, in call
raise e
File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 718, in call
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 237, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
File "/content/stable-diffusion-webui/extensions/tagcomplete/scripts/tag_autocomplete_helper.py", line 805, in get_use_count_list
count_list = list(db.get_tag_counts(body.tagNames, body.tagTypes, body.neg, date_limit))
AttributeError: 'NoneType' object has no attribute 'get_tag_counts'

Does this still happen on the newest version? I published another possibly related fix a few minutes ago.
Also, please open your browser console (CTRL+SHIFT+I) and see if any errors are logged there after starting the webui or while you type a prompt.

When restarting the webui, is there any error is visible in the terminal directly at the start (before you type anything)?
Since it is likely related to the database not being correctly initialized. That should log a more helpful error message there.

Also, are you running this on a shared instance or colab?

When I restart I get this, I'm running everything in colab
imagen_2024-04-13_125010158

I can't really test it myself since I don't have a paid colab plan and Google disallows the webui on the free tier, but I just released a fix that could maybe help based on my best guess. Please try again after updating and tell me if it worked.

When I start the interface everything works fine but it still gives me this message:
image

But when I restart the UI it stops working and I get this message:
image

The first one isn't an error, just info. So from a fresh start it seems to be fine.

The second one for restarting is pretty hard to solve, it seems like Colab has problems resolving the file path depending on where the script is running from.
Your working directory can be totally different depending on the Colab Notebook's and webui's setup, so it's hard to find a definitive solution.
It's strange though that my attempted fix works on a fresh start but not when restarting. Maybe it's an issue with execution order in that case.

I pushed another fix that will maybe work better for the restart case, please try again if you have time.
But even if that hasn't solved the issue, I have put additional safeguards in place to prevent the rest of the script from breaking. You can't use the new functionality though in that case, and it would still print a lot of API errors in the browser console. So if that annoys you, you can just turn the feature off by unchecking "Locally record tag usage and sort frequent tags higher" in the Tag Autocomplete options.

It is now resolved, it works fine both when starting the webui and when restarting, but warnings are still displayed in the console, etc.
But the only thing that matters is that it works, thanks.