Skip to content

deepghs/tbsync

Repository files navigation

tbsync

PyPI PyPI - Python Version Loc Comments

Code Test Package Release codecov

GitHub Org's stars GitHub stars GitHub forks GitHub commit activity GitHub issues GitHub pulls Contributors GitHub license

Sync tools for tensorboard logs

Here is an online demo of a space build with tbsync.

Installation

You can simply install it with pip command line from the official PyPI site.

pip install tbsync

For more information about installation, you can refer to Installation.

Quick Start

Initialize Huggingface Space

Create a space repository on Hugging Face with the command below to start TensorBoard. Prior to this, you can log in using huggingface-cli or authenticate by setting the HF_TOKEN environment variable.

tbsync init -r myuser/my_hf_space

More usage can be viewed with tbsync init --help

Usage: tbsync init [OPTIONS]

  Initialize huggingface space repository.

Options:
  -r, --repository TEXT           Repository on huggingface.  [required]
  -t, --title TEXT                Title of the repository, capitalized
                                  repository name will be used if not given.
  -e, --emoji TEXT                Emoji to use for repository, see emoji
                                  library for details. Random emoji will be
                                  used when not given.
  -p, --private                   Create private repository.
  -l, --licence [openrail|bigscience-openrail-m|creativeml-openrail-m|bigscience-bloom-rail-1.0|bigcode-openrail-m|afl-3.0|apache-2.0|artistic-2.0|bsl-1.0|bsd|bsd-2-clause|bsd-3-clause|bsd-3-clause-clear|c-uda|cc|cc0-1.0|cc-by-2.0|cc-by-2.5|cc-by-3.0|cc-by-4.0|cc-by-sa-3.0|cc-by-sa-4.0|cc-by-nc-2.0|cc-by-nc-3.0|cc-by-nc-4.0|cc-by-nd-4.0|cc-by-nc-nd-3.0|cc-by-nc-nd-4.0|cc-by-nc-sa-2.0|cc-by-nc-sa-3.0|cc-by-nc-sa-4.0|cdla-sharing-1.0|cdla-permissive-1.0|cdla-permissive-2.0|wtfpl|ecl-2.0|epl-1.0|epl-2.0|eupl-1.1|agpl-3.0|gfdl|gpl|gpl-2.0|gpl-3.0|lgpl|lgpl-2.1|lgpl-3.0|isc|lppl-1.3c|ms-pl|mit|mpl-2.0|odc-by|odbl|openrail++|osl-3.0|postgresql|ofl-1.1|tii-falcon-llm|ncsa|unlicense|zlib|pddl|lgpl-lr|deepfloyd-if-license|unknown|other]
                                  Licence for repository.  [default: mit]
  --port INTEGER                  Port of tensorboard in space.  [default:
                                  6006]
  -P, --python_version TEXT       Version of python to use.  [default: 3.8.1]
  -T, --tensorboard_version TEXT  Version of tensorboard to use.
  --from_color [red|yellow|green|blue|indigo|purple|pink|gray]
                                  From color of space block. Random color will
                                  be used when not given.
  --to_color [red|yellow|green|blue|indigo|purple|pink|gray]
                                  To color of space block. Random color will
                                  be used when not given.
  -h, --help                      Show this message and exit.

Upload Tensorboard Log To Space

Upload the tfevents files from the local TensorBoard log path to the Hugging Face space repository using the command below. Prior to this, initialize with the sync init command.

tbsync upload -r myuser/my_hf_space -d /path/to/tb/log

After the upload is complete, Hugging Face space will be rebuilt. Once the rebuild is finished, the TensorBoard log can be viewed in the space.

More usage can be viewed with tbsync sync --help

Usage: tbsync sync [OPTIONS]

  Upload log file to huggingface space repository.

Options:
  -r, --repository TEXT      Repository on huggingface.  [required]
  -d, --directory DIRECTORY  Directory of tensorboard logs, should contain
                             'events.out.tfevents' files.  [required]
  -n, --name TEXT            Name of the log directory on space. Directory
                             name will be used when not given
  -A, --anonymous            Hide the local machine's name when uploading.
  -h, --help                 Show this message and exit.