Skip to main content

A simple tool for opendilab.

Project description

DI-toolkit

PyPI PyPI - Python Version Loc Comments

Docs Deploy Code Test Badge Creation Package Release codecov

GitHub stars GitHub forks GitHub commit activity GitHub issues GitHub pulls Contributors GitHub license

A simple toolkit package for opendilab, including the following utilities:

  • ditk.logging, a easy-to-use logger system
  • ditk.annonated, an annotated documentation generation script
  • ditk.tensorboard, a utility for extract data from tensorboard log file
    • ditk.tensorboard.plot, plot utilities for plotting data extracted from tensorboard log file

Installation

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

pip install DI-toolkit

Or installing from the latest source code as follows:

git clone https://github.com/opendilab/DI-toolkit.git
cd di-toolkit
pip install . --user

Quick Start

Example of ditk.logging

Here is an example of logging.

from ditk import logging

if __name__ == '__main__':
    logging.try_init_root(logging.INFO)
    logging.info('This is info')
    logging.warning('This is warning with integer 233')
    logging.error('This is a error with string \'233\'.')

    try:
        _ = 1 / 0
    except ZeroDivisionError as err:
        logging.exception(err)

ditk.logginghas almost the same interface as native logging module. You can directly replace import logging in the code with from ditk import logging.

ditk.annonated

Python annotated documentation generation script like the following

Usage

python -m ditk.doc.annotated create -i ditk/doc/annotated/ppo.py -o my_doc/index.html -L zh

You will get

my_doc
├── assets
│   ├── pylit.css
│   └── solarized.css
└── index.html

Help Information

  • python -m ditk.doc.annotated --help
Usage: python -m ditk.doc.annotated [OPTIONS] COMMAND [ARGS]...

  Utils for creating annotation documentation.

Options:
  -v, --version  Show version information.
  -h, --help     Show this message and exit.

Commands:
  create  Utils for creating annotation documentation from local code.
  • python -m ditk.doc.annotated create --help
Usage: python -m ditk.doc.annotated create [OPTIONS]

  Utils for creating annotation documentation from local code.

Options:
  -i, --input_file FILE       Input source code.  [required]
  -o, --output_file FILE      Output annotated documentation code.  [required]
  -A, --assets_dir DIRECTORY  Directory for assets file of this documentation.
  -L, --language [zh|en]      Language for documentation.  [default: en]
  -T, --title TEXT            Title of the documentation.  [default: <Untitled
                              Documentation>]
  -h, --help                  Show this message and exit.

Related Library

Create Multi-Seed Multi-Algorithm Benchmark Plots

import matplotlib.pyplot as plt
import seaborn as sns

from ditk.tensorboard.plots import tb_create_range_plots

sns.set()

tb_create_range_plots(
    'test/testfile/pong_tb',  # directory of tensorboard log
    xname='step',
    yname='evaluator_step/reward_mean',
)

plt.show()

tb_create_range_plots

Contributing

We appreciate all contributions to improve DI-toolkit, both logic and system designs. Please refer to CONTRIBUTING.md for more guides.

License

DI-toolkit released under the Apache 2.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

DI-toolkit-0.2.1.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

DI_toolkit-0.2.1-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file DI-toolkit-0.2.1.tar.gz.

File metadata

  • Download URL: DI-toolkit-0.2.1.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for DI-toolkit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e5cc656d4b343963f95e2ab2ad12914ed93fc6c47617bdbb3f04af46634f0ae8
MD5 5e87559e6848e5597d44cc1a234ea0ba
BLAKE2b-256 b612cbb41a1f7673c8d8623e4b2452a7d2ee148f22205de97d84d46e9bca299e

See more details on using hashes here.

File details

Details for the file DI_toolkit-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: DI_toolkit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for DI_toolkit-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a026c4539a80d7c521685204d73e87155e2d41f512651b672a8b94a937961288
MD5 8bcf74b6e70a8dfffe0edddd740a1847
BLAKE2b-256 971294245389c1e4a4dafe05119a1c2cb24f8f56dcf2a903a3b8cc6b157f2f17

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page