MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / write_vocab_only

Method write_vocab_only

convert.py:921–933  ·  view source on GitHub ↗
(fname_out: Path, params: Params, vocab: Vocab, svocab: gguf.SpecialVocab, endianess:gguf.GGUFEndian=gguf.GGUFEndian.LITTLE)

Source from the content-addressed store, hash-verified

919
920 @staticmethod
921 def write_vocab_only(fname_out: Path, params: Params, vocab: Vocab, svocab: gguf.SpecialVocab, endianess:gguf.GGUFEndian=gguf.GGUFEndian.LITTLE) -> None:
922 check_vocab_size(params, vocab)
923
924 of = OutputFile(fname_out, params.arch, endianess=endianess)
925
926 # meta data
927 of.add_meta_arch(params)
928 of.add_meta_vocab(vocab)
929 of.add_meta_special_vocab(svocab)
930
931 of.write_meta()
932
933 of.close()
934
935 @staticmethod
936 def do_item(item: tuple[str, LazyTensor]) -> tuple[DataType, NDArray]:

Callers 1

mainFunction · 0.45

Calls 7

add_meta_archMethod · 0.95
add_meta_vocabMethod · 0.95
write_metaMethod · 0.95
closeMethod · 0.95
check_vocab_sizeFunction · 0.70
OutputFileClass · 0.70

Tested by

no test coverage detected