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

Log additional test metrics with the CometCallback #33124

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/transformers/integrations/integration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,8 +1107,9 @@ def on_log(self, args, state, control, model=None, logs=None, **kwargs):
self.setup(args, state, model)
if state.is_world_process_zero:
if self._experiment is not None:
rewritten_logs = rewrite_logs(logs)
self._experiment.__internal_api__log_metrics__(
logs, step=state.global_step, epoch=state.epoch, framework="transformers"
rewritten_logs, step=state.global_step, epoch=state.epoch, framework="transformers"
)

def on_train_end(self, args, state, control, **kwargs):
Expand All @@ -1125,6 +1126,15 @@ def on_train_end(self, args, state, control, **kwargs):
self._experiment.clean()
self._initialized = False

def on_predict(self, args, state, control, metrics, **kwargs):
if not self._initialized:
self.setup(args, state, model=None)
if state.is_world_process_zero and self._experiment is not None:
rewritten_metrics = rewrite_logs(metrics)
self._experiment.__internal_api__log_metrics__(
rewritten_metrics, step=state.global_step, epoch=state.epoch, framework="transformers"
)


class AzureMLCallback(TrainerCallback):
"""
Expand Down
Loading