lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
8.12k stars 796 forks source link

Changing to flux checkpoint gives error and crashes. #1934

Closed Tanagoo closed 3 weeks ago

Tanagoo commented 3 weeks ago

Recently everything was working 100% perfect with forge and flux I've tried updating forge but i got this weird error. Generating (sd, xl or flux) still works without any problems. But when i want to change checkpoints (using the checkpoints tab on the generation, text inversion, lora tab) and click on any flux model everything crashes with error bars on the ui. I get the following error in the console.

Traceback (most recent call last): File "F:\stable-diffusion\Forge UI\venv\lib\site-packages\gradio\queueing.py", line 536, in process_events response = await route_utils.call_process_api( File "F:\stable-diffusion\Forge UI\venv\lib\site-packages\gradio\route_utils.py", line 285, in call_process_api output = await app.get_blocks().process_api( File "F:\stable-diffusion\Forge UI\venv\lib\site-packages\gradio\blocks.py", line 1923, in process_api result = await self.call_function( File "F:\stable-diffusion\Forge UI\venv\lib\site-packages\gradio\blocks.py", line 1508, in call_function prediction = await anyio.to_thread.run_sync( # type: ignore File "F:\stable-diffusion\Forge UI\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "F:\stable-diffusion\Forge UI\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "F:\stable-diffusion\Forge UI\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "F:\stable-diffusion\Forge UI\venv\lib\site-packages\gradio\utils.py", line 818, in wrapper response = f(args, **kwargs) File "F:\stable-diffusion\Forge UI\modules\ui_settings.py", line 328, in button_set_checkpoint_change if 'Built in' in vae: TypeError: argument of type 'NoneType' is not iterable

I've tried reverting back to an older version, deleting the venv folder but everything still returns. Yet when i change the checkpoint on the top to flux it works and i can generate everything. But its annoying because i always use the bottom checkpoints/lora tabs. Hopefully somebody can help me fix this annoying error. Its probably not a big problem because everything works but its just the checkpoints tab. Also when the error occurs and i use the same checkpoints tab to switch to an sd or sdxl checkpoint it works and i can continue generating. Probably some settings i've missed or something. Even on a new install i get the same error changing to a flux checkpoint.

Tanagoo commented 3 weeks ago

The normal fluxdev models work without problems but other flux models (flux1-dev-bnb-nf4-v2 for example) give the error. While these were the models i was primarily using without any problems. The VAE/text encoders are all as they were so i have no idea whats causing this.

DenOfEquity commented 3 weeks ago

There is a new feature to allow setting preferred VAE and Text encoders for models, when selected using the cards. Via the 'Edit metadata' button. Try editing the metadata, re-saving. I think maybe there is an old setting being misinterpreted. So newly created metadata would have no issue, and models without metadata would also have no issue.

My8-AD commented 3 weeks ago

Before the update, Forge was working fine.

sd_models.py ui_extra_networks.py ui_extra_networks_checkpoints_user_metadata.py ui_settings.py

The same error occurred immediately after the above four files were updated. This is not limited to Flux, but occurs when changing all checkpoints such as SD1.5.

The error code is the same, so only the error screen is attached. ss-error-20240928

Tanagoo commented 3 weeks ago

There is a new feature to allow setting preferred VAE and Text encoders for models, when selected using the cards. Via the 'Edit metadata' button. Try editing the metadata, re-saving. I think maybe there is an old setting being misinterpreted. So newly created metadata would have no issue, and models without metadata would also have no issue.

Thanks this worked! For anybody else wondering. In the checkpoints tab, on the rightside of a model click the wrench icon (edit metadata) The flux models that weren't working for me were set to unknown. Setting them back to flux and press save worked for me. Thanks!

DenOfEquity commented 3 weeks ago

Thanks for the good report, helped me find the issue quickly. The issue is a result of the shared vae/text encoder box - input/output is now a list (multiple entries possible) rather than a string (one entry). So this issue occurs when there is already metadata saved for models in the old form. I'll update with a fix shortly, to handle the old case. So no need to update all metadata, unless you want to take advantage of the new features.

Tanagoo commented 3 weeks ago

Works perfectly with the new update Thanks!