From 0108616b7745c4789e8fcb2a0bd8d9bb58f03e90 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 28 Jan 2023 01:38:42 -0500 Subject: [PATCH] Fix issue with some models. --- comfy/sd.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index 91db6f4e..fdb885bd 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -32,8 +32,11 @@ def load_model_from_config(config, ckpt, verbose=False, load_state_dict_to=[]): y = x.replace("cond_stage_model.transformer.", "cond_stage_model.transformer.text_model.") sd[y] = sd.pop(x) - if 'cond_stage_model.transformer.text_model.embeddings.position_ids' in sd: - sd['cond_stage_model.transformer.text_model.embeddings.position_ids'] = sd['cond_stage_model.transformer.text_model.embeddings.position_ids'].round() + try: + if 'cond_stage_model.transformer.text_model.embeddings.position_ids' in sd: + sd['cond_stage_model.transformer.text_model.embeddings.position_ids'] = sd['cond_stage_model.transformer.text_model.embeddings.position_ids'].round() + except: + pass for x in load_state_dict_to: x.load_state_dict(sd, strict=False)