What shoud I do if an LLM model in huggingface transformers do not have a pad_token in…
- User
What shoud I do if an LLM model in huggingface transformers do not have a pad_token in its tokenizer, but I need to do batch inference?
- Assistant
If an LLM model in Hugging Face Transformers does not have a
pad_tokendefined in its tokenizer, but you need to perform batch inference, you can manually define a padding token and add it to the tokenizer. Here's how you can do it:-
Choose a token that is not already present in the model's vocabulary to use as the padding token. A common choice is or .
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.