what should I do? ->Older versions of gradio may not work ( issubclass() arg 1 must be a class) ? #5

Closed
opened 2023-07-30 18:28:15 +02:00 by NongZen · 20 comments
NongZen commented 2023-07-30 18:28:15 +02:00 (Migrated from github.com)

Error executing callback ui_tabs_callback for C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py
Traceback (most recent call last):
File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\modules\script_callbacks.py", line 134, in ui_tabs_callback
res += c.callback() or []
File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\extensions\sd-webui-faceswaplab\scripts\faceswaplab_ui\faceswaplab_tab.py", line 454, in on_ui_tabs
tools_ui()
File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\extensions\sd-webui-faceswaplab\scripts\faceswaplab_ui\faceswaplab_tab.py", line 433, in tools_ui
extract_btn.click(
File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\venv\lib\site-packages\gradio\events.py", line 132, in call
dep, dep_index = self.trigger.set_event_trigger(
File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\venv\lib\site-packages\gradio\blocks.py", line 217, in set_event_trigger
check_function_inputs_match(fn, inputs, inputs_as_dict)
File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\venv\lib\site-packages\gradio\utils.py", line 869, in check_function_inputs_match
if not is_special_typed_parameter(name):
File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\venv\lib\site-packages\gradio\utils.py", line 858, in is_special_typed_parameter
is_event_data = issubclass(parameter_types.get(name, int), EventData)
TypeError: issubclass() arg 1 must be a class

Error executing callback ui_tabs_callback for C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py Traceback (most recent call last): File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\modules\script_callbacks.py", line 134, in ui_tabs_callback res += c.callback() or [] File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\extensions\sd-webui-faceswaplab\scripts\faceswaplab_ui\faceswaplab_tab.py", line 454, in on_ui_tabs tools_ui() File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\extensions\sd-webui-faceswaplab\scripts\faceswaplab_ui\faceswaplab_tab.py", line 433, in tools_ui extract_btn.click( File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\venv\lib\site-packages\gradio\events.py", line 132, in __call__ dep, dep_index = self.trigger.set_event_trigger( File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\venv\lib\site-packages\gradio\blocks.py", line 217, in set_event_trigger check_function_inputs_match(fn, inputs, inputs_as_dict) File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\venv\lib\site-packages\gradio\utils.py", line 869, in check_function_inputs_match if not is_special_typed_parameter(name): File "C:\picture\Ai\app\stable-diffusion-webui\stable-diffusion-webui-9523\venv\lib\site-packages\gradio\utils.py", line 858, in is_special_typed_parameter is_event_data = issubclass(parameter_types.get(name, int), EventData) TypeError: issubclass() arg 1 must be a class
VitaliyS commented 2023-08-01 14:30:11 +02:00 (Migrated from github.com)

I got the same error. Could this be due to using an older version of A1111? My A1111 is from Apr, 26. All other extensions are disabled

I got the same error. Could this be due to using an older version of A1111? My A1111 is from Apr, 26. All other extensions are disabled
glucauze commented 2023-08-01 15:32:51 +02:00 (Migrated from github.com)

Yes this could be it. I am using a1111 1.5.1 right now. I'm not sure about older versions. In any case, it looks like a gradio problem.

If I have more information about what you're trying to do and when the bug happens, I can try looking.

Yes this could be it. I am using a1111 1.5.1 right now. I'm not sure about older versions. In any case, it looks like a gradio problem. If I have more information about what you're trying to do and when the bug happens, I can try looking.
VitaliyS commented 2023-08-01 15:41:24 +02:00 (Migrated from github.com)

This happens immediately upon start. Faceswaplab can't create a tab. Everything else works
image

This happens immediately upon start. Faceswaplab can't create a tab. Everything else works ![image](https://github.com/glucauze/sd-webui-faceswaplab/assets/1282704/3f07a66a-73d7-4daf-99ac-89404e7f01a9)
VitaliyS commented 2023-08-01 15:43:14 +02:00 (Migrated from github.com)

I tried downgrading and upgrading the Gradio version. It didn't help me

I tried downgrading and upgrading the Gradio version. It didn't help me
glucauze commented 2023-08-01 16:46:47 +02:00 (Migrated from github.com)

Ok, i will try to investigate further. Thanks for trying.

Sometimes the problem comes from the ui-config.json file at the root of sd, which is not properly updated. In this case, you need to rename it (and restart) so that it can be rebuilt and see if it works better.

This might to be related to that : https://github.com/gradio-app/gradio/issues/3514

What version of python are you using ? Currently i have :
•  version: [v1.5.1]
•  python: 3.11.3  
•  torch: 2.0.1+cu118  
•  xformers: 0.0.20  
•  gradio: 3.32.0  

Note that using python 3.11 is a bad idea (but i am doing it for test purposes).

Ok, i will try to investigate further. Thanks for trying. Sometimes the problem comes from the ui-config.json file at the root of sd, which is not properly updated. In this case, you need to rename it (and restart) so that it can be rebuilt and see if it works better. This might to be related to that : https://github.com/gradio-app/gradio/issues/3514 What version of python are you using ? Currently i have : •  version: [v1.5.1] •  python: 3.11.3   •  torch: 2.0.1+cu118   •  xformers: 0.0.20   •  gradio: 3.32.0   Note that using python 3.11 is a bad idea (but i am doing it for test purposes).
VitaliyS commented 2023-08-01 17:11:02 +02:00 (Migrated from github.com)

Deleting ui-config.json did not help. The default ui-config.json has the same problem.

I have :
•  A1111 commit: 7ea5be3e
•  python: 3.10.6  
•  torch: 1.13.1+cu117  
•  xformers: 0.0.16rc425 
•  gradio: 3.23.0 (but I tried upgrading to 3.32.0)

I use the old version because torch2 doesn't work well for me. My video card is weak and works better with torch1

Deleting ui-config.json did not help. The default ui-config.json has the same problem. I have : •  A1111 commit: 7ea5be3e •  python: 3.10.6   •  torch: 1.13.1+cu117   •  xformers: 0.0.16rc425  •  gradio: 3.23.0 (but I tried upgrading to 3.32.0) I use the old version because torch2 doesn't work well for me. My video card is weak and works better with torch1
glucauze commented 2023-08-01 17:31:07 +02:00 (Migrated from github.com)

I don't think it comes from torch. But it could comes from gradio :/ Will see if next versions still has this problem.

I don't think it comes from torch. But it could comes from gradio :/ Will see if next versions still has this problem.
VitaliyS commented 2023-08-01 17:41:07 +02:00 (Migrated from github.com)

I just installed the program from scratch

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

cd .\stable-diffusion-webui\

Switch to old version

git checkout 7ea5be3e

Installed Faceswaplab from URL
I restarted A1111 several times (not all dependencies were installed at once)

Same problem for new installation

I just installed the program from scratch `git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui` `cd .\stable-diffusion-webui\` Switch to old version `git checkout 7ea5be3e` Installed Faceswaplab from URL I restarted A1111 several times (not all dependencies were installed at once) Same problem for new installation
glucauze commented 2023-08-01 17:41:49 +02:00 (Migrated from github.com)

Thx for trying. What version of gradio is used in this version ? I use type annotations a lot to check code. This is typically the thing that crashes older versions of gradio. I haven't noticed any problems with version 3.32.

Thx for trying. What version of gradio is used in this version ? I use type annotations a lot to check code. This is typically the thing that crashes older versions of gradio. I haven't noticed any problems with version 3.32.
VitaliyS commented 2023-08-01 17:44:36 +02:00 (Migrated from github.com)

gradio-3.23.0

But I can try to update gradio again

gradio-3.23.0 But I can try to update gradio again
glucauze commented 2023-08-01 17:45:48 +02:00 (Migrated from github.com)

It's the same version as mine, so I don't see why it would crash. At the moment I'm a bit short of ideas. Is it just the tab, or does it really concern the whole extension? Do you have the accordion in the other panels?

It's the same version as mine, so I don't see why it would crash. At the moment I'm a bit short of ideas. Is it just the tab, or does it really concern the whole extension? Do you have the accordion in the other panels?
VitaliyS commented 2023-08-01 17:50:31 +02:00 (Migrated from github.com)

No, your version is 3.32, not 3.23 =)

Everything works, I have accordion in the other panels and section in settings. But I haven't tab

No, your version is 3.32, not 3.23 =) Everything works, I have accordion in the other panels and section in settings. But I haven't tab
VitaliyS commented 2023-08-01 18:01:46 +02:00 (Migrated from github.com)

Okay, I figured out why the gradio update didn't work. A1111 puts the old version on startup

Well, I will use it without the tab

Okay, I figured out why the gradio update didn't work. A1111 puts the old version on startup Well, I will use it without the tab
glucauze commented 2023-08-01 18:06:53 +02:00 (Migrated from github.com)

If gradio is really a problem, I could remove the type annotations. But it's a pain to degrade code quality because of that. I'll leave the issue open to see if that's really where the problem lies.

If gradio is really a problem, I could remove the type annotations. But it's a pain to degrade code quality because of that. I'll leave the issue open to see if that's really where the problem lies.
VitaliyS commented 2023-08-01 18:10:32 +02:00 (Migrated from github.com)

I can remove the type annotations for me only. But I don't know what I need delete
I don't think it's worth changing the code to work with older versions of gradio

I can remove the type annotations for me only. But I don't know what I need delete I don't think it's worth changing the code to work with older versions of gradio
glucauze commented 2023-08-01 18:25:30 +02:00 (Migrated from github.com)

If you have the time, you can give it a try. That way we'll know for sure.

In the file :
https://github.com/glucauze/sd-webui-faceswaplab/blob/main/scripts/faceswaplab_ui/faceswaplab_tab.py

For each function, for example :

def extract_faces(
    files: List[gr.File],
    extract_path: Optional[str],
    *components: List[gr.components.Component],
) -> Optional[List[Image.Image]]:

You can remove the annotation types like this :

def extract_faces(
    files,
    extract_path,
    *components,
)
If you have the time, you can give it a try. That way we'll know for sure. In the file : https://github.com/glucauze/sd-webui-faceswaplab/blob/main/scripts/faceswaplab_ui/faceswaplab_tab.py For each function, for example : ```python def extract_faces( files: List[gr.File], extract_path: Optional[str], *components: List[gr.components.Component], ) -> Optional[List[Image.Image]]: ``` You can remove the annotation types like this : ```python def extract_faces( files, extract_path, *components, ) ```
VitaliyS commented 2023-08-01 18:36:41 +02:00 (Migrated from github.com)

Thank you. It works

Thank you. It works
glucauze commented 2023-08-01 18:43:50 +02:00 (Migrated from github.com)

Thanks for your feedback

Thanks for your feedback
willyelrey10 commented 2023-10-26 20:36:33 +02:00 (Migrated from github.com)

Hello, could someone help me update Gradio? I have this problem.
" FaceSwapLab - WARNING - Errors may occur with gradio versions lower than 3.32.0. Your version : 3.23.0"
Error executing callback ui_tabs_callback for C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py
Traceback (most recent call last):
File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\modules\script_callbacks.py", line 125, in ui_tabs_callback
res += c.callback() or []
File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\extensions\sd-webui-faceswaplab\scripts\faceswaplab_ui\faceswaplab_tab.py", line 424, in on_ui_tabs
tools_ui()
File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\extensions\sd-webui-faceswaplab\scripts\faceswaplab_ui\faceswaplab_tab.py", line 398, in tools_ui
generate_checkpoint_btn.click(
File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\venv\lib\site-packages\gradio\events.py", line 129, in call
dep, dep_index = self.trigger.set_event_trigger(
File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 195, in set_event_trigger
check_function_inputs_match(fn, inputs, inputs_as_dict)
File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\venv\lib\site-packages\gradio\utils.py", line 940, in check_function_inputs_match
if not is_special_typed_parameter(name):
File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\venv\lib\site-packages\gradio\utils.py", line 929, in is_special_typed_parameter
is_event_data = issubclass(parameter_types.get(name, int), EventData)
TypeError: issubclass() arg 1 must be a class

Hello, could someone help me update Gradio? I have this problem. " FaceSwapLab - WARNING - Errors may occur with gradio versions lower than 3.32.0. Your version : 3.23.0" Error executing callback ui_tabs_callback for C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py Traceback (most recent call last): File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\modules\script_callbacks.py", line 125, in ui_tabs_callback res += c.callback() or [] File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\extensions\sd-webui-faceswaplab\scripts\faceswaplab_ui\faceswaplab_tab.py", line 424, in on_ui_tabs tools_ui() File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\extensions\sd-webui-faceswaplab\scripts\faceswaplab_ui\faceswaplab_tab.py", line 398, in tools_ui generate_checkpoint_btn.click( File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\venv\lib\site-packages\gradio\events.py", line 129, in __call__ dep, dep_index = self.trigger.set_event_trigger( File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 195, in set_event_trigger check_function_inputs_match(fn, inputs, inputs_as_dict) File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\venv\lib\site-packages\gradio\utils.py", line 940, in check_function_inputs_match if not is_special_typed_parameter(name): File "C:\Users\Usuario\Documents\Stablediffusion\stable-diffusion-webui-master\venv\lib\site-packages\gradio\utils.py", line 929, in is_special_typed_parameter is_event_data = issubclass(parameter_types.get(name, int), EventData) TypeError: issubclass() arg 1 must be a class
VitaliyS commented 2023-12-02 08:20:18 +01:00 (Migrated from github.com)

could someone help me update Gradio?

You can simply delete the gradio folders in the venv\Lib\site-packages directory and automatic1111 will download the required version. But if you are using an older version of automatic1111, the version of gradio may not change

> could someone help me update Gradio? You can simply delete the gradio folders in the venv\Lib\site-packages directory and automatic1111 will download the required version. But if you are using an older version of automatic1111, the version of gradio may not change
Sign in to join this conversation.