Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added eos token for ppotrainer #2420

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

dame-cell
Copy link

@dame-cell dame-cell commented Nov 30, 2024

What does this PR do?

Fixes 2387

  • not sure if this works correctly ,might be missing some thing
  • I added the use use_model_eos_token in the ppo_conifg.py to add kind of a way for the user to make configuration ,
    do we like this or just make it default with no configuration ?
  • second do i need to write documentation since i added some new stuff to the config?

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines.
  • Did you write any new necessary tests?

Who can review?

@qgallouedec

self.model.generation_config.eos_token_id = self.processing_class.eos_token_id
elif hasattr(self.model.config, "eos_token_id") and self.args.use_model_eos_token:
# Fallback to model config's EOS token
self.model.generation_config.eos_token_id = self.model.config.eos_token_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this line is enough? Why would we need two options?

Copy link
Author

@dame-cell dame-cell Dec 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remove this line

elif hasattr(self.model.config, "eos_token_id") and self.args.use_model_eos_token:
    # Fallback to model config's EOS token
    self.model.generation_config.eos_token_id = self.model.config.eos_token_id

and kept the one which uses the tokenizer

I tested it locally and it seems to be doing fine the training was done perfectly with and without the eos_token_id
Do i need to like write custom tests or documentation ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eos_token config in PPOTrainer
2 participants