(
fname_out: Path, ftype: GGMLFileType, params: Params, model: LazyModel, vocab: BaseVocab, svocab: gguf.SpecialVocab,
concurrency: int = DEFAULT_CONCURRENCY, endianess: gguf.GGUFEndian = gguf.GGUFEndian.LITTLE,
pad_vocab: bool = False,
)
| 1243 | |
| 1244 | @staticmethod |
| 1245 | def write_all( |
| 1246 | fname_out: Path, ftype: GGMLFileType, params: Params, model: LazyModel, vocab: BaseVocab, svocab: gguf.SpecialVocab, |
| 1247 | concurrency: int = DEFAULT_CONCURRENCY, endianess: gguf.GGUFEndian = gguf.GGUFEndian.LITTLE, |
| 1248 | pad_vocab: bool = False, |
| 1249 | ) -> None: |
| 1250 | check_vocab_size(params, vocab, pad_vocab=pad_vocab) |
| 1251 | |
| 1252 | of = OutputFile(fname_out, endianess=endianess) |
| 1253 | |
| 1254 | # meta data |
| 1255 | of.add_meta_arch(params) |
| 1256 | if isinstance(vocab, Vocab): |
| 1257 | of.add_meta_vocab(vocab) |
| 1258 | of.add_meta_special_vocab(svocab) |
| 1259 | else: # NoVocab |
| 1260 | of.gguf.add_tokenizer_model(vocab.tokenizer_model) |
| 1261 | |
| 1262 | # tensor info |
| 1263 | for name, lazy_tensor in model.items(): |
| 1264 | of.add_tensor_info(name, lazy_tensor) |
| 1265 | |
| 1266 | of.write_meta() |
| 1267 | of.write_tensor_info() |
| 1268 | |
| 1269 | # tensor data |
| 1270 | of.write_tensor_data(ftype, model, concurrency) |
| 1271 | |
| 1272 | of.close() |
| 1273 | |
| 1274 | |
| 1275 | def pick_output_type(model: LazyModel, output_type_str: str | None) -> GGMLFileType: |
no test coverage detected