Skip to content

Commit 7438f86

Browse files
[PT] merge tests folders (#3821)
### Changes Merge `tests/torch2` to `tests/torch` Removed unused code and data
1 parent b7ba152 commit 7438f86

File tree

366 files changed

+152
-1505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

366 files changed

+152
-1505
lines changed

.github/workflows/call_precommit.yml

Lines changed: 7 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -103,96 +103,6 @@ jobs:
103103
env:
104104
NUM_WORKERS: 4
105105

106-
pytorch-cpu:
107-
timeout-minutes: 40
108-
runs-on: ubuntu-latest-8-cores
109-
defaults:
110-
run:
111-
shell: bash
112-
env:
113-
DEBIAN_FRONTEND: noninteractive
114-
steps:
115-
- name: Install dependencies
116-
run : |
117-
sudo apt-get update
118-
sudo apt-get --assume-yes install gcc g++ build-essential ninja-build libgl1-mesa-dev libglib2.0-0
119-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
120-
with:
121-
lfs: true
122-
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
123-
with:
124-
python-version: ${{ inputs.python_version }}
125-
- name: Install uv
126-
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
127-
- name: Runner info
128-
continue-on-error: true
129-
run: |
130-
cat /etc/*release
131-
cat /proc/cpuinfo
132-
- name: Override constraints
133-
if: ${{ inputs.override_requirements != '' }}
134-
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
135-
shell: bash
136-
- name: Install NNCF and test requirements
137-
run: uv pip install --system . -r tests/torch/requirements.txt
138-
- name: Print installed modules
139-
run: pip list
140-
- name: Run PyTorch precommit test scope
141-
run: |
142-
make test-torch-cpu
143-
env:
144-
NUM_WORKERS: 4
145-
146-
pytorch-cuda:
147-
timeout-minutes: 40
148-
runs-on: aks-linux-4-cores-28gb-gpu-tesla-t4
149-
if: ${{ inputs.gpu_enabled == true }}
150-
defaults:
151-
run:
152-
shell: bash
153-
env:
154-
DEBIAN_FRONTEND: noninteractive
155-
steps:
156-
- name: Install dependencies
157-
run : |
158-
sudo apt-get update
159-
sudo apt-get --assume-yes install build-essential ninja-build libgl1-mesa-dev libglib2.0-0 wget make
160-
- name: Download CUDA
161-
run: |
162-
wget -q https://developer.download.nvidia.com/compute/cuda/12.6.3/local_installers/cuda_12.6.3_560.35.05_linux.run
163-
sudo sh cuda_12.6.3_560.35.05_linux.run --toolkit --silent
164-
- name: Runner info
165-
continue-on-error: true
166-
run: |
167-
export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}}
168-
export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
169-
nvidia-smi
170-
cat /proc/cpuinfo
171-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
172-
with:
173-
lfs: true
174-
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
175-
with:
176-
python-version: ${{ inputs.python_version }}
177-
- name: Install uv
178-
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
179-
- name: Override constraints
180-
if: ${{ inputs.override_requirements != '' }}
181-
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
182-
shell: bash
183-
- name: Install NNCF and test requirements
184-
run: uv pip install --system . -r tests/torch/requirements.txt
185-
- name: Print installed modules
186-
run: pip list
187-
- name: Check CUDA
188-
run: |
189-
python -c "import torch; print(torch.cuda.is_available())"
190-
- name: Run PyTorch precommit test scope
191-
run: |
192-
export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}}
193-
export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
194-
make test-torch-cuda
195-
196106
tools:
197107
timeout-minutes: 40
198108
runs-on: ubuntu-latest
@@ -215,7 +125,7 @@ jobs:
215125
- name: Run tools precommit test scope
216126
run: pytest -ra tests/tools
217127

218-
pytorch2-cpu:
128+
pytorch-cpu:
219129
timeout-minutes: 40
220130
runs-on: ubuntu-latest
221131
defaults:
@@ -235,13 +145,13 @@ jobs:
235145
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
236146
shell: bash
237147
- name: Install NNCF and test requirements
238-
run: uv pip install --system . -r tests/torch2/requirements.txt
148+
run: uv pip install --system . -r tests/torch/requirements.txt
239149
- name: Print installed modules
240150
run: pip list
241-
- name: Run torch2 precommit test scope
242-
run: pytest -ra -n2 --durations=30 tests/torch2 -m "not cuda"
151+
- name: Run torch precommit test scope
152+
run: pytest -ra -n2 --durations=30 tests/torch -m "not cuda"
243153

244-
pytorch2-cuda:
154+
pytorch-cuda:
245155
timeout-minutes: 40
246156
runs-on: aks-linux-4-cores-28gb-gpu-tesla-t4
247157
if: ${{ inputs.gpu_enabled == true }}
@@ -279,7 +189,7 @@ jobs:
279189
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
280190
shell: bash
281191
- name: Install NNCF and test requirements
282-
run: uv pip install --system . -r tests/torch2/requirements.txt
192+
run: uv pip install --system . -r tests/torch/requirements.txt
283193
- name: Print installed modules
284194
run: pip list
285195
- name: Check CUDA
@@ -289,4 +199,4 @@ jobs:
289199
run: |
290200
export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}}
291201
export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
292-
pytest -ra tests/torch2 -m cuda
202+
pytest -ra --durations=30 tests/torch -m cuda

.github/workflows/call_precommit_windows.yml

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -94,45 +94,6 @@ jobs:
9494
NUM_WORKERS: 4
9595

9696
pytorch-cpu:
97-
timeout-minutes: 100
98-
runs-on: windows-2025-8-core
99-
defaults:
100-
run:
101-
shell: bash
102-
env:
103-
DEBIAN_FRONTEND: noninteractive
104-
steps:
105-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
106-
with:
107-
lfs: true
108-
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
109-
with:
110-
python-version: ${{ inputs.python_version }}
111-
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
112-
- name: Override constraints
113-
if: ${{ inputs.override_requirements != '' }}
114-
run: python .github/scripts/override_constraints.py "${{ inputs.override_requirements }}"
115-
shell: bash
116-
- name: Install NNCF and test requirements
117-
run: pip install . -r tests/torch/requirements.txt
118-
- name: Print installed modules
119-
run: pip list
120-
- name: Run PyTorch precommit test scope
121-
run: |
122-
set +e
123-
124-
sys_lib="$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")"
125-
prefix_lib="$(python -c "import sys; print(sys.prefix + '/libs')")"
126-
include_dir="$(python -c "import sysconfig; print(sysconfig.get_path('include'))")"
127-
128-
export LIB="${LIB};${sys_lib};${prefix_lib}"
129-
export INCLUDE="${INCLUDE};${include_dir}"
130-
131-
make test-torch-cpu
132-
env:
133-
NUM_WORKERS: 1 # Parallel tests are falls on build extenstion.
134-
135-
pytorch2-cpu:
13697
timeout-minutes: 40
13798
runs-on: windows-2025-8-core
13899
defaults:
@@ -152,10 +113,10 @@ jobs:
152113
shell: bash
153114
- name: Install NNCF and test requirements
154115
run: |
155-
pip install . -r tests/torch2/requirements.txt
116+
pip install . -r tests/torch/requirements.txt
156117
- name: Print installed modules
157118
run: pip list
158-
- name: Run torch2 precommit test scope
119+
- name: Run torch precommit test scope
159120
run: |
160121
set +e
161122
@@ -166,4 +127,4 @@ jobs:
166127
export LIB="${LIB};${sys_lib};${prefix_lib}"
167128
export INCLUDE="${INCLUDE};${include_dir}"
168129
169-
pytest -ra tests/torch2 -m "not cuda"
130+
pytest -ra tests/torch -m "not cuda"

tests/cross_fw/shared/isolation_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def run_pytest_case_function_in_separate_process(fn: Callable) -> tuple[int, str
2727
pytest run failed, this function will trigger pytest.fail().
2828
:param fn - The function object corresponding to a pytest test function defined elsewhere.
2929
:returns A tuple of return code for the pytest invocation, and string representations of the stdout and stderr
30-
pipe outputs of the pytest invoсation.
30+
pipe outputs of the pytest invocation.
3131
"""
3232
filename = inspect.getfile(fn)
3333
func_name = fn.__name__

tests/docs/test_md_instalation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def test_test_environment():
123123
ref = {
124124
"python": _parse_python_version_from_precommit_workflow(True),
125125
"pytorch": actual_versions["pytorch"],
126-
"cuda_torch": _get_cuda_version_from_workflow(WORKFLOW_CALL_PRECOMMIT, "pytorch2-cuda"),
126+
"cuda_torch": _get_cuda_version_from_workflow(WORKFLOW_CALL_PRECOMMIT, "pytorch-cuda"),
127127
}
128128
print(md_versions, ref)
129129
assert md_versions == ref, (

tests/executorch/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99
# See the License for the specific language governing permissions and
1010
# limitations under the License.
11-
pytest_plugins = ["tests.torch2.conftest"]
11+
pytest_plugins = ["tests.torch.conftest"]

tests/executorch/test_quantizer_compression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
from nncf.torch.quantization.layers import INT8SymmetricWeightsDecompressor
3838
from tests.cross_fw.shared.nx_graph import compare_nx_graph_with_reference
3939
from tests.cross_fw.shared.paths import TEST_ROOT
40+
from tests.torch.fx.helpers import get_torch_fx_model
4041
from tests.torch.test_models.llama import LlamaDecoderOnly
4142
from tests.torch.test_models.synthetic import ShortTransformer
42-
from tests.torch2.fx.helpers import get_torch_fx_model
4343

4444
FX_PT2E_DIR = TEST_ROOT / "executorch" / "data" / "fx" / "compress_pt2e"
4545
FX_AO_DIR = TEST_ROOT / "executorch" / "data" / "fx" / "ao_export_compression_OpenVINOQuantizer"

tests/post_training/experimental/sparsify_activations/pipelines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
from tests.post_training.pipelines.lm_weight_compression import WCNumCompressNodes
4646
from tests.post_training.pipelines.lm_weight_compression import WCTimeStats
4747
from tests.post_training.pipelines.lm_weight_compression import collect_int4_int8_num_errors
48+
from tests.torch.function_hook.sparsify_activations.helpers import count_sparsifier_patterns_in_ov
4849
from tests.torch.helpers import set_torch_seed
49-
from tests.torch2.function_hook.sparsify_activations.helpers import count_sparsifier_patterns_in_ov
5050

5151

5252
@dataclass

0 commit comments

Comments
 (0)