Skip to content

Commit

Permalink
fix issue with hparams logging to Comet (#626)
Browse files Browse the repository at this point in the history
* fix issue with hparams logging to Comet

* fix linting with autopep8

* update README with comet links

* update utms in Comet link
  • Loading branch information
DN6 committed Jun 10, 2021
1 parent 1f774cf commit 54b2279
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ writer.close()

<img src="screenshots/Demo.gif">

## Using TensorboardX with Comet

TensorboardX now supports logging directly to [Comet](https://www.comet.ml/site/data-scientists/?utm_campaign=tensorboardx-integration&utm_source=github&utm_medium=readme). Comet is a **free** cloud based solution that allows you to automatically track, compare and explain your experiments. It adds a lot of functionality on top of tensorboard such as dataset management, diffing experiments, seeing the code that generated the results and more.

This works out of the box and just require an additional line of code. See a full code example in this [Colab Notebook](https://colab.research.google.com/drive/1cTO3tgZ03nuJQ8kOjZhEiwbB-45tV4lm?usp=sharing)

<p align="center">
<img src="screenshots/comet.gif" width="750" height="400">
</p>

## Tweaks

To add more ticks for the slider (show more image history), check https://github.com/lanpa/tensorboardX/issues/44 or
Expand Down
Binary file added screenshots/comet.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion tensorboardX/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
class DummyFileWriter(object):
"""A fake file writer that writes nothing to the disk.
"""

def __init__(self, logdir):
self._logdir = logdir

Expand Down Expand Up @@ -400,12 +401,12 @@ def add_hparams(
name = str(time.time())

with SummaryWriter(logdir=os.path.join(self.file_writer.get_logdir(), name)) as w_hp:
w_hp.comet_logger.log_parameters(hparam_dict, step=global_step)
w_hp.file_writer.add_summary(exp)
w_hp.file_writer.add_summary(ssi)
w_hp.file_writer.add_summary(sei)
for k, v in metric_dict.items():
w_hp.add_scalar(k, v, global_step)
self.comet_logger.log_parameters(hparam_dict, step=global_step)

def add_scalar(
self,
Expand Down

0 comments on commit 54b2279

Please sign in to comment.