Skip to content

Commit

Permalink
Release v2.4.0 of NNCF to master
Browse files Browse the repository at this point in the history
  • Loading branch information
vshampor committed Feb 1, 2023
1 parent 4916668 commit 6f5510f
Show file tree
Hide file tree
Showing 1,808 changed files with 547,261 additions and 78,364 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.git/

build
dist
*.egg-info
*.egg/
*.pyc
*.swp

.tox
.coverage
__pycache__
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text

* text=auto eol=lf
*.{tfrecord,h5} binary
3 changes: 3 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- Before creating an issue or a discussion topic, check the FAQ at https://github.com/openvinotoolkit/nncf/tree/develop/docs/FAQ.md -->
<!-- If you have a question on how NNCF works or how to apply it to your model, *do not create an issue* - create a discussion at https://github.com/openvinotoolkit/nncf/discussions instead. -->
<!-- Only create an issue for genuine problems with NNCF itself. Provide all necessary info, files and logs for us to be able to reproduce and analyze the issue. -->
32 changes: 32 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,35 @@
dependencies:
- 'requirements.txt'
- '**/setup.py'

NNCF PT:
- 'examples/torch/**/*'
- 'nncf/torch/**/*'
- 'tests/torch/**/*'

NNCF TF:
- 'examples/tensorflow/**/*'
- 'nncf/tensorflow/**/*'
- 'tests/tensorflow/**/*'

NNCF ONNX:
- 'examples/onnx/**/*'
- 'nncf/onxx/**/*'
- 'tests/onnx/**/*'

NNCF OpenVINO:
- 'examples/openvino/**/*'
- 'nncf/openvino/**/*'
- 'tests/openvino/**/*'

documentation:
- '**/README.md'
- 'docs/**/*'

experimental:
- 'nncf/experimental/**/*'

NNCF Common:
- 'examples/common/**/*'
- 'nncf/common/**/*'
- 'tests/common/**/*'
31 changes: 31 additions & 0 deletions .github/workflows/build_schema_page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Config schema HTML build
on:
push:
branches:
- develop
- test_for_doc_build_trigger
paths:
- nncf/config/**
permissions:
contents: write
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install and Build # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
pip install json-schema-for-humans
pip install -e .
python -c 'import jstyleson; from nncf.config import NNCFConfig; jstyleson.dump(NNCFConfig.schema(), open("./schema.json", "w"), indent=2)'
mkdir schema_html_build
generate-schema-doc --deprecated-from-description schema.json schema_html_build/index.html
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: schema_html_build # The folder the action should deploy.
token: ${{ secrets.PUSH_TO_GH_PAGES_BRANCH }}
branch: doc_pages
6 changes: 5 additions & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ on: [pull_request_target]

jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v3
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: '.github/labeler.yml'
sync-labels: true
6 changes: 3 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2020 Intel Corporation
# Copyright (c) 2019-2023 Intel Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -33,13 +33,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install setuptools wheel build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel --release
python -m build -C--global-option=--release
# Disallow uploading dev packages
for file in dist; do
Expand Down
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,22 @@ ENV/

# PyCharm
.idea
.run

# snapshots
*.tar

# object detection eval results
examples/torch/object_detection/eval/
examples/torch/object_detection/eval/

# VSCode
.vscode/

# NNCF debug
nncf_debug/

# NNCF examples
examples/post_training_quantization/onnx/mobilenet_v2/mobilenet_v2_*
examples/post_training_quantization/openvino/mobilenet_v2/mobilenet_v2_*
examples/post_training_quantization/tensorflow/mobilenet_v2/mobilenet_v2_*
examples/post_training_quantization/torch/mobilenet_v2/mobilenet_v2_*
10 changes: 9 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ disable = arguments-differ,
wrong-import-order,
attribute-defined-outside-init,
import-outside-toplevel,
duplicate-code
duplicate-code,
consider-using-f-string,
logging-fstring-interpolation,
cyclic-import

max-line-length = 120
ignore-docstrings = yes
Expand All @@ -38,3 +41,8 @@ good-names = logger,fn
max-statements=60
max-branches=13
max-parents=9

[TYPECHECK]
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E0201 or E1101 when accessed.
generated-members=onnx.*
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ The latter forms are accepted as pull requests from your own forks of the NNCF r

Any contributions must not violate the repository's [LICENSE](./LICENSE) requirements.

## Installation
### (Experimental) ONNXRuntime-OpenVINO
Install the package and its dependencies by running the following in the repository root directory:
```bash
make install-onnx-dev
```

## Testing

After your pull request is submitted, the maintainer will launch a scope of CI tests against it.
Expand All @@ -29,6 +36,13 @@ The test files themselves may be grouped in arbitrary directories according to t
Any additional tests in the [tests](./tests) directory will be automatically added into the pre-commit CI scope.
If your testing code is more extensive than unit tests (in terms of test execution time), or would be more suited to be executed on a nightly/weekly basis instead of for each future commit, please inform the maintainers in your PR discussion thread so that our internal testing pipelines could be adjusted accordingly.

### Preset command for testing
You can launch appropriate tests against the framework by running the following command:

- (Experimental) ONNXRuntime-OpenVINO
```bash
test-onnx
```

## Code style
Changes to NNCF Python code should conform to [Python Style Guide](./docs/styleguide/PyGuide.md)
Expand All @@ -37,6 +51,14 @@ Pylint is used throughout the project to ensure code cleanliness and quality.
A Pylint run is also done as part of the pre-commit scope - the pre-commit `pytest` scope will not be run if your code fails the Pylint checks.
The Pylint rules and exceptions for this repository are described in the standard [.pylintrc](./.pylintrc) format - make sure your local linter uses these.

### Preset command for linting
You can launch appropriate linting against the framework by running the following command:

- (Experimental) ONNXRuntime-OpenVINO
```bash
pylint-onnx
```

## Binary files
Please refrain from adding huge binary files into the repository. If binary files have to be added, mark these to use Git LFS via the [.gitattributes](./.gitattributes) file.

128 changes: 128 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
PYLINT_VERSION := 2.13.9
JUNITXML_PATH ?= nncf-tests.xml

ifdef DATA
DATA_ARG := --data $(DATA)
endif

###############################################################################
# ONNX backend
install-onnx-test:
pip install -U pip
pip install -e .[onnx]
pip install -r tests/onnx/requirements.txt
pip install -r tests/cross_fw/install/requirements.txt
pip install -r tests/onnx/benchmarking/requirements.txt
pip install -r examples/post_training_quantization/onnx/mobilenet_v2/requirements.txt

install-onnx-dev: install-onnx-test
pip install pylint==$(PYLINT_VERSION)

test-onnx:
pytest tests/onnx --junitxml ${JUNITXML_PATH}

ONNX_PYFILES := $(shell find examples/post_training_quantization/onnx -type f -name "*.py")
pylint-onnx:
pylint --rcfile .pylintrc \
nncf/onnx \
nncf/quantization \
tests/onnx \
$(ONNX_PYFILES)

test-install-onnx:
pytest tests/cross_fw/install/ -s \
--backend onnx \
--junitxml ${JUNITXML_PATH}

###############################################################################
# OpenVino backend
install-openvino-test:
pip install -U pip
pip install -e .[openvino]
pip install -r tests/openvino/requirements.txt
pip install -r tests/cross_fw/install/requirements.txt
pip install -r examples/experimental/openvino/bert/requirements.txt
pip install -r examples/experimental/openvino/yolo_v5/requirements.txt

install-openvino-dev: install-openvino-test
pip install pylint==$(PYLINT_VERSION)

test-openvino:
pytest tests/openvino --junitxml ${JUNITXML_PATH}

pylint-openvino:
pylint --rcfile .pylintrc \
nncf/openvino/ \
tests/openvino/ \
examples/experimental/openvino/

test-install-openvino:
pytest tests/cross_fw/install -s \
--backend openvino \
--junitxml ${JUNITXML_PATH}

###############################################################################
# TensorFlow backend
install-tensorflow-test:
pip install -U pip
pip install -e .[tf]
pip install -r tests/tensorflow/requirements.txt
pip install -r tests/cross_fw/install/requirements.txt
pip install -r examples/tensorflow/requirements.txt

install-tensorflow-dev: install-tensorflow-test
pip install pylint==$(PYLINT_VERSION)

test-tensorflow:
pytest tests/common tests/tensorflow \
--junitxml ${JUNITXML_PATH} \
$(DATA_ARG)

pylint-tensorflow:
pylint --rcfile .pylintrc \
nncf/tensorflow \
nncf/experimental/tensorflow \
tests/tensorflow \
tests/experimental/tensorflow \
examples/tensorflow

test-install-tensorflow:
pytest tests/cross_fw/install/ -s --backend tf --junitxml ${JUNITXML_PATH}

###############################################################################
# PyTorch backend
install-torch-test:
pip install -U pip
pip install -e .[torch]
pip install -r tests/torch/requirements.txt
pip install -r tests/cross_fw/install/requirements.txt
pip install -r examples/torch/requirements.txt

install-torch-dev: install-torch-test
pip install pylint==$(PYLINT_VERSION)

test-torch:
pytest tests/common tests/torch --junitxml ${JUNITXML_PATH} $(DATA_ARG)

pylint-torch:
pylint --rcfile .pylintrc \
nncf/common \
nncf/config \
nncf/api \
nncf/torch \
nncf/experimental/torch \
tests/common \
tests/torch \
examples/torch \
examples/experimental/torch

test-install-torch-cpu:
pytest tests/cross_fw/install/ -s \
--backend torch \
--host-configuration cpu \
--junitxml ${JUNITXML_PATH}

test-install-torch-gpu:
pytest tests/cross_fw/install -s \
--backend torch \
--junitxml ${JUNITXML_PATH}
Loading

0 comments on commit 6f5510f

Please sign in to comment.