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

Error loading script: dynamic_prompting.py #146

Closed
Harvester62 opened this issue Jan 1, 2023 · 21 comments
Closed

Error loading script: dynamic_prompting.py #146

Harvester62 opened this issue Jan 1, 2023 · 21 comments

Comments

@Harvester62
Copy link

Describe the bug
After latest update, at webui-user.bat start-up the script cannot be loaded and therefore is unavailable in the Web UI.
Current hash: 311354c0bb8930ea939d6aa6b3edd50c69301320

To Reproduce
Start webui-user.bat and check the console error messages. The following is displayed:

Error loading script: dynamic_prompting.py
Traceback (most recent call last):
File "C:\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\import_utils.py", line 1093, in get_module
return importlib.import_module("." + module_name, self.name)
File "C:\Program Files\Python310\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in find_and_load_unlocked
File "", line 688, in load_unlocked
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\stable-diffusion-webui\venv\lib\site-packages\transformers\pipelines_init
.py", line 64, in
from .document_question_answering import DocumentQuestionAnsweringPipeline
File "C:\stable-diffusion-webui\venv\lib\site-packages\transformers\pipelines\document_question_answering.py", line 29, in
from .question_answering import select_starts_ends
File "C:\stable-diffusion-webui\venv\lib\site-packages\transformers\pipelines\question_answering.py", line 8, in
from ..data import SquadExample, SquadFeatures, squad_convert_examples_to_features
File "C:\stable-diffusion-webui\venv\lib\site-packages\transformers\data_init
.py", line 31, in
from .processors import (
File "C:\stable-diffusion-webui\venv\lib\site-packages\transformers\data\processors_init.py", line 19, in
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
File "C:\stable-diffusion-webui\venv\lib\site-packages\transformers\data\processors\glue.py", line 79, in
examples: tf.data.Dataset,
AttributeError: module 'tensorflow' has no attribute 'data'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\stable-diffusion-webui\modules\scripts.py", line 195, in load_scripts
module = script_loading.load_module(scriptfile.path)
File "C:\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
exec(compiled, module.dict)
File "C:\stable-diffusion-webui\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py", line 16, in
from prompts.generators import (
File "C:\stable-diffusion-webui\extensions\sd-dynamic-prompts\prompts\generators_init_.py", line 12, in
from .magicprompt import MagicPromptGenerator
File "C:\stable-diffusion-webui\extensions\sd-dynamic-prompts\prompts\generators\magicprompt.py", line 9, in
from transformers import pipeline
File "", line 1075, in _handle_fromlist
File "C:\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\import_utils.py", line 1083, in getattr
module = self._get_module(self._class_to_module[name])
File "C:\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\import_utils.py", line 1095, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.pipelines because of the following error (look up to see its traceback):
module 'tensorflow' has no attribute 'data'

Also mention which checkboxes have been set. None, because Dynamic Prompts is not available in the Web UI.

Expected behaviour
I worked fine until yesterday.

Additional context
Also the Wildcards Manager is not being loaded, activated and therefore unavailable in the Web UI.
Startup arguments: --xformers --opt-split-attention --disable-safe-unpickle --api --deepdanbooru --allow-code --administrator --medvram --ckptfix --theme dark --cors-allow-origins=http://localhost:5173,https://www.painthua.com

@adieyal
Copy link
Owner

adieyal commented Jan 1, 2023

This looks like it's related to the transformers library which is installed by auto1111 - do you recall any library upgrades recently. Could you tell me what the output of this command is:

python -c "import transformers;print(transformers.__version__)"

@Harvester62
Copy link
Author

Possibly an updated occurred on Dec. 24 because this is the date of the folder and files for the transformers library. The version currently installed is 4.25.1.

@LuinDe
Copy link

LuinDe commented Jan 2, 2023

I have the same problem.
Error loading script: dynamic_prompting.py
Traceback (most recent call last):
File "D:\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\import_utils.py", line 1093, in get_module
return importlib.import_module("." + module_name, self.name)
File "C:\Users\Membrane\AppData\Local\Programs\Python\Python310\lib\importlib_init
.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in find_and_load_unlocked
File "", line 688, in load_unlocked
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "D:\stable-diffusion-webui\venv\lib\site-packages\transformers\pipelines_init
.py", line 64, in
from .document_question_answering import DocumentQuestionAnsweringPipeline
File "D:\stable-diffusion-webui\venv\lib\site-packages\transformers\pipelines\document_question_answering.py", line 29, in
from .question_answering import select_starts_ends
File "D:\stable-diffusion-webui\venv\lib\site-packages\transformers\pipelines\question_answering.py", line 8, in
from ..data import SquadExample, SquadFeatures, squad_convert_examples_to_features
File "D:\stable-diffusion-webui\venv\lib\site-packages\transformers\data_init
.py", line 31, in
from .processors import (
File "D:\stable-diffusion-webui\venv\lib\site-packages\transformers\data\processors_init.py", line 19, in from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
File "D:\stable-diffusion-webui\venv\lib\site-packages\transformers\data\processors\glue.py", line 79, in
examples: tf.data.Dataset,
AttributeError: module 'tensorflow' has no attribute 'data'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\stable-diffusion-webui\modules\scripts.py", line 195, in load_scripts
module = script_loading.load_module(scriptfile.path)
File "D:\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
exec(compiled, module.dict)
File "D:\stable-diffusion-webui\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py", line 16, in
from prompts.generators import (
File "D:\stable-diffusion-webui\extensions\sd-dynamic-prompts\prompts\generators_init_.py", line 12, in
from .magicprompt import MagicPromptGenerator
File "D:\stable-diffusion-webui\extensions\sd-dynamic-prompts\prompts\generators\magicprompt.py", line 9, in
from transformers import pipeline
File "", line 1075, in _handle_fromlist
File "D:\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\import_utils.py", line 1083, in getattr
module = self._get_module(self._class_to_module[name])
File "D:\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\import_utils.py", line 1095, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.pipelines because of the following error (look up to see its traceback):
module 'tensorflow' has no attribute 'data'

tensorflow 2.11.0
transformers 4.25.1

@adieyal
Copy link
Owner

adieyal commented Jan 2, 2023

tbh - I'm stumped - none of the changes made should have affected it. To be sure, could you please try an older version of Dynamic Prompts? The easiest way to do that is in the terminal, navigate to extensions/sd-dynamic-prompting and type git checkout v1.4.4

v1.4.4 is the version before the big release that might be causing the issue.

@Harvester62
Copy link
Author

I switched version to 1.4.4

immagine

but I still get the same error messages:

immagine

@LuinDe
Copy link

LuinDe commented Jan 2, 2023

git checkout v1.4.4
Doing it that way solved the problem.

@adieyal
Copy link
Owner

adieyal commented Jan 2, 2023

I have created a temporary branch which detects a failure in Magic Prompt and disables it so that you can still use the extension. To use it do the following from the sd-dynamic-prompts directory

git pull -a
git checkout origin/chore/catch-importerror

Let know if that works for you.

@Harvester62
Copy link
Author

Harvester62 commented Jan 2, 2023

I fear that the issue is more on the SD Web UI side than yours. I opened a bug report: AUTOMATIC1111/stable-diffusion-webui#6212
I deactivated all Extensions but Image Gallery, restarted Web UI, tried to generate an image, got the wall of errors, then activated the Dynamic Prompts Extension and restarted Gradio (all these after I followed your above instructions, of course), and these are the messages in the console (after those reported to A111):

immagine

@Harvester62
Copy link
Author

With that branch, despite the error with the Magic prompt generator, the Dynamic Prompts extension is active in the Web UI, as well as the Wildcards Manager. This will allow me to continue to work on the localization. Unfortunately, I cannot generate any image because of the tensorflow error, which I look for to be resolved soon by the developers, also because it seems that at least another user is experiencing this problem. I will keep you informed of any developments, and thank you for this temporary fix.

@Topru333
Copy link

Topru333 commented Jan 2, 2023

I have come to see if it's only me, but as comments in thread, i'm not alone with this problem. I have the same errors even after
git checkout origin/chore/catch-importerror

@Harvester62
Copy link
Author

Now the problem is getting even worst, with Gradio restarting and becoming unresponsive. I cannot even deactivate the extensions now because the UI is stuck. Hopefully the developers will notice this and fix it soon. The application is now unusable. This things happens sometimes.

@adieyal
Copy link
Owner

adieyal commented Jan 2, 2023

I have come to see if it's only me, but as comments in thread, i'm not alone with this problem. I have the same errors even after
git checkout origin/chore/catch-importerror

Is it exactly the same error? Could you please post a screenshot? From what @Harvester62 says, it looks like it's related to auto1111 but I want to keep an eye on this.

@Topru333
Copy link

Topru333 commented Jan 2, 2023

Fixed it after tensorrt update, had similar messages in the log,
https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html
this guide helped

But still have issue with wildcard and auto-tag conflict

@Harvester62
Copy link
Author

Too much of a complicated process, furthermore several other users are facing the same issue which definitely requires the intervention of a developer, possibly the code owner Automatic1111. For the moment I am putting SD Web UI on hold.

@adieyal
Copy link
Owner

adieyal commented Jan 8, 2023

Is this still an issue?

@Harvester62
Copy link
Author

I resolved that issue simply deleting the venv and rebuilding it, but with the several changes made to the Gradio UI and layout, I cannot exclude future issues. For me, this bug report can be closed.
Just one thing I've noticed, but perhaps it's caused by the Diffusion Defender or other extension, is that some times, with all the extensions enabled, despite the prompt given, the image generated is that of a donkey, yes, a donkey, and somewhere in the console (but, as I said, possibly due to others extensions) the donkey prompts was indicated as a debug prompt by some extension. Is it yours? I previously had switched to the Magic Prompt debug branch, now I am back to the main branch of your extension. Let me know, thank you.

@Omenizer
Copy link

Omenizer commented Jan 9, 2023

I'm running Auto1111/ thelastBen colab, and I deleted the whole sd folder and got everything fresh, and now I can't run dynamic prompt
image

Is this the same issue as above?

@adieyal
Copy link
Owner

adieyal commented Jan 9, 2023

No - I don't think that's related. Your problem is documented here: https://github.com/adieyal/sd-dynamic-prompts/#troubleshooting

@adieyal
Copy link
Owner

adieyal commented Jan 9, 2023

@Harvester62 I don't think the debug Donkey is mine :)

@adieyal adieyal closed this as completed Jan 9, 2023
@Harvester62
Copy link
Author

Thank you @adieyal .

@ZoranSpirkovski
Copy link

Sorry to reopen this, but I recently faced the same issue and it was caused by a new extension I had active, which was SD-CN-Animation. No idea why it caused this, but after it was disabled, wildcards started working correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants