AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
143.46k stars 27.01k forks source link

Adapted to the latest version of Transformer (Fixes #13245) #16622

Closed ledyba closed 3 weeks ago

ledyba commented 3 weeks ago

Description

This fixes #13245, there is a patch but not reported.

See also the calling function (First argument can not be None any more): https://github.com/huggingface/transformers/blob/33868a057c02f0368ba63bd1edb746be38fe3d90/src/transformers/modeling_utils.py#L3179-L3440

Checklist:

w-e-w commented 3 weeks ago
ledyba commented 3 weeks ago

OK.

w-e-w commented 3 weeks ago

also

See also the calling function (First argument can not be None any more): https://github.com/huggingface/transformers/blob/33868a057c02f0368ba63bd1edb746be38fe3d90/src/transformers/modeling_utils.py#L3179-L3440

the transformers code you link is 4.47.0.dev0

but we are using transformers==4.30.2 https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/7799859f9fb8a0428d33e50a867e2407be4b8620/requirements_versions.txt#L33

so you shoud be looking at https://github.com/huggingface/transformers/blob/66fd3a8d626a32989f4569260db32785c6cbf42a/src/transformers/modeling_utils.py#L1955-L1956

but regardless of 4.47.0.dev0 or 4.30.2 docstring says both says

        Parameters:
            pretrained_model_name_or_path (`str` or `os.PathLike`, *optional*):
                    ......
                    - `None` if you are both providing the configuration and state dictionary (resp. with keyword
                      arguments `config` and `state_dict`).

which contradicts what you said

so you need to provide more information for example proving that the doc string is incorrect

ledyba commented 3 weeks ago

Thanks!

but regardless of 4.47.0.dev0 or 4.30.2 docstring says both says

You are right, sorry. However, I think this is a bug of transformers, because at least 3 people including me reported this patch works. So, anyway, I think this is not a bug of this web UI. So let me close this issue. (Of course, there is a possibility that it is a problem that only occurs when you combine them.)

w-e-w commented 3 weeks ago

because at least 3 people including me reported this patch works.

but the thing is it's working without it for most people it's like what's happening on your system that is cause the issue

like Auto said in the other PR

closing because I can't reproduce the problem; reopen if there's more

so if you can actually figure out what is causing the bug and provide a fix reason for it then sure

ledyba commented 3 weeks ago

Ok, you're right. I'll reopen it if I can find the root cause. Thank you!

Theliel commented 2 weeks ago

Interesting, because the fix actually works. Not only does it allow us to use an updated working version of transformers, it also finally allows us to use an updated version of tokenizers, and thus make Automatic1111 compatible with Python 3.12 (only with some others package updates). I've been testing the environment for days now, and haven't found a single bug for now

Win11, Python 3.12.7, pyTorch 2.5.1 + cu12.4 + cudnn 9.5.1, xformers 0.0.28.post3