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

Method handle_tokenizer_model

tokenizer/convert/convert.py:1019–1031  ·  view source on GitHub ↗
(self, vocab: Vocab)

Source from the content-addressed store, hash-verified

1017 self.gguf.add_file_type(params.ftype)
1018
1019 def handle_tokenizer_model(self, vocab: Vocab) -> str:
1020 # Map the vocab types to the supported tokenizer models
1021 tokenizer_model = {
1022 SentencePieceVocab: "llama",
1023 HfVocab: "llama",
1024 BpeVocab: "gpt2",
1025 }.get(type(vocab))
1026
1027 # Block if vocab type is not predefined
1028 if tokenizer_model is None:
1029 raise ValueError("Unknown vocab type: Not supported")
1030
1031 return tokenizer_model
1032
1033 def extract_vocabulary_from_model(self, vocab: Vocab) -> tuple[list[bytes], list[float], list[gguf.TokenType]]:
1034 tokens = []

Callers 1

add_meta_vocabMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected