Skip to content

Commit

Permalink
tweak torch version check
Browse files Browse the repository at this point in the history
  • Loading branch information
leifdenby committed Feb 5, 2025
1 parent 9d17b40 commit bd84926
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/install-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,19 @@ jobs:
run: |
${{ matrix.package_manager == 'pdm' && 'pdm install --group :all' || 'python -m pip install ".[dev]"' }}
- name: Print and check torch version
- name: Print torch version
run: |
${{ matrix.package_manager == 'pdm' && 'pdm run' || '' }} python -c "import torch; print(torch.__version__)"
${{ matrix.package_manager == 'pdm' && 'pdm run' || '' }} python -c "import torch; assert ('+cpu' in torch.__version__) == (matrix.device == 'cpu')"
- name: Check torch version and variant is cpu
if: matrix.device == 'cpu'
run: |
${{ matrix.package_manager == 'pdm' && 'pdm run' || '' }} python -c "import torch; assert torch.__version__.endswith('+cpu')"
- name: Check torch version and variant is gpu
if: matrix.device == 'gpu'
run: |
${{ matrix.package_manager == 'pdm' && 'pdm run' || '' }} python -c "import torch; assert not torch.__version__.endswith('+cpu')"
- name: Load cache data
uses: actions/cache/restore@v4
Expand Down

0 comments on commit bd84926

Please sign in to comment.