How to log loss terms in the DPO calculation? #3840
Unanswered
mynameismon
asked this question in
Q&A
Replies: 2 comments
This comment was marked as spam.
This comment was marked as spam.
|
In TRL's 1. Default Metrics via Callbacks / WandB
Make sure you pass your logger in training_args = DPOConfig(
...,
logging_steps=10,
report_to=["wandb"], # or "tensorboard"
)
2. Custom Logging via Method Override
from trl import DPOTrainer
class CustomDPOTrainer(DPOTrainer):
def get_batch_loss_metrics(self, model, batch, train_eval="train"):
loss, metrics = super().get_batch_loss_metrics(model, batch, train_eval=train_eval)
# Log additional customized metrics
prefix = "eval_" if train_eval == "eval" else ""
metrics[f"{prefix}custom_loss_term"] = loss.detach().item()
return loss, metrics |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I want to log both the reference chosen rewards and the model chosen rewards, and similarly for the reference rejected rewards and model rejected rewards. Is there any way to do that?
All reactions