MCPcopy Create free account
hub / github.com/Pints-AI/1.5-Pints / add_tensor_info

Method add_tensor_info

tokenizer/convert/convert.py:1066–1071  ·  view source on GitHub ↗
(self, name: str, tensor: LazyTensor)

Source from the content-addressed store, hash-verified

1064 svocab.add_to_gguf(self.gguf)
1065
1066 def add_tensor_info(self, name: str, tensor: LazyTensor) -> None:
1067 n_elements = int(np.prod(tensor.shape))
1068 raw_dtype = getattr(tensor.data_type, 'ggml_type', None)
1069 data_type = getattr(tensor.data_type, 'quantized_type', None) or tensor.data_type.dtype
1070 data_nbytes = tensor.data_type.elements_to_bytes(n_elements)
1071 self.gguf.add_tensor_info(name, tensor.shape, data_type, data_nbytes, raw_dtype=raw_dtype)
1072
1073 def write_meta(self) -> None:
1074 self.gguf.write_header_to_file()

Callers 1

write_allMethod · 0.95

Calls 1

elements_to_bytesMethod · 0.45

Tested by

no test coverage detected