[CI] fix windows CI for PT 1.8/1.9 #1024
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
unit-test: | |
name: Unit tests for ${{ matrix.os }}, PyTorch ${{ matrix.vers.pt_ver }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["windows-latest"] | |
vers: [ {pt_ver: "1.8.0", tv_ver: "0.9.0"}, {pt_ver: "1.9.0", tv_ver: "0.10.0"} ] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
python-version: 3.8 | |
- name: Install PyTorch | |
env: | |
PYTORCH_VER: ${{ matrix.vers.pt_ver }} | |
TORCHVISION_VER: ${{ matrix.vers.tv_ver }} | |
run: | | |
if [ "$RUNNER_OS" == "macOS" ]; then | |
if [[ "$TORCHVISION_VER" == "latest" && "$PYTORCH_VER" == "latest" ]]; then | |
conda install pytorch::pytorch torchvision -c pytorch | |
elif [[ "$TORCHVISION_VER" == "0.9."* || "$TORCHVISION_VER" == "0.10."* ]]; then | |
conda install pytorch=$PYTORCH_VER torchvision=$TORCHVISION_VER pillow=6 -c pytorch | |
else | |
conda install pytorch=$PYTORCH_VER torchvision=$TORCHVISION_VER -c pytorch | |
fi | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
if [[ "$TORCHVISION_VER" == "latest" && "$PYTORCH_VER" == "latest" ]]; then | |
conda install pytorch torchvision cpuonly pillow=6 -c pytorch | |
elif [[ "$TORCHVISION_VER" == "0.9."* || "$TORCHVISION_VER" == "0.10."* ]]; then | |
conda install pytorch=$PYTORCH_VER torchvision=$TORCHVISION_VER cpuonly pillow=7 -c pytorch | |
else | |
conda install pytorch=$PYTORCH_VER torchvision=$TORCHVISION_VER cpuonly pillow=6 -c pytorch | |
fi | |
else | |
if [[ "$TORCHVISION_VER" == "latest" && "$PYTORCH_VER" == "latest" ]]; then | |
conda install pytorch torchvision cpuonly -c pytorch | |
else | |
conda install pytorch=$PYTORCH_VER torchvision=$TORCHVISION_VER cpuonly -c pytorch | |
fi | |
fi | |
- name: Install TinyNeuralNetwork | |
run: pip install . | |
- name: Install test dependencies | |
env: | |
PYTORCH_VER: ${{ matrix.vers.pt_ver }} | |
TORCHVISION_VER: ${{ matrix.vers.tv_ver }} | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" && "$TORCHVISION_VER" == "latest" && "$PYTORCH_VER" == "latest" ]]; then | |
pip install black 'ruff<0.0.234' 'tensorflow<2.12' scipy interval | |
else | |
pip install black 'ruff<0.0.234' tensorflow scipy interval | |
fi | |
- name: Lint checks | |
run: python -m ruff . | |
- name: Style checks | |
run: python -m black . | |
- name: Run unit tests | |
run: | | |
cd tests | |
python import_test.py -v | |
python converter_op_test.py -v | |
python converter_optimizer_test.py -v | |
python quantizer_test.py -v | |
python modifier_prune_test.py -v | |
python modifier_test.py -v | |
python cross_layer_equalization_test.py -v | |
- name: Run integration tests | |
run: | | |
source activate.sh | |
cd tests | |
rm -rf out || true | |
python converter_test.py -v -k mobilenet | |
if [ "$RUNNER_OS" != "Windows" ]; then | |
rm -rf out || true | |
python converter_qat_test.py -v -k mobilenet | |
fi | |
rm -rf out || true | |
python tracer_test.py -v -k mobilenet |