Fixed issues with mistral-common update #112
Open
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.
I think this fixes Issue #110 .
In one commit of mistral-common, they moved the InstructTokenizerBase to another file (see commit mistral-ai/mistral-common@2c9f1762f8824e5d821840414ecb1b9e5267ffb3).
This required a fix in the import of the InstructTokenizerBase in two files
from mistral_common.tokens.tokenizers.sentencepiece import InstructTokenizerBase to
from mistral_common.tokens.tokenizers.instruct import InstructTokenizerBase
from mistral_common.tokens.tokenizers.sentencepiece import InstructTokenizerBase to
from mistral_common.tokens.tokenizers.instruct import InstructTokenizerBase
Also, afterward, I received another error concerning the updated mistral-common, which I fixed by editing
3. In File "mistral-finetune/finetune/data/tokenize.py", line 180, change validator.validate_messages(messages) to validator.validate_messages(messages, False)
4. In File "mistral-finetune/finetune/data/tokenize.py", line 330, change curr_tokens = instruct_tokenizer.encode_assistant_message(message, is_before_last_user_message=False) to curr_tokens = instruct_tokenizer.encode_assistant_message(message, is_before_last_user_message=False, continue_message=False)
With fixed 3 and 4, I compared the old code of mistral-common to the new code, and I am confident that this is the intended behavior.