Contribute To ONNX
Introduction
The ONNX library defines neural network operators and is commonly supported by multiple deep learning libraries in the community. Because the deep learning field is moving extremely fast, it is common that deep learning researchers and engineers will have to contribute to the ONNX library.
In this blog post, I would like to quickly discuss how to contribute to the ONNX library.
ONNX Development
Create ONNX Development Dockerfile
Create a development environment is often very difficult for any libraries. Here I have created a Docker file for building and developing the ONNX library.
1 | FROM ubuntu:22.04 |
Build Docker Image
Build the ONNX development Docker image using the following command.
1 | $ docker build -f onnx-dev.Dockerfile --tag onnx-dev:0.0.1 . |
Run Docker Container
Pull the main branch of the ONNX repository to the host computer and start the Docker container for development.
1 | $ git clone --recurse-submodules https://github.com/onnx/onnx.git |
Build ONNX Library
The ONNX library needs to be built from source in development mode.
1 | $ cd /mnt/ |
Run Unit Tests
After adding or modifying the code in the ONNX repository from the host, we will have to run unit tests from the ONNX root directory in the Docker container to ensure that the changes we made are correct.
1 | $ pytest |
To only test a specific subset, we could use the -k
argument for prefix patten matching. For example,
1 | $ pytest -k test_gridsample |
Regenerate Documentations and Test Files
For most of the changes related to ONNX scopes and specs, the ONNX documentations and unit test files have to be updated using the following script.
1 | $ bash tools/update_doc.sh |
Format Code
lintrunner
is recommended to be performed from the ONNX root directory on the host outside the Docker container.
1 | $ lintrunner |
References
Contribute To ONNX