hf_formatter
langroid/language_models/prompt_formatter/hf_formatter.py
Prompt formatter based on HuggingFace AutoTokenizer.apply_chat_template
method
from their Transformers library. It searches the hub for a model matching the
specified name, and uses the first one it finds. We assume that all matching
models will have the same tokenizer, so we just use the first one.
try_import_hf_modules()
¶
Attempts to import the AutoTokenizer class from the transformers package. Returns: The AutoTokenizer class if successful. Raises: ImportError: If the transformers package is not installed.