Hotfix to work as normal tensor
Fixes [ViT-L-14-BEST...] not working
This commit is contained in:
+5
-3
@@ -6,10 +6,12 @@ from tqdm import tqdm
|
||||
|
||||
def dequantize_tensor(tensor, dtype=torch.float16):
|
||||
data = torch.tensor(tensor.data)
|
||||
qtype = tensor.tensor_type
|
||||
oshape = tensor.tensor_shape
|
||||
qtype = getattr(tensor, "tensor_type", None)
|
||||
oshape = getattr(tensor, "tensor_shape", tensor.data.shape)
|
||||
|
||||
if qtype == gguf.GGMLQuantizationType.F32:
|
||||
if qtype == None:
|
||||
return data.to(dtype)
|
||||
elif qtype == gguf.GGMLQuantizationType.F32:
|
||||
return data.to(dtype)
|
||||
elif qtype == gguf.GGMLQuantizationType.F16:
|
||||
return data.to(dtype)
|
||||
|
||||
@@ -190,10 +190,10 @@ class CLIPLoaderGGUF:
|
||||
|
||||
# for some reason this is just missing in some SAI checkpoints
|
||||
if getattr(clip.cond_stage_model, "clip_l", None) is not None:
|
||||
if clip.cond_stage_model.clip_l.transformer.text_projection.weight.tensor_shape == None:
|
||||
if getattr(clip.cond_stage_model.clip_l.transformer.text_projection.weight, "tensor_shape", None) == None:
|
||||
clip.cond_stage_model.clip_l.transformer.text_projection = comfy.ops.manual_cast.Linear(768, 768)
|
||||
if getattr(clip.cond_stage_model, "clip_g", None) is not None:
|
||||
if clip.cond_stage_model.clip_g.transformer.text_projection.weight.tensor_shape == None:
|
||||
if getattr(clip.cond_stage_model.clip_g.transformer.text_projection.weight, "tensor_shape", None) == None:
|
||||
clip.cond_stage_model.clip_g.transformer.text_projection = comfy.ops.manual_cast.Linear(1280, 1280)
|
||||
|
||||
return clip
|
||||
|
||||
@@ -21,9 +21,9 @@ class GGMLTensor(torch.Tensor):
|
||||
|
||||
def to(self, *args, **kwargs):
|
||||
new = super().to(*args, **kwargs)
|
||||
new.tensor_type = self.tensor_type
|
||||
new.tensor_shape = self.tensor_shape
|
||||
new.patches = self.patches.copy()
|
||||
new.tensor_type = getattr(self, "tensor_type", None)
|
||||
new.tensor_shape = getattr(self, "tensor_shape", new.data.shape)
|
||||
new.patches = getattr(self, "patches", []).copy()
|
||||
return new
|
||||
|
||||
def clone(self, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user