Skip to main content

"Automatic DNN generation for fuzzing and more."

Project description

Backend-Model Support

Model\Engine TVM ORT TensorRT TFLite XLA IREE
PyTorch-ONNX
TensorFlow ⚠️ ⚠️ ⚠️

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

Setup

Install latest stable release:

pip install "nnsmith[torch,onnx]" --upgrade
Install GitHub HEAD: [click to expand]
pip install "git+https://github.com/ise-uiuc/nnsmith@main#egg=nnsmith[torch,onnx]" --upgrade
# or pip install "git+ssh://git@github.com/ise-uiuc/nnsmith@main#egg=nnsmith[torch,onnx]" --upgrade
Install latest pre-release: [click to expand]
pip install "nnsmith[torch,onnx]"                     \
            --pre --upgrade                           \
            --index-url https://test.pypi.org/simple/ \
            --extra-index-url https://pypi.org/simple/

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

pip install pygraphviz  # Final step.

Also see pygraphviz install guidance.

# Generate a random model in "nnsmith_outputs/*"
nnsmith.model_gen model.type=onnx debug.viz=true

See other commands under doc/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;
Pre-commits [click to expand]

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.
Local development [click to expand]
  • Develop locally by setting export PYTHONPATH=$PYTHONPATH:$(pwd) (pwd should be this git folder.)
  • Set PYTHONPATH="" when doing pip install nnsmith from online version.
Simplify the code [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.

Test before commit [click to expand]
# env of torch & tf will conflict so split their unit tests.
pytest tests/core -s
pytest tests/torch -s
pytest tests/tensorflow -s

Paper

Our paper is accepted by ASPLOS'23 and the pre-print is now available on arXiv.

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.1.tar.gz (112.2 kB view details)

Uploaded Source

Built Distribution

nnsmith-0.0.1-py3-none-any.whl (87.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nnsmith-0.0.1.tar.gz
  • Upload date:
  • Size: 112.2 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.1.tar.gz
Algorithm Hash digest
SHA256 a44f2d4536a91a841d49eef8164a2778bbd5db8c8d9a2acfeffdba45337f193d
MD5 87799dbdcab88ff3e3e2f4934b79d0c7
BLAKE2b-256 39a87b8243d212490147e23347a76944f7e43f8636343a2f9b2e3b1660f467e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nnsmith-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 87.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd093c965ad0848f2c1a1432826fc6952b0d146f7e1a5965d57cbe49bc085075
MD5 005947bc28a4f6cde85b1a7087ff3f75
BLAKE2b-256 875598df65e7330cbc93fb5bf1a15517c84ee20d5d10204e32787f5f4781c387

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