Skip to content

Commit

Permalink
Fix potential issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Nov 16, 2023
1 parent bd07ad1 commit 9f00a18
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion comfy/model_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def model_size(self):
return size

def clone(self):
n = ModelPatcher(self.model, self.load_device, self.offload_device, self.size, self.current_device)
n = ModelPatcher(self.model, self.load_device, self.offload_device, self.size, self.current_device, weight_inplace_update=self.weight_inplace_update)
n.patches = {}
for k in self.patches:
n.patches[k] = self.patches[k][:]
Expand Down
2 changes: 1 addition & 1 deletion comfy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def set_attr(obj, attr, value):
for name in attrs[:-1]:
obj = getattr(obj, name)
prev = getattr(obj, attrs[-1])
setattr(obj, attrs[-1], torch.nn.Parameter(value))
setattr(obj, attrs[-1], torch.nn.Parameter(value, requires_grad=False))
del prev

def copy_to_param(obj, attr, value):
Expand Down

0 comments on commit 9f00a18

Please sign in to comment.