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

model failed to load error when trying to use merged model for subsequent merge #397

Open
entropyembrace opened this issue Aug 27, 2024 · 1 comment

Comments

@entropyembrace
Copy link

Stable diffusion model failed to load
Substituting empty model_c with model_a
model A : Merging_MBW_01_waiANIHENTAIPONLYXL_v40_darkPhotoPony_v30Flux.fp16
model B : bemypony_Photo3
model C : Merging_MBW_01_waiANIHENTAIPONLYXL_v40_darkPhotoPony_v30Flux.fp16
alpha,beta : (0.5, 0.25)
weights_alpha :
weights_beta :
mode : Weight sum
MBW : False
CalcMode : normal
Elemental :
Weights Seed : 51039979
Off : ([], '')
Adjust :
Loading weights [bemypony_Photo3] from file
Loading weights [Merging_MBW_01_waiANIHENTAIPONLYXL_v40_darkPhotoPony_v30Flux.fp16] from file
Stage 1/2: 100%|███████████████████████████████████████████████████████████████████| 2515/2515 [00:28<00:00, 87.06it/s]
Stage 2/2: 100%|███████████████████████████████████████████████████████████████| 2515/2515 [00:00<00:00, 360182.83it/s]
Creating model from config: D:\Users\Tera\Automatic1111\repositories\generative-models\configs\inference\sd_xl_base.yaml
Traceback (most recent call last):
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
result = await self.call_function(
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
response = f(*args, **kwargs)
File "D:\Users\Tera\Automatic1111\extensions\sd-webui-supermerger\scripts\mergers\mergers.py", line 131, in smergegen
load_model(checkpoint_info, already_loaded_state_dict=theta_0)
File "D:\Users\Tera\Automatic1111\modules\sd_models.py", line 845, in load_model
load_model_weights(sd_model, checkpoint_info, state_dict, timer)
File "D:\Users\Tera\Automatic1111\modules\sd_models.py", line 440, in load_model_weights
model.load_state_dict(state_dict, strict=False)
File "D:\Users\Tera\Automatic1111\modules\sd_disable_initialization.py", line 223, in
module_load_state_dict = self.replace(torch.nn.Module, 'load_state_dict', lambda *args, **kwargs: load_state_dict(module_load_state_dict, *args, **kwargs))
File "D:\Users\Tera\Automatic1111\modules\sd_disable_initialization.py", line 221, in load_state_dict
original(module, state_dict, strict=strict)
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2138, in load_state_dict
load(self, state_dict)
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2126, in load
load(child, child_state_dict, child_prefix)
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2126, in load
load(child, child_state_dict, child_prefix)
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2126, in load
load(child, child_state_dict, child_prefix)
[Previous line repeated 1 more time]
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2120, in load
module._load_from_state_dict(
File "D:\Users\Tera\Automatic1111\modules\sd_disable_initialization.py", line 225, in
linear_load_from_state_dict = self.replace(torch.nn.Linear, '_load_from_state_dict', lambda *args, **kwargs: load_from_state_dict(linear_load_from_state_dict, *args, **kwargs))
File "D:\Users\Tera\Automatic1111\modules\sd_disable_initialization.py", line 191, in load_from_state_dict
module.parameters[name] = torch.nn.parameter.Parameter(torch.zeros_like(param, device=device, dtype=dtype), requires_grad=param.requires_grad)
File "D:\Users\Tera\Automatic1111\venv\lib\site-packages\torch_meta_registrations.py", line 4516, in zeros_like
res.fill
(0)
RuntimeError: "fill_cpu" not implemented for 'Float8_e4m3fn'

@entropyembrace
Copy link
Author

The issue seems to be caused by using the Save Current Merge (fp16 only) button. I bypassed the issue by using the save model option and clicking merge again to save instead.

other options selected remained the same safetensors, fp16, save metadata, prune

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

4 participants
@entropyembrace and others