fix: mistral nemo does not recognize token_type_ids in forward #2233
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Closes #2225
The issue does not appear for mistral 7b v03 even though they used same source model type
mistral
.Mistral Nemo uses
PreTrainedTokenizerFast
for tokenizer class which returnstoken_type_ids
https://github.com/huggingface/transformers/blob/42865860ec6dc135972d9555753cb7ee17f51fb4/src/transformers/tokenization_utils_base.py#L1397 whereas mistral 7b 03 usesLlamaTokenizer
which doesn't https://github.com/huggingface/transformers/blob/42865860ec6dc135972d9555753cb7ee17f51fb4/src/transformers/models/llama/tokenization_llama.py#L128A more future proof method could be following LlamaFactory where they check the
.forward
signature of the model and droptoken_type_ids
if not foundMotivation and Context
How has this been tested?
Confirmed fixes mistral Nemo for packing.
The issue did not appear without packing from limited testing.
Screenshots (if appropriate)
Types of changes
Social Handles (Optional)