Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions .github/workflows/call_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: uv pip install --system . -r tests/common/requirements.txt
run: pip install . -r tests/common/requirements.txt
- name: Print installed modules
run: pip list
- name: Run common precommit test scope
Expand All @@ -60,14 +58,12 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: uv pip install --system . -r tests/onnx/requirements.txt
run: pip install . -r tests/onnx/requirements.txt
- name: Print installed modules
run: pip list
- name: Run ONNX precommit test scope
Expand All @@ -88,14 +84,12 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: uv pip install --system . -r tests/openvino/requirements.txt
run: pip install . -r tests/openvino/requirements.txt
- name: Print installed modules
run: pip list
- name: Run OV precommit test scope
Expand All @@ -116,10 +110,8 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- name: Install test requirements
run: uv pip install --system . -r tests/tools/requirements.txt
run: pip install . -r tests/tools/requirements.txt
- name: Print installed modules
run: pip list
- name: Run tools precommit test scope
Expand All @@ -138,14 +130,12 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: uv pip install --system . -r tests/torch/requirements.txt
run: pip install . -r tests/torch/requirements.txt
- name: Print installed modules
run: pip list
- name: Run torch precommit test scope
Expand Down Expand Up @@ -182,14 +172,12 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- name: Override constraints
if: ${{ inputs.override_requirements != '' }}
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
shell: bash
- name: Install NNCF and test requirements
run: uv pip install --system . -r tests/torch/requirements.txt
run: pip install . -r tests/torch/requirements.txt
- name: Print installed modules
run: pip list
- name: Check CUDA
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/conformance_weight_compression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Weight compression
permissions: read-all

on:
pull_request:
workflow_call:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -37,12 +38,10 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.10.14
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- name: cpuinfo
run: cat /proc/cpuinfo
- name: Install NNCF and test requirements
run: uv pip install --system . -r tests/post_training/requirements.txt
run: pip install . -r tests/post_training/requirements.txt
- name: Print installed modules
run: pip list
- name: Run examples test scope
Expand Down
3 changes: 2 additions & 1 deletion constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Openvino
openvino==2025.4.1
openvino==2026.0.0rc1
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre

# Pytorch
torch==2.9.0
Expand Down
2 changes: 1 addition & 1 deletion docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ as well as the supported versions of Python:

| NNCF | OpenVINO | PyTorch | ONNX | TensorFlow | Python |
|-----------|------------|----------|----------|------------|--------|
| `develop` | `2025.4.1` | `2.9.0` | `1.17.0` | | `3.10` |
| `3.0.0` | `2026.0.0` | `2.9.0` | `1.17.0` | | `3.10` |
| `2.19.0` | `2025.4.0` | `2.8.0` | `1.17.0` | `2.15.1` | `3.10` |
| `2.18.0` | `2025.3.0` | `2.8.0` | `1.17.0` | `2.15.1` | `3.10` |
| `2.17.0` | `2025.2.0` | `2.7.1` | `1.17.0` | `2.15.1` | `3.10` |
Expand Down
3 changes: 2 additions & 1 deletion examples/llm_compression/onnx/tiny_llama/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
transformers==4.53.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel[openvino]==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
torch==2.9.0
transformers==4.53.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel[openvino]==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def load_model_and_tokenizer(model_id: str, export=True) -> tuple[OVModelForCaus


def codebook_example(
model_id: str, compressed_model_id: str, adaptive_codebook: bool = False, num_elements: int = 10
model_id: str, compressed_model_id: str, adaptive_codebook: bool = False, num_elements: int = 12
) -> list[str]:
"""
Example of using the adaptive codebook compression.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
datasets==4.5.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel[openvino]==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel[openvino]==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
datasets==4.5.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel[openvino]==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
datasets==4.5.0
onnx==1.17.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel[openvino]==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@2025.4.1.0#subdirectory=tools/who_what_benchmark
whowhatbench @ git+https://github.com/openvinotoolkit/openvino.genai@releases/2026/0#subdirectory=tools/who_what_benchmark
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
numpy==1.26.4
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
torch==2.9.0
datasets==4.5.0
numpy>=1.23.5,<2
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
tensorboard==2.13.0
torch==2.9.0
numpy>=1.23.5,<2
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
tensorboard==2.13.0
torch==2.9.0
numpy>=1.23.5,<2
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum-intel==1.27.0
optimum-onnx==0.1.0
optimum==2.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
transformers==4.53.0
datasets==4.5.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
optimum==2.1.0
torch==2.9.0
torchvision==0.24.0
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ fastprogress==1.0.5
fastcore==1.11.5
onnx==1.17.0
onnxruntime==1.21.1
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
numpy<2
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ultralytics==8.3.221
onnx==1.17.0
onnxruntime==1.21.1
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
torch==2.9.0
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
anomalib==0.6.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
numpy<2
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ scikit-learn
fastdownload==0.0.7
fastprogress==1.0.5
fastcore==1.11.5
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ultralytics==8.4.7
onnx==1.17.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
torch==2.9.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ultralytics==8.3.221
onnx==1.17.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
torch==2.9.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
fastdownload==0.0.7
fastprogress==1.0.5
fastcore==1.11.5
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
scikit-learn
torch==2.9.0
torchvision==0.24.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ fastdownload==0.0.7
fastprogress==1.0.5
fastcore==1.11.5
onnx==1.17.0
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
pycocotools==2.0.7
torch==2.9.0
torchmetrics==1.0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
fastdownload==0.0.7
fastprogress==1.0.5
fastcore==1.11.5
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
torch==2.9.0
torchvision==0.24.0
3 changes: 2 additions & 1 deletion examples/pruning/torch/resnet18/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
fastdownload==0.0.7
fastprogress==1.0.5
fastcore==1.11.5
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
torch==2.9.0
torchvision==0.24.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
anomalib==2.2.0
torch==2.9.0
openvino==2025.3.0
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
requests==2.32.5
matplotlib==3.10.7
numpy==2.2.6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
fastdownload==0.0.7
fastprogress==1.0.5
fastcore==1.11.5
openvino==2025.4.1
openvino==2026.0.0rc2
--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --pre
torch==2.9.0
torchvision==0.24.0
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def apply(

codebook = self.calculate_codebook(stats, weight, wp.reduction_axes, config, wp)
res[weight_name] = CompressedWeight(None, None, None, codebook)
config.codebook_values = codebook

return res

Expand Down
5 changes: 4 additions & 1 deletion src/nncf/onnx/graph/model_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, model: onnx.ModelProto, inplace: bool = False):
# and is larger than 2GB, this method silently returns an empty model.
inferred_model = model if inplace else onnx.shape_inference.infer_shapes(model)
super().__init__(inferred_model)
self.onnx_model_extractor = onnx.utils.Extractor(inferred_model)
self.onnx_model_extractor = None
self._inplace = inplace

@staticmethod
Expand Down Expand Up @@ -426,6 +426,9 @@ def _apply_model_extraction_transformation(self, transformation: ONNXModelExtrac
if not output_tensor_names:
output_tensor_names = [n.name for n in self._model.graph.output]

if self.onnx_model_extractor is None:
self.onnx_model_extractor = onnx.utils.Extractor(self._model)

extracted_model = self.onnx_model_extractor.extract_model(input_tensor_names, output_tensor_names)
if self._model.metadata_props:
values = {p.key: p.value for p in self._model.metadata_props}
Expand Down
13 changes: 11 additions & 2 deletions src/nncf/onnx/graph/passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def compress_quantize_weights_transformation(model: onnx.ModelProto):
"""
initializer = {x.name: x for x in model.graph.initializer}
nodes_to_remove = []
removed_initializers = []

version = max(model.opset_import[0].version, 19)
QuantizeLinear = load_op("", "QuantizeLinear", version)
Expand Down Expand Up @@ -129,11 +130,19 @@ def compress_quantize_weights_transformation(model: onnx.ModelProto):
block_size = get_node_attr_value(node, "block_size")
y = QuantizeLinear.eval(x, y_scale, y_zero_point, axis=axis, block_size=block_size)

# Update an existing initializer. The new name is the name of the `QuantizeLinear` output.
# Create a new initializer with the `QuantizeLinear` output name
tensor_proto = onnx.numpy_helper.from_array(y, name=node.output[0])
initializer[x_name].CopyFrom(tensor_proto)
# Remove the old initializer
model.graph.initializer.remove(initializer[x_name])
removed_initializers.append(x_name)
# Add the new initializer
model.graph.initializer.append(tensor_proto)

# `QuantizeLinear` and `DequantizeLinear` nodes share initializers on ports 1 and 2,
# so these initializers should not be removed.
for x in nodes_to_remove:
model.graph.node.remove(x)

for inp in list(model.graph.input):
if inp.name in removed_initializers:
model.graph.input.remove(inp)
Loading