forked from pytorch/ignite
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (96 loc) · 4.66 KB
/
unittests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 10
fail-fast: false
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
pytorch-channel: [pytorch, pytorch-nightly]
exclude:
# excludes pytorch-nightly python 3.5 as it was dropped
- pytorch-channel: pytorch-nightly
python-version: 3.5
steps:
- uses: actions/checkout@v2
- name: Setup Conda
run: |
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
conda config --set always_yes yes --set changeps1 no
conda update -q conda
# Useful for debugging any issues with conda
conda info -a
conda create -q -n test-environment pytorch cpuonly python=${{ matrix.python-version }} -c ${{ matrix.pytorch-channel }}
- name: Install dependencies
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate test-environment
# Keep fix in case of problem with torchvision nightly releases
# if [[ "${{ matrix.pytorch-channel }}" == "pytorch-nightly" ]]; then pip install --upgrade git+https://github.com/pytorch/vision.git; else conda install torchvision cpuonly python=${{ matrix.python-version }} -c ${{ matrix.pytorch-channel }}; fi
conda install torchvision cpuonly python=${{ matrix.python-version }} -c ${{ matrix.pytorch-channel }}
pip install -r requirements-dev.txt
python setup.py install
- name: Run Tests
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate test-environment
CUDA_VISIBLE_DEVICES="" py.test --tx 4*popen//python=python${{ matrix.python-version }} --cov ignite --cov-report term-missing -vvv tests/
# tests for distributed ops
export WORLD_SIZE=2
py.test --cov ignite --cov-append --cov-report term-missing --dist=each --tx $WORLD_SIZE*popen//python=python${{ matrix.python-version }} tests -m distributed -vvv
- name: Run MNIST Examples
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate test-environment
# MNIST
# 1) mnist.py
python examples/mnist/mnist.py --epochs=1
# 2) mnist_with_visdom.py
python -c "from visdom.server import download_scripts; download_scripts()" # download scripts : https://github.com/facebookresearch/visdom/blob/master/py/server.py#L929
python -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
continue-on-error: true
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate test-environment
# 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
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate test-environment
python examples/mnist/mnist_save_resume_engine.py --epochs=2 --resume_from=/tmp/mnist_save_resume/checkpoint_1.pt
- name: Run GAN example
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate test-environment
# 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
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate test-environment
# 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
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate test-environment
#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