Validation script fix: conversation error #80
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.
When trying to validate a dataset, if the dataset messages only contain 1 system message, followed by 1 assistant message, such as
the
utils/validate_data.py
script results in a confusing errorThe data in line <line_num> of dataset <path/to/dataset.jsonl> is incorrectly formatted.Conversation must start with a user message or system message
, even though the messages start withsystem
.The issues arises because
finetune/data/tokenize.py
passes the messages without the system prompt to themistral_common/protocol/instruct/validator.py
script, which then throws the error because of if-condition in func_validate_message_list_structure
on line 253.In many training scenarios, the system prompt is directly followed by the model/assistant message and that is the end of the conversation. The current validation flags this as being an erroneous structure, though it should be a valid one. To fix this inconsistency, this PR change adds the system prompt back into the messages for the validation step to fix this issue, and removes it right after the checks.