MCPcopy Index your code
hub / github.com/microsoft/BitNet / __init__

Method __init__

utils/generate-dummy-bitnet-model.py:123–136  ·  view source on GitHub ↗
(self, dir_model: Path, ftype: int, fname_out: Path, is_big_endian: bool, use_temp_file: bool)

Source from the content-addressed store, hash-verified

121 _model_classes: dict[str, type[Model]] = {}
122
123 def __init__(self, dir_model: Path, ftype: int, fname_out: Path, is_big_endian: bool, use_temp_file: bool):
124 self.dir_model = dir_model
125 self.ftype = ftype
126 self.fname_out = fname_out
127 self.is_big_endian = is_big_endian
128 self.endianess = gguf.GGUFEndian.BIG if is_big_endian else gguf.GGUFEndian.LITTLE
129 self.use_temp_file = use_temp_file
130 self.is_safetensors = self._is_model_safetensors()
131 self.num_parts = Model.count_model_parts(self.dir_model, ".safetensors" if self.is_safetensors else ".bin")
132 self.part_names = self._get_part_names()
133 self.hparams = Model.load_hparams(self.dir_model)
134 self.gguf_writer = gguf.GGUFWriter(fname_out, gguf.MODEL_ARCH_NAMES[self.model_arch], endianess=self.endianess, use_temp_file=self.use_temp_file)
135 self.block_count = self.find_hparam(["n_layers", "num_hidden_layers", "n_layer"])
136 self.tensor_map = gguf.get_tensor_name_map(self.model_arch, self.block_count)
137
138 @property
139 @abstractmethod

Callers

nothing calls this directly

Calls 5

_is_model_safetensorsMethod · 0.95
_get_part_namesMethod · 0.95
find_hparamMethod · 0.95
count_model_partsMethod · 0.45
load_hparamsMethod · 0.45

Tested by

no test coverage detected