Skip to content

Commit df4d20c

Browse files
ggerganovcompilade
andauthored
convert : fix squeeze for ssm_conv tensors (#12573)
* convert : fix squeeze for ssm_conv tensors * convert : match ssm_conv tensors by type --------- Co-authored-by: Francis Couture-Harpin <git@compilade.net>
1 parent 5ed38b6 commit df4d20c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

convert_hf_to_gguf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3803,8 +3803,6 @@ def set_gguf_parameters(self):
38033803
_tok_embd = None
38043804

38053805
def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iterable[tuple[str, Tensor]]:
3806-
del bid # unused
3807-
38083806
output_name = self.format_tensor_name(gguf.MODEL_TENSOR.OUTPUT)
38093807
tok_embd_name = self.format_tensor_name(gguf.MODEL_TENSOR.TOKEN_EMBD)
38103808

@@ -3814,6 +3812,10 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
38143812
logger.debug("A_log --> A ==> " + new_name)
38153813
data_torch = -torch.exp(data_torch)
38163814

3815+
# [4 1 8192 1] -> [4 8192 1 1]
3816+
if self.match_model_tensor_name(new_name, gguf.MODEL_TENSOR.SSM_CONV1D, bid):
3817+
data_torch = data_torch.squeeze()
3818+
38173819
# assuming token_embd.weight is seen before output.weight
38183820
if self._tok_embd is not None and new_name == output_name:
38193821
if torch.equal(self._tok_embd, data_torch):

0 commit comments

Comments
 (0)