added support for sbert/distilbert model

This commit is contained in:
Andrew 2023-11-17 13:59:59 -05:00
parent 438387e191
commit 0867e20bc2
2 changed files with 0 additions and 5 deletions

View file

@ -16,7 +16,6 @@ import numpy as np
import torch import torch
from collections import OrderedDict from collections import OrderedDict
#TYPE_CHECKING = False
if TYPE_CHECKING: if TYPE_CHECKING:
from torch import Tensor from torch import Tensor
@ -86,9 +85,6 @@ class Model:
def write_tensors(self): def write_tensors(self):
block_count = self.hparams.get("n_layers", self.hparams.get("num_hidden_layers", self.hparams.get("n_layer"))) block_count = self.hparams.get("n_layers", self.hparams.get("num_hidden_layers", self.hparams.get("n_layer")))
tensor_map = gguf.get_tensor_name_map(self.model_arch, block_count) tensor_map = gguf.get_tensor_name_map(self.model_arch, block_count)
print ("-------------------")
for tt,_ in self.get_tensors():
print(tt)
for name, data_torch in self.get_tensors(): for name, data_torch in self.get_tensors():
# we don't need these # we don't need these
if name.endswith((".attention.masked_bias", ".attention.bias", ".attention.rotary_emb.inv_freq")): if name.endswith((".attention.masked_bias", ".attention.bias", ".attention.rotary_emb.inv_freq")):

View file

@ -231,7 +231,6 @@ class TensorNameMap:
key = key.format(bid = bid) key = key.format(bid = bid)
self.mapping[key] = (tensor, tensor_name) self.mapping[key] = (tensor, tensor_name)
def get_type_and_name(self, key: str, try_suffixes: Sequence[str] = ()) -> tuple[MODEL_TENSOR, str] | None: def get_type_and_name(self, key: str, try_suffixes: Sequence[str] = ()) -> tuple[MODEL_TENSOR, str] | None:
print("getting ", key)
result = self.mapping.get(key) result = self.mapping.get(key)
if result is not None: if result is not None:
return result return result