get_files_with_extension rewrite

This commit is contained in:
nullquant
2024-05-29 14:45:44 +03:00
parent d0138676d4
commit 26cc11e99f
2 changed files with 47 additions and 45 deletions
+6 -2
View File
@@ -13,7 +13,7 @@ def add_model_patch_option(model):
# Patch model with model_function_wrapper
def patch_model_function_wrapper(model, forward_patch):
def patch_model_function_wrapper(model, forward_patch, remove=False):
def brushnet_model_function_wrapper(apply_model_method, options_dict):
to = options_dict['c']['transformer_options']
@@ -67,7 +67,11 @@ def patch_model_function_wrapper(model, forward_patch):
raise Exception("Unsupported model type: ", type(model.model.model_config))
if 'forward' not in mp:
mp['forward'] = [forward_patch]
mp['forward'] = []
if remove:
if forward_patch in mp['forward']:
mp['forward'].remove(forward_patch)
else:
mp['forward'].append(forward_patch)