fix bug: grpo train error for deepseek model #4833
Merged
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.
PR type
use deepseek-ai/deepseek-coder-6.7b-base model run grpo algorithm, will find template_meta_prefix error: issue4808
we will find the error in swift/llm/template/base.py _swift_encode(),the concret code as following:
PR information
debug the code will find the prefix value is [[32013]], the token of the prefix befor encode is ‘<|begin▁of▁sentence|>’.
the prompt join the prfix value and user input(str),will raise error, as the issue4808
solution:
we just modify the file swift/trainers/rlhf_trainer/grpo_trainer.py, as this pr:
test script as following, just replace your_own_path in --model, --output_dir, you can test: