Skip to content

Commit a44df45

Browse files
BordaSeanNaren
authored andcommitted
tests for legacy checkpoints (#5223)
* wip * generate * clean * tests * copy * download * download * download * download * download * download * download * download * download * download * download * flake8 * extend * aws * extension * pull * pull * pull * pull * pull * pull * pull * try * try * try * got it * Apply suggestions from code review (cherry picked from commit 72525f0)
1 parent d595977 commit a44df45

File tree

16 files changed

+286
-7
lines changed

16 files changed

+286
-7
lines changed

.drone.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ steps:
3939
# when Image has defined CUDa version we can switch to this package spec "nvidia-dali-cuda${CUDA_VERSION%%.*}0"
4040
- pip install --extra-index-url https://developer.download.nvidia.com/compute/redist nvidia-dali-cuda100 --upgrade-strategy only-if-needed
4141
- pip list
42+
# todo: remove unzip install after new nigtly docker is created
43+
- apt-get update -qq
44+
- apt-get install -y --no-install-recommends unzip
45+
# get legacy checkpoints
46+
- wget https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip -P legacy/
47+
- unzip -o legacy/checkpoints.zip -d legacy/
48+
- ls -l legacy/checkpoints/
49+
# testing...
4250
- python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v --durations=25 # --flake8
4351
# Running special tests
4452
- sh tests/special_tests.sh

.github/workflows/ci_test-conda.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,21 @@ jobs:
3434
# todo this probably does not work with docker images, rather cache dockers
3535
uses: actions/cache@v2
3636
with:
37-
path: Datasets # This path is specific to Ubuntu
38-
# Look to see if there is a cache hit for the corresponding requirements file
37+
path: Datasets
3938
key: pl-dataset
4039

40+
- name: Pull checkpoints from S3
41+
# todo: consider adding coma caching, but ATM all models have less then 100KB
42+
run: |
43+
# todo: remove unzip install after new nigtly docker is created
44+
apt-get update -qq
45+
apt-get install -y --no-install-recommends unzip
46+
# enter legacy and update checkpoints from S3
47+
cd legacy
48+
curl https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip --output checkpoints.zip
49+
unzip -o checkpoints.zip
50+
ls -l checkpoints/
51+
4152
- name: Tests
4253
run: |
4354
# NOTE: run coverage on tests does not propagare faler status for Win, https://github.com/nedbat/coveragepy/issues/1003

.github/workflows/ci_test-full.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ jobs:
8787
restore-keys: |
8888
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-
8989
90+
- name: Pull checkpoints from S3
91+
# todo: consider adding some caching, but ATM all models have less then 100KB
92+
run: |
93+
cd legacy
94+
# wget is simpler but does not work on Windows
95+
python -c "from urllib.request import urlretrieve ; urlretrieve('https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip', 'checkpoints.zip')"
96+
ls -l .
97+
unzip -o checkpoints.zip
98+
ls -l checkpoints/
99+
90100
- name: Install dependencies
91101
env:
92102
# MAKEFLAGS: "-j2"
@@ -119,8 +129,7 @@ jobs:
119129
- name: Cache datasets
120130
uses: actions/cache@v2
121131
with:
122-
path: Datasets # This path is specific to Ubuntu
123-
# Look to see if there is a cache hit for the corresponding requirements file
132+
path: Datasets
124133
key: pl-dataset
125134

126135
- name: Tests

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
time: 5m
3737

38-
# We do this, since failures on test.pypi aren't that bad
38+
# We do this, since failures on test.pypi aren't that bad
3939
- name: Publish to Test PyPI
4040
uses: pypa/[email protected]
4141
with:

.github/workflows/release-pypi.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
55
push:
66
branches: [master, "release/*"] # include release branches like release/1.0.x
77
release:
8-
types: [created, "release/*"]
8+
types: [created]
99

1010

1111
jobs:
@@ -61,3 +61,51 @@ jobs:
6161
with:
6262
user: __token__
6363
password: ${{ secrets.pypi_password }}
64+
65+
# Note: This uses an internal pip API and may not always work
66+
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
67+
- name: Cache pip
68+
uses: actions/cache@v2
69+
with:
70+
path: ~/.cache/pip
71+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
72+
restore-keys: ${{ runner.os }}-pip-
73+
74+
- name: Install dependencies
75+
run: |
76+
pip install -r requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
77+
pip install virtualenv
78+
pip install awscli
79+
80+
- name: Configure AWS credentials
81+
uses: aws-actions/configure-aws-credentials@v1
82+
with:
83+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
84+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_ID }}
85+
aws-region: us-east-1
86+
87+
- name: Pull files from S3
88+
run: |
89+
aws s3 cp --recursive s3://pl-public-data/legacy/checkpoints/ legacy/checkpoints/ # --acl public-read
90+
ls -l legacy/checkpoints/
91+
92+
- name: Generate checkpoint
93+
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
94+
run: |
95+
virtualenv vEnv --system-site-packages
96+
source vEnv/bin/activate
97+
pip install dist/*
98+
99+
pl_ver=$(python -c "import pytorch_lightning as pl ; print(pl.__version__)" 2>&1)
100+
# generate checkpoint to this version
101+
bash legacy/generate_checkpoints.sh $pl_ver
102+
103+
deactivate
104+
rm -rf vEnv
105+
106+
- name: Push files to S3
107+
run: |
108+
aws s3 sync legacy/checkpoints/ s3://pl-public-data/legacy/checkpoints/
109+
cd legacy
110+
zip -r checkpoints.zip checkpoints
111+
aws s3 cp checkpoints.zip s3://pl-public-data/legacy/ --acl public-read

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ timit_data/
2727
# C extensions
2828
*.so
2929

30+
# PyCharm
3031
.idea/
3132

3233
# Distribution / packaging
@@ -126,11 +127,14 @@ ENV/
126127

127128
# mypy
128129
.mypy_cache/
130+
# pytest
131+
.pytest_cache/
129132

130133
# data
131134
.data/
132135
Datasets/
133136
mnist/
137+
legacy/checkpoints/
134138

135139
# pl tests
136140
ml-runs/

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ prune temp*
6969
prune test*
7070
prune benchmark*
7171
prune dockers
72+
prune legacy

dockers/base-conda/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ RUN apt-get update -qq && \
3939
build-essential \
4040
cmake \
4141
git \
42+
wget \
4243
curl \
44+
unzip \
4345
ca-certificates \
4446
&& \
4547

dockers/base-cuda/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ RUN apt-get update -qq && \
4444
cmake \
4545
git \
4646
wget \
47+
curl \
48+
unzip \
4749
ca-certificates \
4850
software-properties-common \
4951
&& \

dockers/tpu-tests/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ MAINTAINER PyTorchLightning <https://github.com/PyTorchLightning>
2323

2424
COPY ./ ./pytorch-lightning/
2525

26+
# Pull the legacy checkpoints
27+
RUN cd pytorch-lightning && \
28+
wget https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip -P legacy/ && \
29+
unzip -o legacy/checkpoints.zip -d legacy/ && \
30+
ls -l legacy/checkpoints/
31+
2632
# If using this image for tests, intall more dependencies and don"t delete the source code where the tests live.
2733
RUN \
2834
# Install pytorch-lightning at the current PR, plus dependencies.

0 commit comments

Comments
 (0)