Skip to content

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.

3 participants