Skip to main content

"Automatic DNN generation for fuzzing and more."

Project description

NNSmith: DNN Model Generation in the Wild

Backend-Model Support

Backend\Model ONNX/PyTorch TensorFlow
TVM
ONNXRuntime
TensorRT
TFLite ⚠️
XLA ⚠️

✅: Supported; ⚠️: Beta support; Others are not supported yet -- Contributions are welcome!

Quick Start

Setting up graphviz for debugging [click to expand]

Graphviz provides dot for visualizing graphs in nice pictures. But it needs to be installed via the following methods:

sudo apt-get install graphviz graphviz-dev      # Linux
brew install graphviz                           # MacOS
conda install --channel conda-forge pygraphviz  # Conda
choco install graphviz                          # Windows

Also see pygraphviz install guidance.

python3 -m pip install "nnsmith[torch,onnx]"                     \
                       --upgrade                                 \
                       --index-url https://test.pypi.org/simple/ \
                       --extra-index-url https://pypi.org/simple/
# Generate a 5-node graph:
nnsmith.model_gen model.max_nodes=5 debug.viz=true
# see "nnsmith_outputs/*"

See other commands under nnsmith/cli. We use hydra to manage configurations. See nnsmith/config/main.yaml.

Developer Notes

  • pip install -r requirements/core.txt to run generation and fuzzing;
  • pip install --upgrade -r requirements/sys/[system].txt to allow generating and running specific frameworks;
    • Why "--upgrade"? In fact, all the sources under requirements/sys/ are nightly release (except tvm) as we want to "save the world" by catching new bugs;
export PYTHONPATH=$PYTHONPATH:$(pwd)

You can use pre-commit to simpify development:

  • pip install -r requirements/dev.txt;
  • pre-commit install;
  • pre-commit will run upon a commit; To explicitly run pre-commit for all files: pre-commit run --all-files.
More notes [click to expand]

Simplicity is prerequisite for reliability. --Edsger W. Dijkstra

We want code simplicity: keeping minimal dependencies and focusing on a small set of simple APIs to make NNSmith maintainable to developers and reliable to users.

Run tests before commit:

# env of torch & tf will conflict so split their unit tests.
pytest tests/core -s
pytest tests/torch -s
pytest tests/tensorflow -s

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

nnsmith-0.0.0.tar.gz (108.7 kB view details)

Uploaded Source

Built Distribution

nnsmith-0.0.0-py3-none-any.whl (83.5 kB view details)

Uploaded Python 3

File details

Details for the file nnsmith-0.0.0.tar.gz.

File metadata

  • Download URL: nnsmith-0.0.0.tar.gz
  • Upload date:
  • Size: 108.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for nnsmith-0.0.0.tar.gz
Algorithm Hash digest
SHA256 3a5b7fdce19828e195b2f69c67fa1d088076f0d07aed51098f01f6530f3dc041
MD5 507c246a15c7bbbe8523192ffb8e949f
BLAKE2b-256 ccd455a5763d31caca99827c8511cf9b7ce3d0acb503cf75cd49f3bc17d966c7

See more details on using hashes here.

File details

Details for the file nnsmith-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: nnsmith-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 83.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for nnsmith-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 118276477bf53192a2e361ccc2efa57dede68e67dfee86aa2e2efd090647850b
MD5 c0f61be3a4f74048a5752b21dd8eb442
BLAKE2b-256 7be908c8ad3de58c61ce4646142a6c44a257dcb490f025b5ba93efd9bc8cffdb

See more details on using hashes here.

Supported by

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