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

Pass existing tensorboard SummaryWriter to Trainer PR (#4019) #4020

Merged
merged 1 commit into from May 4, 2020

Conversation

jaymody
Copy link
Contributor

@jaymody jaymody commented Apr 27, 2020

Implements feature request for issue #4019.

You should be able to pass in you're own SummaryWriters to Trainer via the tb_writer parameter to the __init__ function:

tb_writer = SummaryWriter(log_dir="my_log_dir")
tb_writer.add_hparams(my_hparams_dict, my_metrics_dict)

trainer = Trainer(
    model = model,
    args = training_args,
    train_dataset = train_dataset,
    tb_writer = tb_writer
)

trainer.train()

@codecov-io
Copy link

codecov-io commented Apr 27, 2020

Codecov Report

Merging #4020 into master will increase coverage by 0.00%.
The diff coverage is 66.66%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4020   +/-   ##
=======================================
  Coverage   78.44%   78.45%           
=======================================
  Files         111      111           
  Lines       18518    18520    +2     
=======================================
+ Hits        14527    14529    +2     
  Misses       3991     3991           
Impacted Files Coverage Δ
src/transformers/trainer.py 43.94% <66.66%> (+0.04%) ⬆️
src/transformers/modeling_tf_utils.py 92.76% <0.00%> (ø)
src/transformers/modeling_utils.py 91.06% <0.00%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e817ff...62dbe2d. Read the comment docs.

@jaymody
Copy link
Contributor Author

jaymody commented Apr 27, 2020

Another consideration is that the user might want to add extra details to the log after the training has finished. Right now, the end of the training loop closes the tb_writer, preventing any further logging. Not sure what a reasonable workaround for this is, maybe add a param for the train function that if set to True, will close tb_writer and if False, will keep it open (default: True).

@julien-c
Copy link
Member

julien-c commented May 4, 2020

Looks good, thanks

@julien-c julien-c merged commit 858b1d1 into huggingface:master May 4, 2020
@julien-c julien-c linked an issue May 4, 2020 that may be closed by this pull request
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.

Pass existing tensorboard SummaryWriter to Trainer.
3 participants