Revert ggml_tensor_name addition

This commit is contained in:
blepping
2024-08-28 12:34:08 -06:00
parent f7d8fbe740
commit e814fc1264
2 changed files with 3 additions and 7 deletions
+1 -2
View File
@@ -77,8 +77,7 @@ def gguf_sd_loader(path, handle_prefix="model.diffusion_model.", require_prefix=
sd[sd_key] = GGMLTensor(
torch_tensor,
tensor_type = tensor.tensor_type,
tensor_shape = shape,
ggml_tensor_name = tensor_name,
tensor_shape = shape
)
dt[tensor_type_str] = dt.get(tensor_type_str, 0) + 1
+2 -5
View File
@@ -9,14 +9,13 @@ class GGMLTensor(torch.Tensor):
"""
Main tensor-like class for storing quantized weights
"""
def __init__(self, *args, tensor_type, tensor_shape, patches=[], ggml_tensor_name=None, **kwargs):
def __init__(self, *args, tensor_type, tensor_shape, patches=[], **kwargs):
super().__init__()
self.tensor_type = tensor_type
self.tensor_shape = tensor_shape
self.patches = patches
self.ggml_tensor_name = ggml_tensor_name
def __new__(cls, *args, tensor_type, tensor_shape, patches=[], ggml_tensor_name=None, **kwargs):
def __new__(cls, *args, tensor_type, tensor_shape, patches=[], **kwargs):
return super().__new__(cls, *args, **kwargs)
def to(self, *args, **kwargs):
@@ -24,7 +23,6 @@ class GGMLTensor(torch.Tensor):
new.tensor_type = getattr(self, "tensor_type", None)
new.tensor_shape = getattr(self, "tensor_shape", new.data.shape)
new.patches = getattr(self, "patches", []).copy()
new.ggml_tensor_name = getattr(self, "ggml_tensor_name", None)
return new
def clone(self, *args, **kwargs):
@@ -46,7 +44,6 @@ class GGMLTensor(torch.Tensor):
new.tensor_type = getattr(self, "tensor_type", None)
new.tensor_shape = getattr(self, "tensor_shape", new.data.shape)
new.patches = getattr(self, "patches", []).copy()
new.ggml_tensor_name = getattr(self, "ggml_tensor_name", None)
return new
@property