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

fix tracking #361

Merged
merged 6 commits into from
May 13, 2022
Merged

fix tracking #361

merged 6 commits into from
May 13, 2022

Conversation

pacman100
Copy link
Contributor

What does this PR do?

  1. When dictionary of metrics is provided to the accelerate tracker, tensorboard wasn't able to log it. Example with dict of metrics is in this transformers script run_glue_no_trainer.py. Fixed support for dictionary of int/float metrics
  2. Fixing examples so that run is created only for the main process else wandb will create num_processes runs with no data.
  3. comet-ml logging wasn't helpful as everything was being logged in others log_others. No plots were being created. Fixing it to be able to get plots for metrics using log_metric and log_metrics.

Post these changes, below are the plots for the run_glue_no_trainer.py script on MRPC task using all trackers.
Screenshot 2022-05-12 at 8 11 16 PM
Screenshot 2022-05-12 at 8 10 51 PM
Screenshot 2022-05-12 at 8 10 17 PM

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 12, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger 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 looking into this!

@@ -293,7 +294,7 @@ def collate_fn(examples):
{
"accuracy": eval_metric["accuracy"],
"f1": eval_metric["f1"],
"train_loss": total_loss,
"train_loss": total_loss.item() if type(total_loss) == torch.Tensor else total_loss,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really have either a Tensor or something else? Can't it always be .item() here?

if args.with_tracking:
accelerator.log(
{
"accuracy": eval_metric["accuracy"],
"f1": eval_metric["f1"],
"train_loss": total_loss,
"train_loss": total_loss.item() if type(total_loss) == torch.Tensor else total_loss,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment

@@ -245,9 +246,10 @@ def collate_fn(examples):
{
"accuracy": eval_metric["accuracy"],
"f1": eval_metric["f1"],
"train_loss": total_loss,
"train_loss": total_loss.item() if type(total_loss) == torch.Tensor else total_loss,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

@sgugger
Copy link
Collaborator

sgugger commented May 12, 2022

Oh, also make sure to edit the title of the PR ;-)

@pacman100 pacman100 changed the title Smangrul/fix tracking fix tracking May 12, 2022
Copy link
Collaborator

@muellerzr muellerzr left a comment

Choose a reason for hiding this comment

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

LG2M, will handle looking at the failing diff test tomorrow morning, as not sure quite what's going on there.

@pacman100 pacman100 merged commit 4736c75 into huggingface:main May 13, 2022
@pacman100 pacman100 deleted the smangrul/fix-tracking branch May 13, 2022 11:50
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.

None yet

4 participants