Skip to content

Conversation

@qgallouedec
Copy link
Member

@qgallouedec qgallouedec commented Oct 18, 2024

What does this PR do?

follows huggingface/transformers#34198

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?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec qgallouedec changed the title Rename get_batch_sample and add num_items_in_batch to compute_loss 🔀 Rename get_batch_sample and add num_items_in_batch to compute_loss Oct 18, 2024
@qgallouedec qgallouedec requested review from kashif and lewtun October 18, 2024 10:09
@qgallouedec qgallouedec marked this pull request as ready for review October 18, 2024 10:09
Copy link
Member

@lewtun lewtun 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 the fast fix! LGTM and I left a comment about some follow-up cleaning we can do with these generate methods in favour of extending the LogCompletions callback

return SequentialSampler(self.train_dataset)

def get_batch_samples(self, model, batch: Dict[str, torch.LongTensor]) -> Tuple[str, str]:
def generate_from_model_and_ref(self, model, batch: Dict[str, torch.LongTensor]) -> Tuple[str, str]:
Copy link
Member

Choose a reason for hiding this comment

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

Note for future: now that we have LogCompletions callback, it might be possible to enable the generative aspects of this method directly as a callback. We'd probably have to extend the LogCompletions callback to check if a reference model exists and generate for that too, but that seems better than having this code duplicated all over our preference trainers

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.

TypeError: XPOTrainer.training_step() takes 3 positional arguments but 4 were given

4 participants