Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions diffsynth/extensions/FastBlend/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def smooth_video(
# output
try:
fps = int(fps)
except:
except Exception:
fps = get_video_fps(video_style) if video_style is not None else 30
print("Fps:", fps)
print("Saving video...")
Expand Down Expand Up @@ -243,7 +243,7 @@ def interpolate_video(
InterpolationModeRunner().run(frames_guide, frames_style, index_style, batch_size=batch_size, ebsynth_config=ebsynth_config, save_path=output_frames_path)
try:
fps = int(fps)
except:
except Exception:
fps = 30
print("Fps:", fps)
print("Saving video...")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def bpe(self, token):
j = word.index(first, i)
new_word.extend(word[i:j])
i = j
except:
except Exception:
new_word.extend(word[i:])
break

Expand Down
4 changes: 2 additions & 2 deletions diffsynth/models/lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def match(self, model, state_dict_lora):
break
else:
return lora_prefix, model_resource
except:
except Exception:
pass
return None

Expand Down Expand Up @@ -251,7 +251,7 @@ def load(self, model, state_dict_lora, lora_prefix="", alpha=1.0, model_resource
try:
weight_up = state_dict_lora[lora_name_dict[name][0]].to(device=computation_device, dtype=computation_dtype)
weight_down = state_dict_lora[lora_name_dict[name][1]].to(device=computation_device, dtype=computation_dtype)
except:
except Exception:
from ipdb import set_trace; set_trace()
if len(weight_up.shape) == 4:
weight_up = weight_up.squeeze(3).squeeze(2)
Expand Down
2 changes: 1 addition & 1 deletion diffsynth/models/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def load_model_from_huggingface_folder(file_path, model_names, model_classes, to
model = model.half()
try:
model = model.to(device=device)
except:
except Exception:
pass
loaded_model_names.append(model_name)
loaded_models.append(model)
Expand Down
2 changes: 1 addition & 1 deletion diffsynth/utils/prompt_extend.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def __init__(self, model_name=None, device=0, is_vl=False, **kwargs):
)
try:
from .qwen_vl_utils import process_vision_info
except:
except Exception:
from qwen_vl_utils import process_vision_info
self.process_vision_info = process_vision_info
min_pixels = 256 * 28 * 28
Expand Down
12 changes: 6 additions & 6 deletions diffsynth/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,13 @@ def apply_lora(model, device_to, transformer_load_device, params_to_keep=None, d
key = "{}.{}".format(name_no_prefix, param)
try:
set_module_tensor_to_device(model.model.diffusion_model, key, device=transformer_load_device, dtype=dtype_to_use, value=state_dict[key])
except:
except Exception:
continue
model.patch_weight_to_device("{}.{}".format(name, param), device_to=device_to)
if low_mem_load:
try:
set_module_tensor_to_device(model.model.diffusion_model, key, device=transformer_load_device, dtype=dtype_to_use, value=model.model.diffusion_model.state_dict()[key])
except:
except Exception:
continue
m.comfy_patched_weights = True

Expand All @@ -410,7 +410,7 @@ def apply_lora(model, device_to, transformer_load_device, params_to_keep=None, d
dtype_to_use = torch.float32
try:
set_module_tensor_to_device(model.model.diffusion_model, name, device=transformer_load_device, dtype=dtype_to_use, value=state_dict[name])
except:
except Exception:
continue
return model

Expand Down Expand Up @@ -447,13 +447,13 @@ def apply_lora(model, device_to, transformer_load_device, params_to_keep=None, d
key = "{}.{}".format(name_no_prefix, param)
try:
set_module_tensor_to_device(model.model.diffusion_model, key, device=transformer_load_device, dtype=dtype_to_use, value=state_dict[key])
except:
except Exception:
continue
model.patch_weight_to_device("{}.{}".format(name, param), device_to=device_to)
if low_mem_load:
try:
set_module_tensor_to_device(model.model.diffusion_model, key, device=transformer_load_device, dtype=dtype_to_use, value=model.model.diffusion_model.state_dict()[key])
except:
except Exception:
continue
m.comfy_patched_weights = True

Expand All @@ -466,6 +466,6 @@ def apply_lora(model, device_to, transformer_load_device, params_to_keep=None, d
dtype_to_use = torch.float32
try:
set_module_tensor_to_device(model.model.diffusion_model, name, device=transformer_load_device, dtype=dtype_to_use, value=state_dict[name])
except:
except Exception:
continue
return model