mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-18 15:44:55 +08:00
Fix potential issue. (#13009)
This commit is contained in:
parent
20561aa919
commit
ca17fc8355
@ -899,7 +899,7 @@ def set_attr(obj, attr, value):
|
||||
def set_attr_param(obj, attr, value):
|
||||
# Clone inference tensors (created under torch.inference_mode) since
|
||||
# their version counter is frozen and nn.Parameter() cannot wrap them.
|
||||
if value.is_inference():
|
||||
if (not torch.is_inference_mode_enabled()) and value.is_inference():
|
||||
value = value.clone()
|
||||
return set_attr(obj, attr, torch.nn.Parameter(value, requires_grad=False))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user