Skip to content

Commit

Permalink
Release v2.7.0 of NNCF to master
Browse files Browse the repository at this point in the history
  • Loading branch information
KodiaqQ committed Nov 16, 2023
1 parent e396dd4 commit 8eb6b2c
Show file tree
Hide file tree
Showing 1,309 changed files with 1,992,478 additions and 421,407 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/api_changes_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,15 @@ jobs:
repo: context.repo.repo,
labels: ["API"]
})
- name: Add release label
uses: actions/github-script@v6
if: ${{ contains(github.event.pull_request.base.ref, 'release_v') }}
with:
github-token: ${{ secrets.ADD_LABELS_WITH_REST_API }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["release_target"]
})
37 changes: 17 additions & 20 deletions .github/workflows/post_pr_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,21 @@ on:
- closed

jobs:
upload-coverage:
upload-coverage-common:
if: github.event.pull_request.merged == true
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3 # codecov uploader demands that the scanned files be present when uploading
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
- uses: dawidd6/action-download-artifact@v2
with:
workflow: precommit.yml
check_artifacts: true
commit: ${{ github.event.pull_request.head.sha }} # this is the latest commit in the PR
name: coverage_xml
- name: Upload coverage report to Codecov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
# github.event.pull_request.merge_commit_sha is the fresh commit in the develop,
# provided that github.event.pull_request.merged == true
./codecov -f ./coverage.xml -t ${{ secrets.CODECOV_TOKEN }} -C ${{ github.event.pull_request.merge_commit_sha }} -B develop -n "codecov-onnx"
uses: ./.github/workflows/upload_coverage_for_develop.yml
with:
merge_commit_sha: ${{ github.event.pull_request.merge_commit_sha }}
last_sha_in_pr: ${{ github.event.pull_request.head.sha }}
coverage_artifact_name_in_pr: coverage_common
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
upload-coverage-onnx:
if: github.event.pull_request.merged == true
uses: ./.github/workflows/upload_coverage_for_develop.yml
with:
merge_commit_sha: ${{ github.event.pull_request.merge_commit_sha }}
last_sha_in_pr: ${{ github.event.pull_request.head.sha }}
coverage_artifact_name_in_pr: coverage_onnx
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
32 changes: 30 additions & 2 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@ on:
- synchronize

jobs:
common:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/setup-python@v3
with:
python-version: 3.8.10
- name: Install NNCF and test requirements
run: make install-common-test
- name: Run common precommit test scope
run: make test-common
env:
NNCF_COVERAGE: 1
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v3
with:
name: coverage_common
path: ./coverage.xml
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: coverage_common
onnx:
runs-on: ubuntu-20.04
steps:
Expand All @@ -21,13 +46,16 @@ jobs:
run: make install-onnx-test
- name: Run ONNX precommit test scope
run: make test-onnx
env:
NNCF_COVERAGE: 1
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v3
with:
name: coverage_xml # optional
name: coverage_onnx
path: ./coverage.xml
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-onnx # optional
name: coverage_onnx

40 changes: 40 additions & 0 deletions .github/workflows/upload_coverage_for_develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Upload coverage from an artifact of a merged PR

on:
workflow_call:
inputs:
merge_commit_sha:
required: true
type: string
last_sha_in_pr:
required: true
type: string
coverage_artifact_name_in_pr:
required: true
type: string
secrets:
CODECOV_TOKEN:
required: true

jobs:
upload-coverage:
if: github.event.pull_request.merged == true
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3 # codecov uploader demands that the scanned files be present when uploading
with:
ref: ${{ inputs.merge_commit_sha }}
- uses: dawidd6/action-download-artifact@v2
with:
workflow: precommit.yml
check_artifacts: true
commit: ${{ inputs.last_sha_in_pr }} # this is the latest commit in the PR
name: ${{ inputs.coverage_artifact_name_in_pr }}
- name: Upload coverage report to Codecov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
# github.event.pull_request.merge_commit_sha is the fresh commit in the develop,
# provided that github.event.pull_request.merged == true
./codecov -f ./coverage.xml -t ${{ secrets.CODECOV_TOKEN }} -C ${{ inputs.merge_commit_sha }} -B develop -n "${{ inputs.coverage_artifact_name_in_pr }}"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ ENV/
# snapshots
*.tar

# pylint config is left at dev's discretion, CI uses ruff/isort/black instead
.pylintrc

# VSCode
.vscode/

Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ repos:
- id: isort
name: isort (python)

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.3
hooks:
- id: ruff

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.33.0
hooks:
Expand Down
51 changes: 0 additions & 51 deletions .pylintrc

This file was deleted.

9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ If your testing code is more extensive than unit tests (in terms of test executi

Changes to NNCF Python code should conform to [Python Style Guide](./docs/styleguide/PyGuide.md)

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.
Basic code style and static checks are enforced using a `pre-commit` Github action.
The exact checks that are run are described in the corresponding [config file](./.pre-commit-config.yaml).
The checks can be run locally using `make pre-commit`.
Most of these checks do in-place fixes at the same time they are run using `make pre-commit`.
Static analysis is done via `ruff` which does not do in-place fixes by default - run `ruff --fix` locally to autofix errors for which it is possible to do so.
Developers may use other tools locally (such as `pylint`) as long as no tool-specific control code is introduced and the pre-commit checks pass.

## Binary files

Expand Down
67 changes: 28 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
JUNITXML_PATH ?= nncf-tests.xml
COVERAGE ?= --cov=./ --cov-report=xml

ifdef NNCF_COVERAGE
COVERAGE_ARGS ?= --cov=./ --cov-report=xml
else
COVERAGE_ARGS :=
endif

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

ifdef WEEKLY_MODELS
WEEKLY_MODELS_ARG := --weekly-models $(WEEKLY_MODELS)
endif

install-pre-commit:
pip install pre-commit==3.2.2

install-pylint:
pip install pylint==2.13.9
pip install pylintfileheader==0.3.2

###############################################################################
# ONNX backend
Expand All @@ -22,15 +28,12 @@ install-onnx-test:
pip install -r tests/cross_fw/examples/requirements.txt
pip install -r tests/onnx/benchmarking/requirements.txt

install-onnx-dev: install-onnx-test install-pre-commit install-pylint
install-onnx-dev: install-onnx-test install-pre-commit
pip install -r examples/post_training_quantization/onnx/mobilenet_v2/requirements.txt

test-onnx:
pytest ${COVERAGE} tests/onnx $(DATA_ARG) --junitxml ${JUNITXML_PATH}
pytest ${COVERAGE_ARGS} tests/onnx $(DATA_ARG) --junitxml ${JUNITXML_PATH}

pylint-onnx:
pylint --rcfile .pylintrc \
$(shell python3 tools/collect_pylint_input_files_for_backend.py onnx)

test-install-onnx:
pytest tests/cross_fw/install -s \
Expand All @@ -47,11 +50,12 @@ test-examples-onnx:
install-openvino-test:
pip install -U pip
pip install -e .[openvino]
pip install tensorflow==2.12.0
pip install -r tests/openvino/requirements.txt
pip install -r tests/cross_fw/install/requirements.txt
pip install -r tests/cross_fw/examples/requirements.txt

install-openvino-dev: install-openvino-test install-pre-commit install-pylint
install-openvino-dev: install-openvino-test install-pre-commit
pip install -r examples/experimental/openvino/bert/requirements.txt
pip install -r examples/experimental/openvino/yolo_v5/requirements.txt
pip install -r examples/post_training_quantization/openvino/mobilenet_v2/requirements.txt
Expand All @@ -60,12 +64,7 @@ install-openvino-dev: install-openvino-test install-pre-commit install-pylint
pip install -r examples/post_training_quantization/openvino/yolov8_quantize_with_accuracy_control/requirements.txt

test-openvino:
# omitting ${COVERAGE} for internal runs since they seem to introduce a major slowdown
pytest tests/openvino $(DATA_ARG) --junitxml ${JUNITXML_PATH}

pylint-openvino:
pylint --rcfile .pylintrc \
$(shell python3 tools/collect_pylint_input_files_for_backend.py openvino)
pytest ${COVERAGE_ARGS} tests/openvino $(DATA_ARG) --junitxml ${JUNITXML_PATH}

test-install-openvino:
pytest tests/cross_fw/install -s \
Expand All @@ -87,19 +86,14 @@ install-tensorflow-test:
pip install -r tests/cross_fw/examples/requirements.txt
pip install -r examples/tensorflow/requirements.txt

install-tensorflow-dev: install-tensorflow-test install-pre-commit install-pylint
install-tensorflow-dev: install-tensorflow-test install-pre-commit
pip install -r examples/post_training_quantization/tensorflow/mobilenet_v2/requirements.txt

test-tensorflow:
# omitting ${COVERAGE} for internal runs since they seem to introduce a major slowdown
pytest tests/common tests/tensorflow \
pytest ${COVERAGE_ARGS} tests/tensorflow \
--junitxml ${JUNITXML_PATH} \
$(DATA_ARG)

pylint-tensorflow:
pylint --rcfile .pylintrc \
$(shell python3 tools/collect_pylint_input_files_for_backend.py tensorflow)

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

Expand All @@ -110,25 +104,24 @@ test-examples-tensorflow:
# PyTorch backend
install-torch-test:
pip install -U pip
pip install -e .[torch]
pip install -r tests/torch/requirements.txt
pip install -e .[torch] --index-url https://download.pytorch.org/whl/cu118 --extra-index-url=https://pypi.org/simple # ticket 119128
pip install -r tests/torch/requirements.txt --index-url https://download.pytorch.org/whl/cu118 --extra-index-url=https://pypi.org/simple
pip install -r tests/cross_fw/install/requirements.txt
pip install -r tests/cross_fw/examples/requirements.txt
pip install -r examples/torch/requirements.txt
pip install -r examples/torch/requirements.txt --index-url https://download.pytorch.org/whl/cu118 --extra-index-url=https://pypi.org/simple

install-torch-dev: install-torch-test install-pre-commit install-pylint
install-torch-dev: install-torch-test install-pre-commit
pip install -r examples/post_training_quantization/torch/mobilenet_v2/requirements.txt
pip install -r examples/post_training_quantization/torch/ssd300_vgg16/requirements.txt

test-torch:
# omitting ${COVERAGE} for internal runs since they seem to introduce a major slowdown
pytest tests/common tests/torch --junitxml ${JUNITXML_PATH} $(DATA_ARG)
pytest ${COVERAGE_ARGS} tests/torch -m "not weekly and not nightly" --junitxml ${JUNITXML_PATH} $(DATA_ARG)

COMMON_PYFILES := $(shell python3 tools/collect_pylint_input_files_for_backend.py common)
pylint-torch:
pylint --rcfile .pylintrc \
$(COMMON_PYFILES) \
$(shell python3 tools/collect_pylint_input_files_for_backend.py torch)
test-torch-nightly:
pytest ${COVERAGE_ARGS} tests/torch -m nightly --junitxml ${JUNITXML_PATH} $(DATA_ARG)

test-torch-weekly:
pytest ${COVERAGE_ARGS} tests/torch -m weekly --junitxml ${JUNITXML_PATH} $(DATA_ARG) ${WEEKLY_MODELS_ARG}

test-install-torch-cpu:
pytest tests/cross_fw/install -s \
Expand All @@ -155,12 +148,8 @@ install-common-test:
pip install -r tests/cross_fw/install/requirements.txt
pip install -r tests/cross_fw/examples/requirements.txt

pylint-common:
pylint --rcfile .pylintrc \
$(COMMON_PYFILES)

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

test-examples:
pytest tests/cross_fw/examples -s --junitxml ${JUNITXML_PATH}
Expand Down
Loading

0 comments on commit 8eb6b2c

Please sign in to comment.