MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / from_pretrained

Method from_pretrained

llama_cpp/llama_tokenizer.py:109–120  ·  view source on GitHub ↗
(cls, pretrained_model_name_or_path: str)

Source from the content-addressed store, hash-verified

107
108 @classmethod
109 def from_pretrained(cls, pretrained_model_name_or_path: str) -> "LlamaHFTokenizer":
110 try:
111 from transformers import AutoTokenizer
112 except ImportError:
113 raise ImportError(
114 "The `transformers` library is required to use the `HFTokenizer`."
115 "You can install it with `pip install transformers`."
116 )
117 hf_tokenizer = AutoTokenizer.from_pretrained(
118 pretrained_model_name_or_path=pretrained_model_name_or_path
119 )
120 return cls(hf_tokenizer)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected