Allow patches applied to ModelPatcher to be implemented in a general form as functions.

This commit is contained in:
Dr.Lt.Data 2024-05-30 01:35:16 +09:00
parent 71ec5b144e
commit 9350384f6e

View File

@ -487,6 +487,9 @@ class ModelPatcher:
weight += ((strength * alpha) * lora_diff).type(weight.dtype)
except Exception as e:
logging.error("ERROR {} {} {}".format(patch_type, key, e))
elif patch_type == "patch_function":
weight = v(p, weight, key)
else:
logging.warning("patch type not recognized {} {}".format(patch_type, key))