Skip to main content

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.

Metadata

Release files for DI-toolkit 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DI-toolkit 0.3.0
File Size Uploaded
di_toolkit-0.3.0.tar.gz 32.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for DI-toolkit 0.3.0
File Interpreter ABI Platform
di_toolkit-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 66.6 kB

Release files / di_toolkit-0.3.0.tar.gz

Download URL di_toolkit-0.3.0.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b6fd5e220753d0dc9bd2c0a0c77ddd43c0e6efdac553e087708b99e301e6793b
BLAKE2b-256 checksum
How to use checksums
ee85d31beb746b3247fe06ce6f27aa81676500912597f6f163a221ba405db236
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Release files / di_toolkit-0.3.0-py3-none-any.whl

Download URL di_toolkit-0.3.0-py3-none-any.whl
Size 33.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb62f36426a8ff7102da09d8b427f805329cb4e093f145d1b562564b24579375
BLAKE2b-256 checksum
How to use checksums
53923ebfa8c3882b6910dbe28602d519d6f5fd480bf517de4d4e76dca00f2ca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page