Hotfix for clip

I'm sure this won't break a million other things
This commit is contained in:
City
2024-08-20 02:42:22 +02:00
parent 2e5e599b54
commit 2ca943a1c3
+9 -2
View File
@@ -32,6 +32,13 @@ class GGMLTensor(torch.Tensor):
def detach(self, *args, **kwargs):
return self
def copy_(self, *args, **kwargs):
# fixes .weight.copy_ in comfy/clip_model/CLIPTextModel
try:
return super().copy_(*args, **kwargs)
except Exception as e:
print(f"ignoring 'copy_' on tensor")
@property
def shape(self):
if not hasattr(self, "tensor_shape"):
@@ -44,7 +51,7 @@ class GGMLLayer(torch.nn.Module):
"""
def __init__(self, *args, **kwargs):
super().__init__()
self.weight = None
self.weight = GGMLTensor(1, tensor_type=None, tensor_shape=None)
self.bias = None
def _load_from_state_dict(self, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs):
@@ -142,4 +149,4 @@ class GGMLOps(comfy.ops.manual_cast):
if device:
self.to(device)
return x
return x