hako-mikan / sd-webui-supermerger

model merge extention for stable diffusion web ui
GNU Affero General Public License v3.0
703 stars 104 forks source link

RuntimeError: dictionary changed size during iteration #341

Closed Neytiri7 closed 3 months ago

Neytiri7 commented 4 months ago

When converting the SDXL model, if "Force CLIP position_id to int64 before convert" and "Fix clip" are applied, runtime errors are identified.

The corresponding transformation extension is "https://github.com/Akegarasu/sd-webui-model-converter ".

It merges normally in the "checkpoint merger" that is built into "A1111".

Screenshot 2024-02-24 at 04 07 44


Substituting empty model_c with model_a Calculating sha256 for O:\AI\SynologyDrive\1.8.0_RC\models\Stable-diffusion\1-int64-clip-fix.safetensors: 1cda66fc40707cde3c6b79d05f0a35f5d281e8b72ec914551d191a540fa57863 Calculating sha256 for O:\AI\SynologyDrive\1.8.0_RC\models\Stable-diffusion\2.safetensors: f451d704874c3ca20c3494a3ba185f3688a815c4d6eded246cd36d335ef598bb model A : 1-int64-clip-fix model B : 2 model C : 1-int64-clip-fix alpha,beta : (0.3, 0.2) weights_alpha : weights_beta : mode : Weight sum MBW : False CalcMode : normal Elemental : Weights Seed : 2014373255 Off : ([], '') Adjust : Loading weights [2] from file Loading weights [1-int64-clip-fix] from file Stage 1/2: 100%|██████████████████████████████████████████████████████████████████| 3557/3557 [00:21<00:00, 165.08it/s] Stage 2/2: 100%|██████████████████████████████████████████████████████████████| 2515/2515 [00:00<00:00, 1259693.64it/s] Baking in VAE from O:\AI\SynologyDrive\1.8.0_RC\models\VAE\sdxl_vae.safetensors Saving... Traceback (most recent call last): File "O:\AI\SynologyDrive\1.8.0_RC\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "O:\AI\SynologyDrive\1.8.0_RC\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "O:\AI\SynologyDrive\1.8.0_RC\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "O:\AI\SynologyDrive\1.8.0_RC\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "O:\AI\SynologyDrive\1.8.0_RC\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "O:\AI\SynologyDrive\1.8.0_RC\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "O:\AI\SynologyDrive\1.8.0_RC\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(args, **kwargs) File "O:\AI\SynologyDrive\1.8.0_RC\extensions\sd-webui-supermerger\scripts\mergers\mergers.py", line 128, in smergegen result = savemodel(theta_0,currentmodel,custom_name,save_sets,metadata) if save else "Merged model loaded:"+currentmodel File "O:\AI\SynologyDrive\1.8.0_RC\extensions\sd-webui-supermerger\scripts\mergers\model_util.py", line 114, in savemodel for i, key in enumerate(state_dict.keys()): RuntimeError: dictionary changed size during iteration