Skip to main content

Python utilities used by Deep Procedural Intelligence

Project description

DPU Utilities

Build Status

This contains a set of utilities used across projects of the DPU team.

Installation

pip install dpu-utils

Overview of Utilities:

Generic Utilities:

  • dpu_utils.utils.RichPath a convenient way of using both paths and Azure paths in your code.
  • dpu_utils.utils.*Iterator iterator wrappers that can parallelize their iteration in other threads/processes.
  • dpu_utils.utils.{load,save}_json[l]_gz convenience methods for loading .json[l].gz from the filesystem.
  • dpu_utils.utils.git_tag_run that tags the current working directory git the state of the code.
  • dpu_utils.utils.run_and_debug when an exception happens, start a debug session. Usually a wrapper of __main__.
  • dpu_utils.utils.ChunkWriter that helps writing chunks to the output.

TensorFlow Utilities:

  • dpu_utils.tfutils.GradRatioLoggingOptimizer a wrapper around optimizers that logs the ratios of grad norms to parameter norms.
  • dpu_utils.tfutils.unsorted_segment_logsumexp
  • dpu_utils.tfutils.unsorted_segment_log_softmax
  • dpu_utils.tfutils.TFVariableSaver save TF variables in an object that can be pickled.

General Machine Learning Utilities:

  • dpu_utils.mlutils.CharTensorizer for character-level tensorization.
  • dpu_utils.mlutils.Vocabulary a str to int vocabulary for machine learning models

TensorFlow Models:

  • dpu_utils.tfmodels.SparseGGNN a sparse GGNN implementation.
  • dpu_utils.tfmodels.AsyncGGNN an asynchronous GGNN implementation.

Code-related Utilities

  • dpu_utils.codeutils.split_identifier_into_parts() split identifiers into subtokens on CamelCase and snake_case.
  • dpu_utils.codeutils.{Lattice, CSharpLattice} represent lattices and some useful operations in Python.
  • dpu_utils.codeutils.get_language_keywords() that retrieves the keywords of a given language.

Tests

Run the unit tests

python setup.py test

Generate code coverage reports

# pip install coverage
coverage run --source dpu_utils/ setup.py test && \
  coverage html

The resulting HTML file will be in htmlcov/index.html.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

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

dpu_utils-0.1.21.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

dpu_utils-0.1.21-py2.py3-none-any.whl (31.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file dpu_utils-0.1.21.tar.gz.

File metadata

  • Download URL: dpu_utils-0.1.21.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for dpu_utils-0.1.21.tar.gz
Algorithm Hash digest
SHA256 17eac3d2b28887e73d409874cfa3270f9bb1b3ad8690b8ace4780e05a0eb0f86
MD5 8d73507615327db2fe7b0d435521ea52
BLAKE2b-256 d1aacf17d682e1eda83aeb25a79c9d2e2e53a5ffa0381ca643d6b596b7f42a90

See more details on using hashes here.

File details

Details for the file dpu_utils-0.1.21-py2.py3-none-any.whl.

File metadata

  • Download URL: dpu_utils-0.1.21-py2.py3-none-any.whl
  • Upload date:
  • Size: 31.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for dpu_utils-0.1.21-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c1892e256f53db46e1670565d490da43262f04f428868a1d4e4cabbe5e1a448c
MD5 1da39e0b58da7112c73a2e6514867e5c
BLAKE2b-256 c92bf9f523052b8ee3864387ecbe7d4eb26c85e5011b6182589e8c289884a0fc

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