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

Method write_vocab_only

convert-dense.py:888–900  ·  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

886
887 @staticmethod
888 def write_vocab_only(fname_out: Path, params: Params, vocab: Vocab, svocab: gguf.SpecialVocab, endianess:gguf.GGUFEndian=gguf.GGUFEndian.LITTLE) -> None:
889 check_vocab_size(params, vocab)
890
891 of = OutputFile(fname_out, params.arch, endianess=endianess)
892
893 # meta data
894 of.add_meta_arch(params)
895 of.add_meta_vocab(vocab)
896 of.add_meta_special_vocab(svocab)
897
898 of.write_meta()
899
900 of.close()
901
902 @staticmethod
903 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