model load exception handling

This commit is contained in:
Vladimir Mandic
2023-07-13 10:45:58 -04:00
parent 186bd236f5
commit fdb76ddf12
4 changed files with 8 additions and 2 deletions
+1
View File
@@ -22,6 +22,7 @@ Another big one, but now improvements to both **diffusers** and **original** bac
- other:
- major refactoring of the javascript code
includes fixes for text selections and navigation
- system info tab now reports on nvidia driver version as well
- minor fixes in extra-networks
- installer handles origin changes for submodules
+2
View File
@@ -761,6 +761,8 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
model=shared.sd_refiner,
prompt=[p.refiner_prompt] if len(p.refiner_prompt) > 0 else prompts,
negative_prompt=[p.refiner_negative] if len(p.refiner_negative) > 0 else negative_prompts,
num_inference_steps=p.refiner_steps,
denoising_start=p.refiner_denoise,
image=output.images[0],
output_type='np'
)
+4 -1
View File
@@ -382,7 +382,10 @@ def load_model_weights(model: torch.nn.Module, checkpoint_info: CheckpointInfo,
shared.opts.data["sd_model_checkpoint"] = checkpoint_info.title
if state_dict is None:
state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
model.load_state_dict(state_dict, strict=False)
try:
model.load_state_dict(state_dict, strict=False)
except Exception as e:
shared.log.error(f'Error loading model weights: {checkpoint_info.filename} {e}')
del state_dict
timer.record("apply")
if shared.opts.sd_checkpoint_cache > 0: