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

Make sure compat PyRecordReader_New reads new data #2342

Merged
merged 5 commits into from
Jun 21, 2019

Conversation

orionr
Copy link
Contributor

@orionr orionr commented Jun 11, 2019

This fixes pytorch/pytorch#20477

It looks like our original compat implementation of PyRecordReader_New didn't continue to try and read content from a file after it had done the original read. This updates the class to continue to request data from the file and read in new events. Note that this would only be seen in the non-TensorFlow case. Here's a test case:

conda create --name notf36 python=3.6
conda activate notf36
pip install --upgrade pip
pip install scipy
conda install -y protobuf
conda install -y absl-py
conda install -y numpy
conda install pytorch-nightly -c pytorch  # For the train.py below
pip install tb-nightly  # For the train.py below
bazel build tensorboard --verbose_failures
./bazel-bin/tensorboard/tensorboard --logdir ../realtime_runs/runs/ --verbosity 2
bazel test //tensorboard/summary/writer:record_writer_test --test_output=errors

While the above is running, execute the following train.py script located in ../realtime_runs/:

import numpy as np
import time

import torch
from torch.utils.tensorboard import SummaryWriter

writer = SummaryWriter()

for i in range(1000000):
    writer.add_scalar('data/s1', i % 100, i)
    # writer.add_scalar('data/s2', i % 200, i)
    # writer.add_scalars('data/scalar_group', {'xsinx': i * np.sin(i), 'xcosx': i * np.cos(i)})
    writer.flush()

    time.sleep(1)

with python train.py

With the old code TensorBoard won't update. With the updated code it will as expected.

cc @nfelt, @natalialunova, @wchargin, @lanpa

@orionr
Copy link
Contributor Author

orionr commented Jun 12, 2019

@nfelt, hopefully we can land #2260 first and then this one.

@nataliakliushkina
Copy link

Looks good!

Copy link
Contributor

@nfelt nfelt left a comment

Choose a reason for hiding this comment

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

Can you add a minimal test for the record reader that at least covers this case and ideally a few other basic ones? I think the fact that this bug persisted is evidence that the implementation is different enough from the original that this really should have tests.

tensorboard/compat/tensorflow_stub/pywrap_tensorflow.py Outdated Show resolved Hide resolved
tensorboard/compat/tensorflow_stub/pywrap_tensorflow.py Outdated Show resolved Hide resolved
@nfelt nfelt self-requested a review June 17, 2019 22:40
tensorboard/summary/writer/record_writer_test.py Outdated Show resolved Hide resolved
@orionr
Copy link
Contributor Author

orionr commented Jun 18, 2019 via email

@orionr
Copy link
Contributor Author

orionr commented Jun 19, 2019

@nfelt if tests pass this should be ready for another review. Much appreciated.

tensorboard/summary/writer/record_writer_test.py Outdated Show resolved Hide resolved
@cswwp
Copy link

cswwp commented Oct 22, 2019

Hi, @nfelt, i have install tb_nightly (version 2.1.0a20191021), and restart tensorboard --log_dir target dir, and it still shows that "TensorFlow installation not found - running with reduced feature set." I'm confused

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.

tensorboard not updating
4 participants