tensorflow / tensorboard

TensorFlow's Visualization Toolkit
Apache License 2.0
6.67k stars 1.65k forks source link

Tensor data not being refreshed in Projector #4439

Open fmgs31 opened 3 years ago

fmgs31 commented 3 years ago

Environment information (required)

Diagnostics

Diagnostics output `````` --- check: autoidentify INFO: diagnose_tensorboard.py version ad749c17953187cae68d6c455e8b3fabd3e69096 --- check: general INFO: sys.version_info: sys.version_info(major=3, minor=7, micro=6, releaselevel='final', serial=0) INFO: os.name: nt INFO: os.uname(): N/A INFO: sys.getwindowsversion(): sys.getwindowsversion(major=10, minor=0, build=18363, platform=2, service_pack='') --- check: package_management INFO: has conda-meta: True INFO: $VIRTUAL_ENV: None --- check: installed_packages INFO: installed: tensorboard==2.4.0 WARNING: no installation among: ['tensorflow', 'tensorflow-gpu', 'tf-nightly', 'tf-nightly-2.0-preview', 'tf-nightly-gpu', 'tf-nightly-gpu-2.0-preview'] WARNING: no installation among: ['tensorflow-estimator', 'tensorflow-estimator-2.0-preview', 'tf-estimator-nightly'] --- check: tensorboard_python_version INFO: tensorboard.version.VERSION: '2.4.0' --- check: tensorflow_python_version Traceback (most recent call last): File "diagnose_tensorboard.py", line 495, in main suggestions.extend(check()) File "diagnose_tensorboard.py", line 78, in wrapper result = fn() File "diagnose_tensorboard.py", line 278, in tensorflow_python_version import tensorflow as tf ModuleNotFoundError: No module named 'tensorflow' --- check: tensorboard_binary_path INFO: which tensorboard: b'C:\\Users\\Fran\\Anaconda3\\envs\\py37\\Scripts\\tensorboard.exe\r\n' --- check: addrinfos socket.has_ipv6 = True socket.AF_UNSPEC = socket.SOCK_STREAM = socket.AI_ADDRCONFIG = socket.AI_PASSIVE = Loopback flags: Loopback infos: [(, , 0, '', ('::1', 0, 0, 0)), (, , 0, '', ('127.0.0.1', 0))] Wildcard flags: Wildcard infos: [(, , 0, '', ('::', 0, 0, 0)), (, , 0, '', ('0.0.0.0', 0))] --- check: readable_fqdn INFO: socket.getfqdn(): 'DESKTOP-3QILEV4' --- check: stat_tensorboardinfo INFO: directory: C:\Users\Fran\AppData\Local\Temp\.tensorboard-info INFO: os.stat(...): os.stat_result(st_mode=16895, st_ino=3940649674849896, st_dev=2191977996, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1607467982, st_mtime=1607467982, st_ctime=1606969631) INFO: mode: 0o40777 --- check: source_trees_without_genfiles INFO: tensorboard_roots (1): ['C:\\Users\\Fran\\Anaconda3\\envs\\py37\\lib\\site-packages']; bad_roots (0): [] --- check: full_pip_freeze INFO: pip freeze --all: absl-py==0.11.0 alabaster==0.7.12 altair==4.1.0 anaconda-client==1.7.2 anaconda-project==0.8.3 appdirs==1.4.4 argo-models==2.2.1a0 argon2-cffi @ file:///C:/ci/argon2-cffi_1596828549974/work asn1crypto @ file:///tmp/build/80754af9/asn1crypto_1596577642040/work astor==0.8.1 astroid @ file:///C:/ci/astroid_1592481955828/work astropy==4.0.2 async-generator==1.10 atomicwrites==1.4.0 attrs @ file:///tmp/build/80754af9/attrs_1604765588209/work awscli==1.18.66 awsume==4.4.1 Babel @ file:///tmp/build/80754af9/babel_1605108370292/work backcall==0.2.0 backports.os==0.1.1 backports.shutil-get-terminal-size==1.0.0 base58==2.0.0 bayesian-optimization==1.1.0 beautifulsoup4 @ file:///tmp/build/80754af9/beautifulsoup4_1601924105527/work bitarray @ file:///C:/ci/bitarray_1605065253308/work bkcharts==0.2 bleach @ file:///tmp/build/80754af9/bleach_1600439572647/work blinker==1.4 bokeh @ file:///C:/ci/bokeh_1603297932359/work boto==2.49.0 boto3==1.12.11 botocore==1.12.200 Bottleneck==1.3.2 branca @ file:///home/conda/feedstock_root/build_artifacts/branca_1588860304135/work cachetools==4.0.0 certifi==2020.11.8 cffi @ file:///C:/ci/cffi_1605538148575/work chardet @ file:///C:/ci/chardet_1605303259695/work click==7.1.2 cloudpickle @ file:///tmp/build/80754af9/cloudpickle_1598884132938/work clyent==1.2.2 colorama @ file:///tmp/build/80754af9/colorama_1603211150991/work comtypes==1.1.7 confuse==1.4.0 contextlib2==0.6.0.post1 convertdate==2.1.3 cryptography @ file:///C:/ci/cryptography_1605544557248/work cycler==0.10.0 Cython==0.29.15 cytoolz==0.11.0 dask @ file:///tmp/build/80754af9/dask-core_1602083700509/work decorator==4.4.2 defusedxml==0.6.0 Deprecated==1.2.7 dill==0.3.1.1 distlib==0.3.1 distributed @ file:///C:/ci/distributed_1605066566400/work docutils==0.16 entrypoints==0.3 enum-compat==0.0.3 ephem @ file:///C:/ci/ephem_1600355485214/work et-xmlfile==1.0.1 fastcache==1.1.0 fbprophet==0.6 filelock==3.0.12 Flask==1.1.2 folium @ file:///home/conda/feedstock_root/build_artifacts/folium_1588861378954/work fsspec @ file:///tmp/build/80754af9/fsspec_1602684995936/work future==0.18.2 geographiclib==1.50 geopy==2.0.0 gevent @ file:///C:/ci/gevent_1601397624717/work glob2==0.7 gluonts==0.4.2 google-api-core==1.16.0 google-auth==1.11.2 google-auth-oauthlib==0.4.2 google-cloud-bigquery==1.25.0 google-cloud-core==1.3.0 google-cloud-storage==1.26.0 google-resumable-media==0.5.0 googleapis-common-protos==1.51.0 googlemaps==4.3.1 greenlet @ file:///C:/ci/greenlet_1600874076725/work grpcio @ file:///D:/bld/grpcio_1594576989517/work h5py==2.10.0 HeapDict==1.0.1 holidays==0.9.12 html5lib @ file:///tmp/build/80754af9/html5lib_1593446221756/work htmlmin==0.1.12 hypothesis @ file:///tmp/build/80754af9/hypothesis_1606145406157/work idna @ file:///tmp/build/80754af9/idna_1593446292537/work ImageHash==4.2.0 imageio @ file:///tmp/build/80754af9/imageio_1594161405741/work imagesize==1.2.0 ipython @ file:///C:/ci/ipython_1604101327119/work ipython-genutils==0.2.0 ipywidgets @ file:///tmp/build/80754af9/ipywidgets_1601490159889/work isort @ file:///tmp/build/80754af9/isort_1602603989581/work isoweek==1.3.3 itsdangerous==1.1.0 jdcal==1.4.1 jedi==0.16.0 Jinja2==2.11.2 jmespath==0.9.5 joblib @ file:///tmp/build/80754af9/joblib_1601912903842/work json5==0.9.5 jsonschema @ file:///tmp/build/80754af9/jsonschema_1602607155483/work jupyter==1.0.0 jupyter-client @ file:///tmp/build/80754af9/jupyter_client_1601311786391/work jupyter-console @ file:///tmp/build/80754af9/jupyter_console_1598884538475/work jupyter-core @ file:///C:/ci/jupyter_core_1606130908768/work jupyterlab==2.2.6 jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work jupyterlab-server @ file:///tmp/build/80754af9/jupyterlab_server_1594164409481/work keyring @ file:///C:/ci/keyring_1601488971022/work kfp==0.2.5 kfp-server-api==0.1.40 kiwisolver @ file:///C:/ci/kiwisolver_1603996595157/work kubernetes==10.0.0 lazy-object-proxy==1.4.3 libarchive-c==2.9 llvmlite==0.34.0 locket==0.2.0 LunarCalendar==0.0.9 lxml @ file:///C:/ci/lxml_1603216364379/work Markdown==3.3.3 MarkupSafe @ file:///C:/ci/markupsafe_1594405949945/work matplotlib==3.3.3 mccabe==0.6.1 menuinst==1.4.16 missingno==0.4.2 mistune @ file:///C:/ci/mistune_1594373272338/work mkl-fft==1.2.0 mkl-random==1.1.1 mkl-service==2.3.0 mock==4.0.2 more-itertools @ file:///tmp/build/80754af9/more-itertools_1605111547926/work mpmath==1.1.0 msgpack==1.0.0 multipledispatch==0.6.0 mxnet==1.4.1 nbclient @ file:///tmp/build/80754af9/nbclient_1602783176460/work nbconvert @ file:///C:/ci/nbconvert_1601914921407/work nbformat @ file:///tmp/build/80754af9/nbformat_1602783287752/work nest-asyncio @ file:///tmp/build/80754af9/nest-asyncio_1606153767164/work networkx @ file:///tmp/build/80754af9/networkx_1598376031484/work nltk @ file:///tmp/build/80754af9/nltk_1592496090529/work nose @ file:///C:/ci/nose_1594377973236/work notebook @ file:///C:/ci/notebook_1601494955742/work numba==0.51.2 numexpr==2.7.1 numpy @ file:///C:/ci/numpy_and_numpy_base_1603468620949/work numpydoc @ file:///tmp/build/80754af9/numpydoc_1605117425582/work oauthlib==3.1.0 olefile==0.46 openpyxl @ file:///tmp/build/80754af9/openpyxl_1598113097404/work packaging==20.4 pandas @ file:///C:/ci/pandas_1602088205210/work pandas-profiling==2.9.0 pandocfilters @ file:///C:/ci/pandocfilters_1605102427207/work parso @ file:///tmp/build/80754af9/parso_1596826841367/work partd==1.1.0 path @ file:///C:/ci/path_1596940809557/work pathlib2 @ file:///C:/ci/pathlib2_1594381094851/work pathtools==0.1.2 patsy==0.5.1 pep8==1.7.1 phik==0.10.0 pickle5 @ file:///D:/bld/pickle5_1592859470301/work pickleshare @ file:///C:/ci/pickleshare_1594374056827/work Pillow @ file:///C:/ci/pillow_1603821929285/work pip==20.2.4 pipenv==2020.6.2 pkginfo==1.6.1 pluggy==0.13.1 prometheus-client==0.8.0 prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1602688806899/work protobuf==3.11.3 psutil @ file:///C:/ci/psutil_1598352273540/work psycopg2-binary==2.8.5 py @ file:///tmp/build/80754af9/py_1593446248552/work pyarrow==0.17.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 PyAthena @ file:///home/conda/feedstock_root/build_artifacts/pyathena_1593325710681/work pycodestyle==2.6.0 pycosat==0.6.3 pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work pycrypto==2.6.1 pycurl==7.43.0.6 pydantic==1.4 pydeck==0.3.1 pyflakes==2.2.0 Pygments @ file:///tmp/build/80754af9/pygments_1604103097372/work PyJWT==1.7.1 pylint @ file:///C:/ci/pylint_1598605958085/work pyodbc===4.0.0-unsupported pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1605545627475/work pyparsing==2.4.7 pyreadline==2.1 pyrsistent @ file:///C:/ci/pyrsistent_1600123688363/work PySocks @ file:///C:/ci/pysocks_1594394709107/work pystan==2.19.0.0 pytest==0.0.0 pytest-arraydiff==0.3 pytest-astropy==0.8.0 pytest-astropy-header==0.1.2 pytest-doctestplus @ file:///tmp/build/80754af9/pytest-doctestplus_1598624048543/work pytest-openfiles==0.5.0 pytest-remotedata==0.3.2 python-dateutil==2.8.1 pytz==2019.3 PyWavelets @ file:///C:/ci/pywavelets_1601658407053/work pywin32==227 pywin32-ctypes @ file:///C:/ci/pywin32-ctypes_1594392691209/work pywinpty==0.5.7 PyYAML==5.3.1 pyzmq==18.1.1 QtAwesome @ file:///tmp/build/80754af9/qtawesome_1602272867890/work qtconsole @ file:///tmp/build/80754af9/qtconsole_1600870028330/work QtPy==1.9.0 regex @ file:///C:/ci/regex_1602782614108/work requests==2.25.0 requests-oauthlib==1.3.0 requests-toolbelt==0.9.1 rope @ file:///tmp/build/80754af9/rope_1602264064449/work rsa==3.4.2 ruamel-yaml==0.15.87 s3transfer==0.3.3 scikit-image==0.17.2 scikit-learn @ file:///C:/ci/scikit-learn_1598376983131/work scipy @ file:///C:/ci/scipy_1597686737426/work seaborn @ file:///tmp/build/80754af9/seaborn_1600553570093/work Send2Trash==1.5.0 setuptools==50.3.1.post20201107 simplegeneric==0.8.1 singledispatch @ file:///tmp/build/80754af9/singledispatch_1602523705405/work six @ file:///C:/ci/six_1605205426665/work snowballstemmer==2.0.0 sortedcollections==1.2.1 sortedcontainers==2.2.2 soupsieve==2.0.1 Sphinx @ file:///tmp/build/80754af9/sphinx_1597428793432/work sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==1.0.3 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.4 sphinxcontrib-websupport @ file:///tmp/build/80754af9/sphinxcontrib-websupport_1597081412696/work spyder==3.3.6 spyder-kernels==0.5.2 SQLAlchemy @ file:///C:/ci/sqlalchemy_1603818968375/work statsmodels==0.11.0 streamlit==0.59.0 strip-hints==0.1.8 sympy @ file:///C:/ci/sympy_1605119633474/work tables==3.6.1 tabulate==0.8.3 tangled-up-in-unicode==0.0.6 tblib @ file:///tmp/build/80754af9/tblib_1597928476713/work tenacity @ file:///C:/ci/tenacity_1597706758985/work tensorboard==2.4.0 tensorboard-plugin-wit==1.7.0 terminado==0.9.1 testpath==0.4.4 threadpoolctl @ file:///tmp/tmp9twdgx9k/threadpoolctl-2.1.0-py3-none-any.whl tifffile==2020.10.1 toml @ file:///tmp/build/80754af9/toml_1592853716807/work toolz @ file:///tmp/build/80754af9/toolz_1601054250827/work torch==1.4.0 torchvision==0.5.0 tornado==6.0.4 tqdm==4.43.0 traitlets @ file:///tmp/build/80754af9/traitlets_1602787416690/work typed-ast==1.4.1 typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1598376058250/work tzlocal==2.0.0 ujson==1.35 unicodecsv==0.14.1 urllib3==1.24.3 validators==0.15.0 virtualenv==20.0.30 virtualenv-clone==0.5.4 visions==0.5.0 watchdog==0.10.2 wcwidth @ file:///tmp/build/80754af9/wcwidth_1593447189090/work webencodings==0.5.1 websocket-client==0.57.0 Werkzeug==1.0.1 wheel==0.35.1 widgetsnbextension==3.5.1 win-inet-pton @ file:///C:/ci/win_inet_pton_1605306165655/work win-unicode-console==0.5 wincertstore==0.2 wrapt==1.11.2 xlrd==1.2.0 XlsxWriter @ file:///tmp/build/80754af9/xlsxwriter_1602692860603/work xlwings==0.20.8 xlwt==1.3.0 zict==2.0.0 zipp @ file:///tmp/build/80754af9/zipp_1604001098328/work zope.event==4.5.0 zope.interface @ file:///C:/ci/zope.interface_1602002496598/work ``````

System version:

Issue description

Tensor data not being refreshed in Projector. When the page is refreshed, tensorboard does not update the tensor data if it has changed. It only refreshes the metadata file. This is more obvious when the tensor data size changes. In that case, it shows a mismatch error in size ("Number of tensors do not match the number of lines in metadata") . The whole log folder can be even deleted and tensorboard still shows the old tensor data. It's catching the first tensor available after running the projector. The workaround is to close the server and running it again.

rmothukuru commented 3 years ago

@fmgs31, In order to expedite the trouble-shooting process, please provide a code snippet to reproduce the issue reported here. Thanks!

rmothukuru commented 3 years ago

@fmgs31, Can you please respond to the above comment. Thanks!

fmgs31 commented 3 years ago

Sure, sorry for the delay.

Set the content of projector_config.pbtxt to:

embeddings {
  tensor_name: "default:00000"
  tensor_path: "tensors.tsv"
  metadata_path: "metadata.tsv"
}

Data A

metadata = pd.DataFrame({'label':np.array(['a', 'b', 'c', 'd'])}, ) embeddings = pd.DataFrame({'d1':np.array([10,20,30,40]), 'd2':np.array([10,20,30,40]), 'd3':np.array([10,20,30,40])})

Data B

metadata = pd.DataFrame({'label':np.array(['x', 'y'])}, )

embeddings = pd.DataFrame({'d1':np.array([1,0]), 'd2':np.array([0,0]), 'd3':np.array([1,1])})

embeddings.to_csv('logs/tensors.tsv', sep = '\t', header=False, index=False) metadata.to_csv('logs/metadata.tsv', sep = '\t')

- Execute "tensoboard --logdir logs". Open the projector. Check the 4 data points. Check the labels 'a',  'b', 'c', 'd'
- Run:

import numpy as np import pandas as pd

Data A

metadata = pd.DataFrame({'label':np.array(['a', 'b', 'c', 'd'])}, )

embeddings = pd.DataFrame({'d1':np.array([10,20,30,40]), 'd2':np.array([10,20,30,40]), 'd3':np.array([10,20,30,40])})

Data B

metadata = pd.DataFrame({'label':np.array(['x', 'y'])}, ) embeddings = pd.DataFrame({'d1':np.array([1,0]), 'd2':np.array([0,0]), 'd3':np.array([1,1])})

embeddings.to_csv('logs/tensors.tsv', sep = '\t', header=False, index=False) metadata.to_csv('logs/metadata.tsv', sep = '\t')


- Refresh the projector page. The 4 old data points are there. The labels are new. Some points don't have labels. Error is displayed when after the refresh.
- Restart the tensorboard server
- Open the projector. The new 2 points are now shown with the new labels. The error has gone.
rmothukuru commented 3 years ago

@fmgs31, When trying to reproduce your issue, I get the message, "No Dashboards are Active" on the Tensorboard screen. Can you please help us to reproduce your issue by adding the relevant code in this Gist. Thanks!

fmgs31 commented 3 years ago

Actually, can see the same error you are mention in Gist. There is actually no checkpoint there (this is not using tensorflow but pytorch). My environment there is tensorboard version 2.3.0. (Which version is the one in the notebook?)

I installed tensorboard via 'pip install tensorboard' Followed this instructions.

By the way, this is a another form for my previous code (the results are the same, but may help understanding the context).

import numpy as np
from torch.utils.tensorboard import SummaryWriter

# Data A
# 4 data points
embeddings = np.array([[10, 10, 10],
                       [20, 20, 20],
                       [30, 30, 30],
                       [40, 40, 40]])
metadata =  ['a', 'b', 'c', 'd']

# Data B
# 2 data points
# embeddings = np.array([[1, 0, 1],
#                    [0, 0, 1]])
# metadata =  ['x', 'y']

summary_writer = SummaryWriter('logs')
summary_writer.add_embedding(embeddings, metadata=metadata)