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

Improvements 1a #70

Merged
merged 11 commits into from
Jan 5, 2023
Merged

Improvements 1a #70

merged 11 commits into from
Jan 5, 2023

Conversation

edbeeching
Copy link
Collaborator

This PR:

  • Cleans up setup.py and remove settings.ini (legacy from nbdev)
  • Makes all internal imports relative (e.g. from trl.trainer -> from .trainer)
  • Cleans up README and fixes the example

@edbeeching edbeeching marked this pull request as ready for review January 4, 2023 09:13
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jan 4, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Member

@lvwerra lvwerra left a comment

Choose a reason for hiding this comment

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

Thanks @edbeeching, this looks great! Left a few minor comments, can also address some of them in a follow up PR.

# define a reward for response
# (this could be any reward such as human feedback or output from another model)
reward = [torch.tensor(1.0)]
reward = [torch.tensor(1.0).to(device)]
Copy link
Member

Choose a reason for hiding this comment

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

We should let accelerate handle device placement internally. (Can address it in a follow up PR if you want)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the reward would normally be from a preference model, so it would probably be on the correct device. But in this example that is not the case. I'll leave it to another PR.

Copy link
Member

Choose a reason for hiding this comment

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

yes, discussed with @younesbelkada that we add some device placement steps to PPOTrainer.step.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, this will be addressed in a PR right after merging this

Comment on lines +17 to +21
# isort: off
from .utils import AdaptiveKLController, FixedKLController

# isort: on

Copy link
Member

Choose a reason for hiding this comment

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

Why are the utils imports separate from the others?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This causes a circular import in PPOTrainer if we allow isort to sort the imports. I added a comment. Alternatively, we could exclude these from the init.py file and/or use a relative import in PPOTrainer.

@younesbelkada younesbelkada mentioned this pull request Jan 5, 2023
26 tasks
Copy link
Member

@lvwerra lvwerra left a comment

Choose a reason for hiding this comment

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

Looks good - thanks @edbeeching!

Copy link
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of the improvements @edbeeching !

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.

4 participants