diff --git a/.github/workflows/develop_install.yml b/.github/workflows/develop_install.yml index bdc0df76b..3dc804fb5 100644 --- a/.github/workflows/develop_install.yml +++ b/.github/workflows/develop_install.yml @@ -15,15 +15,11 @@ jobs: matrix: - python_version: ['3.8', '3.9'] - pytorch_version: ['1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0'] + python_version: ['3.9', '3.10'] + pytorch_version: ['1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0', '2.2.2', '2.3.1'] platform: ['windows-latest', 'ubuntu-latest', 'macos-latest'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/end_to_end.yml b/.github/workflows/end_to_end.yml index a83ba8899..ff54defca 100644 --- a/.github/workflows/end_to_end.yml +++ b/.github/workflows/end_to_end.yml @@ -15,15 +15,12 @@ jobs: matrix: - python_version: ['3.8', '3.9'] - pytorch_version: ['1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0'] + python_version: ['3.9', '3.10'] + pytorch_version: ['1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0', '2.2.2', '2.3.1'] platform: ['windows-latest', 'ubuntu-latest', 'macos-latest'] exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - - platform: 'windows-latest' diff --git a/.github/workflows/examples_llm_pytest.yml b/.github/workflows/examples_llm_pytest.yml index 065a06738..f0bd1c9eb 100644 --- a/.github/workflows/examples_llm_pytest.yml +++ b/.github/workflows/examples_llm_pytest.yml @@ -15,19 +15,12 @@ jobs: matrix: - python_version: ['3.8', '3.9'] + python_version: ['3.9', '3.10'] pytorch_version: ['2.2.2', '2.3.1', '2.4.0'] platform: ['windows-latest', 'ubuntu-latest', 'macos-latest'] jit_status: ['jit_disabled', 'jit_enabled'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - - - pytorch_version: '1.9.1' - jit_status: 'jit_enabled' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/examples_pytest.yml b/.github/workflows/examples_pytest.yml index 262625e01..0396f3f72 100644 --- a/.github/workflows/examples_pytest.yml +++ b/.github/workflows/examples_pytest.yml @@ -15,19 +15,12 @@ jobs: matrix: - python_version: ['3.8', '3.9'] - pytorch_version: ['1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0'] + python_version: ['3.9', '3.10'] + pytorch_version: ['1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0', '2.2.2', '2.3.1'] platform: ['windows-latest', 'ubuntu-latest', 'macos-latest'] jit_status: ['jit_disabled', 'jit_enabled'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - - - pytorch_version: '1.9.1' - jit_status: 'jit_enabled' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/finn_integration.yml b/.github/workflows/finn_integration.yml index f62876a45..5167617c1 100644 --- a/.github/workflows/finn_integration.yml +++ b/.github/workflows/finn_integration.yml @@ -15,15 +15,11 @@ jobs: matrix: - python_version: ['3.8', '3.9'] - pytorch_version: ['1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0'] + python_version: ['3.9', '3.10'] + pytorch_version: ['1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0', '2.2.2', '2.3.1'] platform: ['windows-latest', 'ubuntu-latest'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/gen_github_actions.py b/.github/workflows/gen_github_actions.py index 2c4908a6c..a2138fd84 100644 --- a/.github/workflows/gen_github_actions.py +++ b/.github/workflows/gen_github_actions.py @@ -4,6 +4,16 @@ from utils import combine_od_list from utils import generate_exclusion_list +TORCHVISION_VERSION_DICT = { + '1.11.0': '0.12.0', + '1.12.1': '0.13.1', + '1.13.0': '0.14.0', + '2.0.1': '0.15.2', + '2.1.0': '0.16.0', + '2.2.2': '0.17.2', + '2.3.1': '0.18.1', + '2.4.0': '0.19.0'} + BASE_YML_TEMPLATE = 'base.yml.template' BASE_YML_REDUCED_TEMPLATE = 'base_reduced.yml.template' PYTEST_YML = 'pytest.yml' @@ -16,9 +26,9 @@ ENDTOEND_YML = 'end_to_end.yml' # Reduced Test for PRs, except when a review is requested -PYTHON_VERSIONS_REDUCED = ('3.8',) +PYTHON_VERSIONS_REDUCED = ('3.9',) -PYTORCH_LIST_REDUCED = ["1.9.1", "1.13.0", "2.1.0"] +PYTORCH_LIST_REDUCED = ["1.11.0", "2.0.1", "2.3.1"] PLATFORM_LIST_REDUCED = ['ubuntu-latest'] @@ -38,9 +48,9 @@ 'jit_disabled',])]) # Data shared betwen Nox sessions and Github Actions, formatted as tuples -PYTHON_VERSIONS = ('3.8', '3.9') +PYTHON_VERSIONS = ('3.9', '3.10') -PYTORCH_VERSIONS = ('1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0') +PYTORCH_VERSIONS = ('1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0', '2.2.2', '2.3.1') JIT_STATUSES = ('jit_disabled', 'jit_enabled') # Data used only by Github Actions, formatted as lists or lists of ordered dicts @@ -49,13 +59,9 @@ STRATEGY = od([('fail-fast', 'false')]) -EXCLUDE_LIST = generate_exclusion_list([[ - ['pytorch_version', ['1.9.1']], - ['platform', ['macos-latest']],]]) +EXCLUDE_LIST = [] -JIT_EXCLUDE_LIST = generate_exclusion_list([[['pytorch_version', ['1.9.1']], - ['jit_status', [ - 'jit_enabled',]]]]) +JIT_EXCLUDE_LIST = [] NOTEBOOK_EXCLUDE_LIST = generate_exclusion_list([[['platform', [ 'macos-latest',]]]]) diff --git a/.github/workflows/notebook.yml b/.github/workflows/notebook.yml index 4e8c06e78..da3a5fec0 100644 --- a/.github/workflows/notebook.yml +++ b/.github/workflows/notebook.yml @@ -15,15 +15,12 @@ jobs: matrix: - python_version: ['3.8', '3.9'] - pytorch_version: ['1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0'] + python_version: ['3.9', '3.10'] + pytorch_version: ['1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0', '2.2.2', '2.3.1'] platform: ['windows-latest', 'ubuntu-latest', 'macos-latest'] exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - - platform: 'macos-latest' diff --git a/.github/workflows/ort_integration.yml b/.github/workflows/ort_integration.yml index 02c75fcf2..1b55e5118 100644 --- a/.github/workflows/ort_integration.yml +++ b/.github/workflows/ort_integration.yml @@ -15,15 +15,11 @@ jobs: matrix: - python_version: ['3.8', '3.9'] - pytorch_version: ['1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0'] + python_version: ['3.9', '3.10'] + pytorch_version: ['1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0', '2.2.2', '2.3.1'] platform: ['windows-latest', 'ubuntu-latest', 'macos-latest'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 4505d8df0..fda4a0af3 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -15,19 +15,12 @@ jobs: matrix: - python_version: ['3.8', '3.9'] - pytorch_version: ['1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0'] + python_version: ['3.9', '3.10'] + pytorch_version: ['1.11.0', '1.12.1', '1.13.0', '2.0.1', '2.1.0', '2.2.2', '2.3.1'] platform: ['windows-latest', 'ubuntu-latest', 'macos-latest'] jit_status: ['jit_disabled', 'jit_enabled'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - - - pytorch_version: '1.9.1' - jit_status: 'jit_enabled' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/reduced_develop_install.yml b/.github/workflows/reduced_develop_install.yml index b5ead15ee..db83a062e 100644 --- a/.github/workflows/reduced_develop_install.yml +++ b/.github/workflows/reduced_develop_install.yml @@ -17,15 +17,11 @@ jobs: matrix: - python_version: ['3.8'] - pytorch_version: ['1.9.1', '1.13.0', '2.1.0'] + python_version: ['3.9'] + pytorch_version: ['1.11.0', '2.0.1', '2.3.1'] platform: ['ubuntu-latest'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/reduced_end_to_end.yml b/.github/workflows/reduced_end_to_end.yml index c52fb0ceb..db2948a1d 100644 --- a/.github/workflows/reduced_end_to_end.yml +++ b/.github/workflows/reduced_end_to_end.yml @@ -17,15 +17,12 @@ jobs: matrix: - python_version: ['3.8'] - pytorch_version: ['1.9.1', '1.13.0', '2.1.0'] + python_version: ['3.9'] + pytorch_version: ['1.11.0', '2.0.1', '2.3.1'] platform: ['ubuntu-latest'] exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - - platform: 'windows-latest' diff --git a/.github/workflows/reduced_examples_llm_pytest.yml b/.github/workflows/reduced_examples_llm_pytest.yml index 44b0de612..dfb9296fd 100644 --- a/.github/workflows/reduced_examples_llm_pytest.yml +++ b/.github/workflows/reduced_examples_llm_pytest.yml @@ -17,16 +17,12 @@ jobs: matrix: - python_version: ['3.8'] + python_version: ['3.9'] pytorch_version: ['2.4.0'] platform: ['ubuntu-latest'] jit_status: ['jit_disabled'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/reduced_examples_pytest.yml b/.github/workflows/reduced_examples_pytest.yml index b4d42540c..c6fc13bf7 100644 --- a/.github/workflows/reduced_examples_pytest.yml +++ b/.github/workflows/reduced_examples_pytest.yml @@ -17,16 +17,12 @@ jobs: matrix: - python_version: ['3.8'] - pytorch_version: ['1.9.1', '1.13.0', '2.1.0'] + python_version: ['3.9'] + pytorch_version: ['1.11.0', '2.0.1', '2.3.1'] platform: ['ubuntu-latest'] jit_status: ['jit_disabled'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/reduced_finn_integration.yml b/.github/workflows/reduced_finn_integration.yml index 342a01c34..460951f61 100644 --- a/.github/workflows/reduced_finn_integration.yml +++ b/.github/workflows/reduced_finn_integration.yml @@ -17,15 +17,11 @@ jobs: matrix: - python_version: ['3.8'] - pytorch_version: ['1.9.1', '1.13.0', '2.1.0'] + python_version: ['3.9'] + pytorch_version: ['1.11.0', '2.0.1', '2.3.1'] platform: ['ubuntu-latest'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/reduced_notebook.yml b/.github/workflows/reduced_notebook.yml index 5d2dc1b6f..2460c12c1 100644 --- a/.github/workflows/reduced_notebook.yml +++ b/.github/workflows/reduced_notebook.yml @@ -17,15 +17,12 @@ jobs: matrix: - python_version: ['3.8'] - pytorch_version: ['1.9.1', '1.13.0', '2.1.0'] + python_version: ['3.9'] + pytorch_version: ['1.11.0', '2.0.1', '2.3.1'] platform: ['ubuntu-latest'] exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - - platform: 'macos-latest' diff --git a/.github/workflows/reduced_ort_integration.yml b/.github/workflows/reduced_ort_integration.yml index 9fcb678d2..771f3fe79 100644 --- a/.github/workflows/reduced_ort_integration.yml +++ b/.github/workflows/reduced_ort_integration.yml @@ -17,15 +17,11 @@ jobs: matrix: - python_version: ['3.8'] - pytorch_version: ['1.9.1', '1.13.0', '2.1.0'] + python_version: ['3.9'] + pytorch_version: ['1.11.0', '2.0.1', '2.3.1'] platform: ['ubuntu-latest'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - if: ${{ !github.event.pull_request.draft }} diff --git a/.github/workflows/reduced_pytest.yml b/.github/workflows/reduced_pytest.yml index f3d0763e3..1423a1ccc 100644 --- a/.github/workflows/reduced_pytest.yml +++ b/.github/workflows/reduced_pytest.yml @@ -17,16 +17,12 @@ jobs: matrix: - python_version: ['3.8'] - pytorch_version: ['1.9.1', '1.13.0', '2.1.0'] + python_version: ['3.9'] + pytorch_version: ['1.11.0', '2.0.1', '2.3.1'] platform: ['ubuntu-latest'] jit_status: ['jit_disabled'] - exclude: - - pytorch_version: '1.9.1' - platform: 'macos-latest' - if: ${{ !github.event.pull_request.draft }} diff --git a/noxfile.py b/noxfile.py index f71510979..a4b1b64f9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -14,6 +14,7 @@ from gen_github_actions import JIT_STATUSES from gen_github_actions import PYTHON_VERSIONS from gen_github_actions import PYTORCH_VERSIONS +from gen_github_actions import TORCHVISION_VERSION_DICT IS_OSX = system() == 'Darwin' PYTORCH_STABLE_WHEEL_SRC = 'https://download.pytorch.org/whl/cpu' @@ -22,19 +23,6 @@ EXAMPLES_LLM_PYTEST_PYTORCH_IDS = tuple([ f'pytorch_{i}' for i in EXAMPLES_LLM_PYTEST_PYTORCH_VERSIONS]) JIT_IDS = tuple([f'{i}'.lower() for i in JIT_STATUSES]) -LSTM_EXPORT_MIN_PYTORCH = '1.10.1' - -TORCHVISION_VERSION_DICT = { - '1.9.1': '0.10.1', - '1.10.1': '0.11.2', - '1.11.0': '0.12.0', - '1.12.1': '0.13.1', - '1.13.0': '0.14.0', - '2.0.1': '0.15.2', - '2.1.0': '0.16.0', - '2.2.2': '0.17.2', - '2.3.1': '0.18.1', - '2.4.0': '0.19.0'} PARSED_TORCHVISION_VERSION_DICT = {version.parse(k): v for k, v in TORCHVISION_VERSION_DICT.items()} @@ -191,20 +179,16 @@ def tests_brevitas_notebook(session, pytorch): install_pytorch(pytorch, session) install_torchvision(pytorch, session) session.install('--upgrade', '-e', '.[test, ort_integration, notebook]') - if version.parse(pytorch) >= version.parse(LSTM_EXPORT_MIN_PYTORCH): - session.run( - 'pytest', '-n', 'logical', '-v', '--nbmake', '--nbmake-kernel=python3', 'notebooks') - else: - session.run( - 'pytest', - '-n', - 'logical', - '-v', - '--nbmake', - '--nbmake-kernel=python3', - 'notebooks', - '--ignore', - 'notebooks/quantized_recurrent.ipynb') + session.run( + 'pytest', + '-n', + 'logical', + '-v', + '--nbmake', + '--nbmake-kernel=python3', + 'notebooks', + '--ignore', + 'notebooks/quantized_recurrent.ipynb') @nox.session(python=PYTHON_VERSIONS) diff --git a/src/brevitas/fx/__init__.py b/src/brevitas/fx/__init__.py index 50e66a159..325f2dea4 100644 --- a/src/brevitas/fx/__init__.py +++ b/src/brevitas/fx/__init__.py @@ -7,7 +7,7 @@ from brevitas import torch_version # This needs to be bumped until https://github.com/pytorch/pytorch/pull/94461 gets merged -if torch_version < version.parse('2.2'): +if torch_version < version.parse('2.5'): import brevitas.backport.fx as fx from brevitas.backport.fx._compatibility import compatibility from brevitas.backport.fx._symbolic_trace import _assert_is_none diff --git a/tests/brevitas_end_to_end/test_torchvision_models.py b/tests/brevitas_end_to_end/test_torchvision_models.py index 09f0b9253..7ff7a14f9 100644 --- a/tests/brevitas_end_to_end/test_torchvision_models.py +++ b/tests/brevitas_end_to_end/test_torchvision_models.py @@ -132,6 +132,8 @@ def test_torchvision_compile(torchvision_model_compile): torch._dynamo.config.capture_scalar_outputs = True if torchvision_model_compile is None: pytest.skip('Model not instantiated') + if version.parse('2.2.0') <= torch_version <= version.parse('2.3.1'): + pytest.skip('torch.compile not compatible with torch versions between 2.2 and 2.3.1') inp = torch.randn(BATCH, IN_CH, HEIGHT, WIDTH)