Fooocus GitHub Bot Commit

This commit is generated by a GitHub bot of Fooocus
This commit is contained in:
lllyasviel
2023-11-11 09:34:04 -08:00
parent e89dc07485
commit 64159f0ce3
3 changed files with 25 additions and 6 deletions
+8
View File
@@ -261,6 +261,14 @@ def set_attr(obj, attr, value):
setattr(obj, attrs[-1], torch.nn.Parameter(value))
del prev
def copy_to_param(obj, attr, value):
# inplace update tensor instead of replacing it
attrs = attr.split(".")
for name in attrs[:-1]:
obj = getattr(obj, name)
prev = getattr(obj, attrs[-1])
prev.data.copy_(value)
def get_attr(obj, attr):
attrs = attr.split(".")
for name in attrs: