10000 remove fake test · pytorch/ignite@6ff119f · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

uv in unit-tests.yml #3350 #5806

uv in unit-tests.yml #3350

uv in unit-tests.yml #3350 #5806

Workflow file for this run

name: Run unit tests
on:
push:
branches:
- master
- "*.*.*"
paths:
- "ignite/**"
- "tests/ignite/**"
- "tests/run_cpu_tests.sh"
- "tests/run_code_style.sh"
- "examples/**.py"
- "requirements-dev.txt"
- ".github/workflows/unit-tests.yml"
pull_request:
paths:
- "ignite/**"
- "tests/ignite/**"
- "tests/run_cpu_tests.sh"
- "tests/run_code_style.sh"
- "examples/**.py"
- "requirements-dev.txt"
- ".github/workflows/unit-tests.yml"
workflow_dispatch:
merge_group:
concurrency:
# <workflow_name>-<branch_name>-<true || commit_sha (if branch is protected)>
group: unit-tests-${{ github.ref_name }}-${{ !(github.ref_protected) || github.sha }}
cancel-in-progress: true
jobs:
cpu-tests:
runs-on: ${{ matrix.os }}
env:
UV_SYSTEM_PIP: 1
CLEARML_OFFLINE_MODE: 1
CLEARML_API_HOST: http://localhost
CLEARML_WEB_HOST: http://localhost
CLEARML_FILES_HOST: http://localhost
timeout-minutes: 85
defaults:
run:
shell: bash
strategy:
max-parallel: 10
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
pytorch-channel: [pytorch, pytorch-nightly]
include:
# includes a single build on windows
- os: windows-latest
pytorch-channel: pytorch
python-version: 3.11
skip-distrib-tests: 1
# includes a single build on macosx
- os: macos-latest
pytorch-channel: pytorch
python-version: 3.11
skip-distrib-tests: 1
steps:
- uses: actions/checkout@v4
- name: Install uv and Python
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
cache: true
- name: Install PyTorch
if: ${{ matrix.pytorch-channel == 'pytorch' }}
run: uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
- name: Install PyTorch (nightly)
if: ${{ matrix.pytorch-channel == 'pytorch-nightly' }}
run: uv pip install torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --pre
- name: Install dependencies
run: |
uv pip install -r requirements-dev.txt
uv pip install -e .
uv pip install pre-commit
uv pip list
- name: Lint only changed files
run: |
BASE=${{ github.event.pull_request.base.ref }}
# fetch that branch’s tip
git fetch origin $BASE
# diff from base → HEAD
pre-commit run --show-diff-on-failure \
--from-ref origin/$BASE \
--to-ref HEAD
# Download MNIST: https://github.com/pytorch/ignite/issues/1737
# to "/tmp" for unit tests
- name: Download MNIST
uses: pytorch-ignite/download-mnist-github-action@master
with:
target_dir: /tmp
# Copy MNIST to "." for the examples
- name: Copy MNIST
run: |
cp -R /tmp/MNIST .
- name: Run Tests
uses: nick-fields/retry@v3
with:
max_attempts: 5
timeout_minutes: 15
shell: bash
command: SKIP_DISTRIB_TESTS=${{ matrix.skip-distrib-tests }} bash tests/run_cpu_tests.sh
new_command_on_retry: USE_LAST_FAILED=1 SKIP_DISTRIB_TESTS=${{ matrix.skip-distrib-tests }} bash tests/run_cpu_tests.sh
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: cpu
fail_ci_if_error: false
- name: Run MNIST Examples
run: |
# MNIST
# 1) mnist.py
python examples/mnist/mnist.py --epochs=1
- name: Run MNIST with loggers Examples
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
# 2) mnist_with_visdom.py
python -c "from visdom.server.build import download_scripts; download_scripts()" # download scripts : https://github.com/facebookresearch/visdom/blob/master/py/server.py#L929
p 507F ython -m visdom.server &
sleep 10
python examples/mnist/mnist_with_visdom.py --epochs=1
kill %1
# 3.1) mnist_with_tensorboard.py with tbX
python examples/mnist/mnist_with_tensorboard.py --epochs=1
# 3.2) mnist_with_tensorboard.py with native torch tb
pip uninstall -y tensorboardX
python examples/mnist/mnist_with_tensorboard.py --epochs=1
- name: Run MNIST Example With Crash
if: ${{ matrix.os == 'ubuntu-latest' }}
continue-on-error: true
run: |
# 4) mnist_save_resume_engine.py
python examples/mnist/mnist_save_resume_engine.py --epochs=2 --crash_iteration 1100
- name: Resume MNIST from previous crash
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
python examples/mnist/mnist_save_resume_engine.py --epochs=2 --resume_from=/tmp/mnist_save_resume/checkpoint_1.pt
- name: Run GAN example
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
# DCGAN
python examples/gan/dcgan.py --dataset fake --dataroot /tmp/fakedata --output-dir /tmp/outputs-dcgan --batch-size 2 --epochs 2 --workers 0
- name: Run RL Examples
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
# RL
# 1) Actor-Critic
python examples/reinforcement_learning/actor_critic.py --max-episodes=2
# 2) Reinforce
python examples/reinforcement_learning/reinforce.py --max-episodes=2
- name: Run Neural Style Example
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
#fast-neural-style
#train
mkdir -p ~/.cache/torch/checkpoints/ && wget "https://download.pytorch.org/models/vgg16-397923af.pth" -O ~/.cache/torch/checkpoints/vgg16-397923af.pth
python examples/fast_neural_style/neural_style.py train --epochs 1 --cuda 0 --dataset test --dataroot . --image_size 32 --style_image examples/fast_neural_style/images/style_images/mosaic.jpg --style_size 32
- name: Run SR Example
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
set -e
echo "Testing Caltech101 dataset availability..."
if python -c "import torchvision; torchvision.datasets.Caltech101(root='./data', download=True)"; then
echo "Caltech101 dataset downloaded successfully. Please remove this workaround and restore dataset check."
exit 1
# python examples/super_resolution/main.py --upscale_factor 3 --crop_size 180 --batch_size 4 --test_batch_size 100 --n_epochs 1 --lr 0.001 --threads 2 --debug
else
echo "Caltech101 dataset failed to download. Skipping SR example test."
fi
0