Repository: stable-diffusion-webui
Issue: [Bug]: Cannot change models
Labels: bug-report

### Checklist

- [X] The issue exists after disabling all extensions
- [X] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [X] The issue exists in the current version of the webui
- [X] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### What happened?

Made an install. Tried switching models and had an exception.

### Steps to reproduce the problem

Clean install. Switch models.

### What should have happened?

none

### What browsers do you use to access the UI ?

_No response_

### Sysinfo

Not giving it

### Console logs

```Shell
2024-02-14 16:09:40 loading stable diffusion model: RuntimeError
2024-02-14 16:09:40 Traceback (most recent call last):
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/threading.py", line 973, in _bootstrap
2024-02-14 16:09:40     self._bootstrap_inner()
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
2024-02-14 16:09:40     self.run()
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
2024-02-14 16:09:40     result = context.run(func, *args)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
2024-02-14 16:09:40     response = f(*args, **kwargs)
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/ui_extra_networks.py", line 425, in refresh
2024-02-14 16:09:40     pg.refresh()
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/ui_extra_networks_textual_inversion.py", line 13, in refresh
2024-02-14 16:09:40     sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True)
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 222, in load_textual_inversion_embeddings
2024-02-14 16:09:40     self.expected_shape = self.get_expected_shape()
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 154, in get_expected_shape
2024-02-14 16:09:40     vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/shared_items.py", line 128, in sd_model
2024-02-14 16:09:40     return modules.sd_models.model_data.get_sd_model()
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/sd_models.py", line 531, in get_sd_model
2024-02-14 16:09:40     load_model()
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/sd_models.py", line 681, in load_model
2024-02-14 16:09:40     sd_model.cond_stage_model_empty_prompt = get_empty_cond(sd_model)
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/sd_models.py", line 569, in get_empty_cond
2024-02-14 16:09:40     return sd_model.cond_stage_model([""])
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
2024-02-14 16:09:40     return self._call_impl(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
2024-02-14 16:09:40     return forward_call(*args, **kwargs)
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/sd_hijack_clip.py", line 234, in forward
2024-02-14 16:09:40     z = self.process_tokens(tokens, multipliers)
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/sd_hijack_clip.py", line 273, in process_tokens
2024-02-14 16:09:40     z = self.encode_with_transformers(tokens)
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/sd_hijack_clip.py", line 326, in encode_with_transformers
2024-02-14 16:09:40     outputs = self.wrapped.transformer(input_ids=tokens, output_hidden_states=-opts.CLIP_stop_at_last_layers)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
2024-02-14 16:09:40     return self._call_impl(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1568, in _call_impl
2024-02-14 16:09:40     result = forward_call(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py", line 822, in forward
2024-02-14 16:09:40     return self.text_model(
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
2024-02-14 16:09:40     return self._call_impl(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
2024-02-14 16:09:40     return forward_call(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py", line 740, in forward
2024-02-14 16:09:40     encoder_outputs = self.encoder(
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
2024-02-14 16:09:40     return self._call_impl(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
2024-02-14 16:09:40     return forward_call(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py", line 654, in forward
2024-02-14 16:09:40     layer_outputs = encoder_layer(
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
2024-02-14 16:09:40     return self._call_impl(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
2024-02-14 16:09:40     return forward_call(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py", line 382, in forward
2024-02-14 16:09:40     hidden_states = self.layer_norm1(hidden_states)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
2024-02-14 16:09:40     return self._call_impl(*args, **kwargs)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
2024-02-14 16:09:40     return forward_call(*args, **kwargs)
2024-02-14 16:09:40   File "/stable-diffusion-webui/extensions-builtin/Lora/networks.py", line 531, in network_LayerNorm_forward
2024-02-14 16:09:40     return originals.LayerNorm_forward(self, input)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/normalization.py", line 196, in forward
2024-02-14 16:09:40     return F.layer_norm(
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/torch/nn/functional.py", line 2543, in layer_norm
2024-02-14 16:09:40     return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
2024-02-14 16:09:40 RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument weight in method wrapper_CUDA__native_layer_norm)
2024-02-14 16:09:40 
2024-02-14 16:09:40 
2024-02-14 16:09:40 Stable diffusion model failed to load
2024-02-14 16:09:40 Traceback (most recent call last):
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict
2024-02-14 16:09:40     output = await app.get_blocks().process_api(
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/gradio/blocks.py", line 1431, in process_api
2024-02-14 16:09:40     result = await self.call_function(
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/gradio/blocks.py", line 1103, in call_function
2024-02-14 16:09:40     prediction = await anyio.to_thread.run_sync(
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
2024-02-14 16:09:40     return await get_asynclib().run_sync_in_worker_thread(
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
2024-02-14 16:09:40     return await future
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
2024-02-14 16:09:40     result = context.run(func, *args)
2024-02-14 16:09:40   File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
2024-02-14 16:09:40     response = f(*args, **kwargs)
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/ui_extra_networks.py", line 425, in refresh
2024-02-14 16:09:40     pg.refresh()
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/ui_extra_networks_textual_inversion.py", line 13, in refresh
2024-02-14 16:09:40     sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True)
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 222, in load_textual_inversion_embeddings
2024-02-14 16:09:40     self.expected_shape = self.get_expected_shape()
2024-02-14 16:09:40   File "/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 154, in get_expected_shape
2024-02-14 16:09:40     vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
2024-02-14 16:09:40 AttributeError: 'NoneType' object has no attribute 'cond_stage_model'
2024-02-14 16:10:02 Loading weights [8affd965d5] from /stable-diffusion-webui/models/Stable-diffusion/sd-v1-5-inpainting.ckpt
2024-02-14 16:10:02 *** Error verifying pickled file from /stable-diffusion-webui/models/Stable-diffusion/sd-v1-5-inpainting.ckpt
2024-02-14 16:10:02 *** The file may be malicious, so the program is not going to read it.
2024-02-14 16:10:02 *** You can skip this check with --disable-safe-unpickle commandline argument.
2024-02-14 16:10:02 *** 
2024-02-14 16:10:02     Traceback (most recent call last):
2024-02-14 16:10:02       File "/stable-diffusion-webui/modules/safe.py", line 83, in check_pt
2024-02-14 16:10:02         with zipfile.ZipFile(filename) as z:
2024-02-14 16:10:02       File "/opt/conda/lib/python3.10/zipfile.py", line 1269, in __init__
2024-02-14 16:10:02         self._RealGetContents()
2024-02-14 16:10:02       File "/opt/conda/lib/python3.10/zipfile.py", line 1336, in _RealGetContents
2024-02-14 16:10:02         raise BadZipFile("File is not a zip file")
2024-02-14 16:10:02     zipfile.BadZipFile: File is not a zip file
2024-02-14 16:10:02 
2024-02-14 16:10:02     During handling of the above exception, another exception occurred:
2024-02-14 16:10:02 
2024-02-14 16:10:02     Traceback (most recent call last):
2024-02-14 16:10:02       File "/stable-diffusion-webui/modules/safe.py", line 137, in load_with_extra
2024-02-14 16:10:02         check_pt(filename, extra_handler)
2024-02-14 16:10:02       File "/stable-diffusion-webui/modules/safe.py", line 104, in check_pt
2024-02-14 16:10:02         unpickler.load()
2024-02-14 16:10:02       File "/opt/conda/lib/python3.10/pickle.py", line 1213, in load
2024-02-14 16:10:02         dispatch[key[0]](self)
2024-02-14 16:10:02     KeyError: 0
2024-02-14 16:10:02 
2024-02-14 16:10:02 ---
2024-02-14 16:10:02 changing setting sd_model_checkpoint to sd-v1-5-inpainting.ckpt [8affd965d5]: AttributeError
2024-02-14 16:10:02 Traceback (most recent call last):
2024-02-14 16:10:02   File "/stable-diffusion-webui/modules/options.py", line 146, in set
2024-02-14 16:10:02     option.onchange()
2024-02-14 16:10:02   File "/stable-diffusion-webui/modules/call_queue.py", line 13, in f
2024-02-14 16:10:02     res = func(*args, **kwargs)
2024-02-14 16:10:02   File "/stable-diffusion-webui/modules/initialize_util.py", line 174, in <lambda>
2024-02-14 16:10:02     shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False)
2024-02-14 16:10:02   File "/stable-diffusion-webui/modules/sd_models.py", line 773, in reload_model_weights
2024-02-14 16:10:02     state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
2024-02-14 16:10:02   File "/stable-diffusion-webui/modules/sd_models.py", line 330, in get_checkpoint_state_dict
2024-02-14 16:10:02     res = read_state_dict(checkpoint_info.filename)
2024-02-14 16:10:02   File "/stable-diffusion-webui/modules/sd_models.py", line 314, in read_state_dict
2024-02-14 16:10:02     sd = get_state_dict_from_checkpoint(pl_sd)
2024-02-14 16:10:02   File "/stable-diffusion-webui/modules/sd_models.py", line 253, in get_state_dict_from_checkpoint
2024-02-14 16:10:02     pl_sd = pl_sd.pop("state_dict", pl_sd)
2024-02-14 16:10:02 AttributeError: 'NoneType' object has no attribute 'pop'
```


### Additional information

_No response_