tbparse


Nametbparse JSON
Version 0.0.9 PyPI version JSON
download
home_pagehttps://github.com/j3soon/tbparse
SummaryLoad tensorboard event logs as pandas DataFrames; Read, parse, and plot tensorboard event logs with ease!
upload_time2024-08-16 04:37:50
maintainerNone
docs_urlNone
authorJohnson
requires_python>=3.8
licenseNone
keywords package parser plot python pytorch reader tensorboard tensorboardx tensorflow
VCS
bugtrack_url
requirements torch pandas tensorflow tensorboard tensorboardX sphinx seaborn sphinx_rtd_theme sphinx-tabs nbsphinx
Travis-CI No Travis.
coveralls test coverage
            # tbparse

[![pypi](https://img.shields.io/pypi/v/tbparse)](https://pypi.org/project/tbparse/)
[![python](https://img.shields.io/pypi/pyversions/tbparse)](https://pypi.org/project/tbparse/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/tbparse)](https://pypistats.org/packages/tbparse)
[![license](https://img.shields.io/pypi/l/tbparse)](https://github.com/j3soon/tbparse/blob/master/LICENSE)

[![tests](https://img.shields.io/github/actions/workflow/status/j3soon/tbparse/test-with-tox.yaml?label=tests)](https://github.com/j3soon/tbparse/actions/workflows/test-with-tox.yaml)
[![build](https://img.shields.io/github/actions/workflow/status/j3soon/tbparse/publish-to-pypi.yaml)](https://github.com/j3soon/tbparse/actions/workflows/publish-to-pypi.yaml)
[![doc](https://readthedocs.org/projects/tbparse/badge/?version=latest)](https://tbparse.readthedocs.io/en/latest)
[![codecov](https://codecov.io/gh/j3soon/tbparse/branch/master/graph/badge.svg?token=ASxeqFrMom)](https://codecov.io/gh/j3soon/tbparse)

[![OpenĀ InĀ Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/j3soon/tbparse/blob/master/docs/notebooks/gallery-pytorch.ipynb)

A simple yet powerful tensorboard event log parser/reader.

* Supports parsing tensorboard event [scalars][parsing-scalars], [tensors][parsing-tensors], [histograms][parsing-histograms], [images][parsing-images], [audio][parsing-audio], [hparams][parsing-hparams], and [text][parsing-text].
* Supports event generated by
  [PyTorch](https://pytorch.org/docs/stable/tensorboard.html), [Tensorboard/Keras](https://www.tensorflow.org/tensorboard), and [TensorboardX](https://github.com/lanpa/tensorboardX), with their respective usage examples documented in detail.
* Allows parsing multiple tensorboard event files in a hierarchical directory structure.
* Provides plotting examples for each type of events.
* Stores the data in [pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html) to allow advanced filtering.
* Both the documentation and code have high test coverage rate.
* Follows [PEP 484](https://www.python.org/dev/peps/pep-0484/) with full type hints.

Installation:

```sh
pip install -U tbparse # requires Python >= 3.8
```

We suggest using an additional virtual environment for parsing and plotting the tensorboard events. So no worries if your training code uses Python 3.6 or older versions.

Reading one or more event files with tbparse only requires 5 lines of code:

```py
from tbparse import SummaryReader
log_dir = "<PATH_TO_EVENT_FILE_OR_DIRECTORY>"
reader = SummaryReader(log_dir)
df = reader.scalars
print(df)
```

If you want an additional column with directory names (i.e., run names), change line 3 above to the following:

```py
reader = SummaryReader(log_dir, extra_columns={'dir_name'})
```

For further information, start from the page: [Parsing Scalars][parsing-scalars].

## Gallery

| Event Type                       | Tensorboard Dashboard                        | tbparse                                 |
|----------------------------------|----------------------------------------------|-----------------------------------------|
| [Scalars][parsing-scalars]       | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/scalars.png)    | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/scalars.png)    |
| [Tensors][parsing-tensors]       | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/tensors.png)    | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/tensors.png)    |
| [Histograms][parsing-histograms] | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/histograms.png) | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/histograms.png) |
| [Images][parsing-images]         | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/images.png)     | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/images.png)     |
| [Audio][parsing-audio]           | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/audio.png)      | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/audio.png)      |
| [HParams][parsing-hparams]       | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/hparams.png)    | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/hparams.png)    |
| [Text][parsing-text]             | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/text.png)       | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/text.png)       |

[parsing-scalars]: https://tbparse.readthedocs.io/en/latest/pages/parsing-scalars.html
[parsing-tensors]: https://tbparse.readthedocs.io/en/latest/pages/parsing-tensors.html
[parsing-histograms]: https://tbparse.readthedocs.io/en/latest/pages/parsing-histograms.html
[parsing-images]: https://tbparse.readthedocs.io/en/latest/pages/parsing-images.html
[parsing-audio]: https://tbparse.readthedocs.io/en/latest/pages/parsing-audio.html
[parsing-hparams]: https://tbparse.readthedocs.io/en/latest/pages/parsing-hparams.html
[parsing-text]: https://tbparse.readthedocs.io/en/latest/pages/parsing-text.html

All events above are generated and plotted in [gallery-pytorch.ipynb](https://github.com/j3soon/tbparse/blob/master/docs/notebooks/gallery-pytorch.ipynb).

## Installation

```sh
pip install tensorflow # optional, only required if you want to parse images and audio
pip install -U tbparse # requires Python >= 3.8
```

**Note**: For details on when TensorFlow is required, see [Installing without TensorFlow](https://tbparse.readthedocs.io/en/latest/pages/installation.html#installing-without-tensorflow).

## Testing the Source Code

Test source code:

```sh
python3 -m pip install tox
python3 -m tox
```

Test and build documentation:

```sh
cd docs
make clean
# sphinx-tabs seems to require html be built before doctest
make html
make doctest
```

Generate test coverage:

```sh
python3 -m pip install pandas tensorflow torch tensorboardX pytest pytest-cov
python3 -m pytest --cov=./ --cov-report html
```

## License

tbparse is distributed under the [Apache License 2.0](LICENSE).

The tbparse PyPI package depends on (imports) the following third-party package. Each third-party software package is provided under its own license:
- [pandas](https://github.com/pandas-dev/pandas) is distributed under the [BSD-3-Clause License ](https://github.com/pandas-dev/pandas/blob/main/LICENSE)
- [tensorboard](https://github.com/tensorflow/tensorboard) is distributed under the [Apache License 2.0](https://github.com/tensorflow/tensorboard/blob/master/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/j3soon/tbparse",
    "name": "tbparse",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "package, parser, plot, python, pytorch, reader, tensorboard, tensorboardx, tensorflow",
    "author": "Johnson",
    "author_email": "j3.soon777@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/97/0b/553a13cb39f8ccad888c2d9b07e04cb1a60011e1073771fd6b5d904b61c4/tbparse-0.0.9.tar.gz",
    "platform": null,
    "description": "# tbparse\n\n[![pypi](https://img.shields.io/pypi/v/tbparse)](https://pypi.org/project/tbparse/)\n[![python](https://img.shields.io/pypi/pyversions/tbparse)](https://pypi.org/project/tbparse/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/tbparse)](https://pypistats.org/packages/tbparse)\n[![license](https://img.shields.io/pypi/l/tbparse)](https://github.com/j3soon/tbparse/blob/master/LICENSE)\n\n[![tests](https://img.shields.io/github/actions/workflow/status/j3soon/tbparse/test-with-tox.yaml?label=tests)](https://github.com/j3soon/tbparse/actions/workflows/test-with-tox.yaml)\n[![build](https://img.shields.io/github/actions/workflow/status/j3soon/tbparse/publish-to-pypi.yaml)](https://github.com/j3soon/tbparse/actions/workflows/publish-to-pypi.yaml)\n[![doc](https://readthedocs.org/projects/tbparse/badge/?version=latest)](https://tbparse.readthedocs.io/en/latest)\n[![codecov](https://codecov.io/gh/j3soon/tbparse/branch/master/graph/badge.svg?token=ASxeqFrMom)](https://codecov.io/gh/j3soon/tbparse)\n\n[![Open\u00a0In\u00a0Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/j3soon/tbparse/blob/master/docs/notebooks/gallery-pytorch.ipynb)\n\nA simple yet powerful tensorboard event log parser/reader.\n\n* Supports parsing tensorboard event [scalars][parsing-scalars], [tensors][parsing-tensors], [histograms][parsing-histograms], [images][parsing-images], [audio][parsing-audio], [hparams][parsing-hparams], and [text][parsing-text].\n* Supports event generated by\n  [PyTorch](https://pytorch.org/docs/stable/tensorboard.html), [Tensorboard/Keras](https://www.tensorflow.org/tensorboard), and [TensorboardX](https://github.com/lanpa/tensorboardX), with their respective usage examples documented in detail.\n* Allows parsing multiple tensorboard event files in a hierarchical directory structure.\n* Provides plotting examples for each type of events.\n* Stores the data in [pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html) to allow advanced filtering.\n* Both the documentation and code have high test coverage rate.\n* Follows [PEP 484](https://www.python.org/dev/peps/pep-0484/) with full type hints.\n\nInstallation:\n\n```sh\npip install -U tbparse # requires Python >= 3.8\n```\n\nWe suggest using an additional virtual environment for parsing and plotting the tensorboard events. So no worries if your training code uses Python 3.6 or older versions.\n\nReading one or more event files with tbparse only requires 5 lines of code:\n\n```py\nfrom tbparse import SummaryReader\nlog_dir = \"<PATH_TO_EVENT_FILE_OR_DIRECTORY>\"\nreader = SummaryReader(log_dir)\ndf = reader.scalars\nprint(df)\n```\n\nIf you want an additional column with directory names (i.e., run names), change line 3 above to the following:\n\n```py\nreader = SummaryReader(log_dir, extra_columns={'dir_name'})\n```\n\nFor further information, start from the page: [Parsing Scalars][parsing-scalars].\n\n## Gallery\n\n| Event Type                       | Tensorboard Dashboard                        | tbparse                                 |\n|----------------------------------|----------------------------------------------|-----------------------------------------|\n| [Scalars][parsing-scalars]       | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/scalars.png)    | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/scalars.png)    |\n| [Tensors][parsing-tensors]       | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/tensors.png)    | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/tensors.png)    |\n| [Histograms][parsing-histograms] | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/histograms.png) | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/histograms.png) |\n| [Images][parsing-images]         | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/images.png)     | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/images.png)     |\n| [Audio][parsing-audio]           | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/audio.png)      | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/audio.png)      |\n| [HParams][parsing-hparams]       | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/hparams.png)    | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/hparams.png)    |\n| [Text][parsing-text]             | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tb-dashboard/text.png)       | ![](https://raw.githubusercontent.com/j3soon/tbparse/master/docs/images/tbparse/text.png)       |\n\n[parsing-scalars]: https://tbparse.readthedocs.io/en/latest/pages/parsing-scalars.html\n[parsing-tensors]: https://tbparse.readthedocs.io/en/latest/pages/parsing-tensors.html\n[parsing-histograms]: https://tbparse.readthedocs.io/en/latest/pages/parsing-histograms.html\n[parsing-images]: https://tbparse.readthedocs.io/en/latest/pages/parsing-images.html\n[parsing-audio]: https://tbparse.readthedocs.io/en/latest/pages/parsing-audio.html\n[parsing-hparams]: https://tbparse.readthedocs.io/en/latest/pages/parsing-hparams.html\n[parsing-text]: https://tbparse.readthedocs.io/en/latest/pages/parsing-text.html\n\nAll events above are generated and plotted in [gallery-pytorch.ipynb](https://github.com/j3soon/tbparse/blob/master/docs/notebooks/gallery-pytorch.ipynb).\n\n## Installation\n\n```sh\npip install tensorflow # optional, only required if you want to parse images and audio\npip install -U tbparse # requires Python >= 3.8\n```\n\n**Note**: For details on when TensorFlow is required, see [Installing without TensorFlow](https://tbparse.readthedocs.io/en/latest/pages/installation.html#installing-without-tensorflow).\n\n## Testing the Source Code\n\nTest source code:\n\n```sh\npython3 -m pip install tox\npython3 -m tox\n```\n\nTest and build documentation:\n\n```sh\ncd docs\nmake clean\n# sphinx-tabs seems to require html be built before doctest\nmake html\nmake doctest\n```\n\nGenerate test coverage:\n\n```sh\npython3 -m pip install pandas tensorflow torch tensorboardX pytest pytest-cov\npython3 -m pytest --cov=./ --cov-report html\n```\n\n## License\n\ntbparse is distributed under the [Apache License 2.0](LICENSE).\n\nThe tbparse PyPI package depends on (imports) the following third-party package. Each third-party software package is provided under its own license:\n- [pandas](https://github.com/pandas-dev/pandas) is distributed under the [BSD-3-Clause License ](https://github.com/pandas-dev/pandas/blob/main/LICENSE)\n- [tensorboard](https://github.com/tensorflow/tensorboard) is distributed under the [Apache License 2.0](https://github.com/tensorflow/tensorboard/blob/master/LICENSE)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Load tensorboard event logs as pandas DataFrames; Read, parse, and plot tensorboard event logs with ease!",
    "version": "0.0.9",
    "project_urls": {
        "Changelog": "https://github.com/j3soon/tbparse/blob/master/docs/pages/changelog.rst",
        "Homepage": "https://github.com/j3soon/tbparse",
        "Issues": "https://github.com/j3soon/tbparse/issues",
        "Source Code": "https://github.com/j3soon/tbparse"
    },
    "split_keywords": [
        "package",
        " parser",
        " plot",
        " python",
        " pytorch",
        " reader",
        " tensorboard",
        " tensorboardx",
        " tensorflow"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "177a56818acfbf03ef6eae4c3e0a7091ab6ffd8c3b44af93f2982297c07b50f2",
                "md5": "8799e0898521243a6dcfdbc0b2748968",
                "sha256": "51a001728bc539a1efed9f03450b1e0151ad14011c8c52f156cf55dc1fbaa884"
            },
            "downloads": -1,
            "filename": "tbparse-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8799e0898521243a6dcfdbc0b2748968",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 19595,
            "upload_time": "2024-08-16T04:37:48",
            "upload_time_iso_8601": "2024-08-16T04:37:48.546955Z",
            "url": "https://files.pythonhosted.org/packages/17/7a/56818acfbf03ef6eae4c3e0a7091ab6ffd8c3b44af93f2982297c07b50f2/tbparse-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "970b553a13cb39f8ccad888c2d9b07e04cb1a60011e1073771fd6b5d904b61c4",
                "md5": "bcb5eed0fc80498807e5deabf2164703",
                "sha256": "528e7da6929148b612a517adb5fbdee709224cb7e2420489a9b6b174f2f808bc"
            },
            "downloads": -1,
            "filename": "tbparse-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "bcb5eed0fc80498807e5deabf2164703",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 21362,
            "upload_time": "2024-08-16T04:37:50",
            "upload_time_iso_8601": "2024-08-16T04:37:50.185608Z",
            "url": "https://files.pythonhosted.org/packages/97/0b/553a13cb39f8ccad888c2d9b07e04cb1a60011e1073771fd6b5d904b61c4/tbparse-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-16 04:37:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "j3soon",
    "github_project": "tbparse",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "torch",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "tensorflow",
            "specs": []
        },
        {
            "name": "tensorboard",
            "specs": []
        },
        {
            "name": "tensorboardX",
            "specs": []
        },
        {
            "name": "sphinx",
            "specs": []
        },
        {
            "name": "seaborn",
            "specs": []
        },
        {
            "name": "sphinx_rtd_theme",
            "specs": []
        },
        {
            "name": "sphinx-tabs",
            "specs": []
        },
        {
            "name": "nbsphinx",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "tbparse"
}
        
Elapsed time: 4.33485s