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

troyfeng116/hf-trainer #20

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

troyfeng116/hf-trainer #20

wants to merge 4 commits into from

Conversation

troyfeng116
Copy link
Collaborator

No description provided.

@troyfeng116
Copy link
Collaborator Author

troyfeng116 commented Feb 11, 2023

For training:

  • hf_trainer.py + eval_helpers.py

For inference:

  • hf_infer.py

@niansong1996
Copy link
Contributor

As an example, this is how PyTorchLightning (PL) works:

PL Trainer -> DataModule
-> Dataset
-> PLModule
-> Seq2Seq Model
-> validation_step
-> ...

@troyfeng116
Copy link
Collaborator Author

  • See hf_infer.py for HF Trainer basic usage, with documentation

The two ways to inject custom validation behavior into HF Trainer loop I found are 1) compute_metrics and 2) TrainerCallbacks (potentially 3: override methods on transformers.Trainer class directly)

  • In eval_helpers, see attempts to use compute_metrics for training (did not get to work)
  • In hf_infer and hf_train, see attempt to use TrainerCallback (this works)
  • In hf_infer at bottom of file, see attempt to override Trainer class methods (this did not work, but discussed overriding behavior farther up inheritance tree to match with generation)

In general, HF trainer seems to be less well-documented for text generation.

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.

2 participants