Skip to content

Commit

Permalink
Relax version requirements
Browse files Browse the repository at this point in the history
- Bump minimum pytorch-lightning version to 1.7.0. This avoids the
  installation of protobuf < 3.20.3 which has known vulnerabilities.
- train: Fix SWA compatibility with PL >= 1.7.0
- Fix compatibility with timm > 0.6.5 (tested until 0.9.2)
- Add minimum version requirements to all direct dependencies
- Add maximum version limit to ray[tune], pytorch-lightning
  • Loading branch information
baudm committed Jun 1, 2023
1 parent 6904316 commit dc7c241
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 129 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ Requires Python 3.8 or newer and PyTorch 1.13. Originally developed on Python 3.
platform=cpu
# Generate requirements files for specified PyTorch platform
make torch-${platform}
# Install the project and core + train dependencies. Options: [train,test,bench,tune]
pip install -r requirements/core.${platform}.txt -e .[train]
# Install the project and core + train + test dependencies. Subsets: [train,test,bench,tune]
pip install -r requirements/core.${platform}.txt -e .[train,test]
```
#### Updating dependency version pins
```bash
Expand Down
3 changes: 2 additions & 1 deletion configs/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ trainer:
#max_steps: 169680 # 20 epochs x 8484 steps (for batch size = 384, real data)
max_epochs: 20
gradient_clip_val: 20
gpus: 2
accelerator: gpu
devices: 2

ckpt_path: null
pretrained: null
Expand Down
2 changes: 1 addition & 1 deletion configs/tune.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defaults:
- _self_

trainer:
gpus: 1 # tuning with DDP is not yet supported.
devices: 1 # tuning with DDP is not yet supported.

tune:
num_samples: 10
Expand Down
5 changes: 3 additions & 2 deletions requirements/bench.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-c ${CONSTRAINTS}
hydra-core~=1.2.0
fvcore

hydra-core >=1.2.0
fvcore >=0.1.5.post20220512
2 changes: 1 addition & 1 deletion requirements/bench.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
antlr4-python3-runtime==4.9.3
fvcore==0.1.5.post20221221
hydra-core==1.2.0
hydra-core==1.3.2
importlib-resources==5.12.0
iopath==0.1.10
numpy==1.24.3
Expand Down
80 changes: 16 additions & 64 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/cpu

absl-py==1.4.0
# via tensorboard
aiohttp==3.8.4
# via fsspec
aiosignal==1.3.1
Expand All @@ -27,8 +25,6 @@ backcall==0.2.0
# via ipython
botorch==0.8.5
# via ax-platform
cachetools==5.3.1
# via google-auth
certifi==2023.5.7
# via requests
charset-normalizer==3.1.0
Expand Down Expand Up @@ -71,21 +67,13 @@ fsspec==2023.5.0
# pytorch-lightning
fvcore==0.1.5.post20221221
# via -r requirements/bench.in
google-auth==2.19.0
# via
# google-auth-oauthlib
# tensorboard
google-auth-oauthlib==0.4.6
# via tensorboard
gpytorch==1.10
# via botorch
grpcio==1.43.0
# via
# ray
# tensorboard
huggingface-hub==0.14.1
# via ray
huggingface-hub==0.15.1
# via timm
hydra-core==1.2.0
hydra-core==1.3.2
# via
# -r requirements/bench.in
# -r requirements/tune.in
Expand All @@ -102,9 +90,7 @@ imgaug==0.4.0
# -r requirements/train.in
# -r requirements/tune.in
importlib-metadata==6.6.0
# via
# jupyter-client
# markdown
# via jupyter-client
importlib-resources==5.12.0
# via
# hydra-core
Expand Down Expand Up @@ -142,6 +128,8 @@ kiwisolver==1.4.4
# via matplotlib
lazy-loader==0.2
# via scikit-image
lightning-utilities==0.8.0
# via pytorch-lightning
linear-operator==0.4.0
# via
# botorch
Expand All @@ -150,12 +138,8 @@ lmdb==1.4.1
# via
# -r requirements/test.in
# -r requirements/tune.in
markdown==3.4.3
# via tensorboard
markupsafe==2.1.2
# via
# jinja2
# werkzeug
# via jinja2
matplotlib==3.7.1
# via imgaug
matplotlib-inline==0.1.6
Expand Down Expand Up @@ -194,13 +178,10 @@ numpy==1.24.3
# scikit-learn
# scipy
# shapely
# tensorboard
# tensorboardx
# tifffile
# torchmetrics
# torchvision
oauthlib==3.2.2
# via requests-oauthlib
omegaconf==2.3.0
# via hydra-core
opencv-python==4.7.0.72
Expand All @@ -212,6 +193,7 @@ packaging==23.1
# huggingface-hub
# hydra-core
# ipykernel
# lightning-utilities
# matplotlib
# plotly
# pytorch-lightning
Expand Down Expand Up @@ -250,26 +232,16 @@ portalocker==2.7.0
# via iopath
prompt-toolkit==3.0.38
# via ipython
protobuf==3.20.1
protobuf==3.20.3
# via
# pytorch-lightning
# ray
# tensorboard
# tensorboardx
psutil==5.9.5
# via ipykernel
ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.2
# via stack-data
pyasn1==0.5.0
# via
# pyasn1-modules
# rsa
pyasn1-modules==0.3.0
# via google-auth
pydeprecate==0.3.2
# via pytorch-lightning
pygments==2.15.1
# via ipython
pyparsing==3.0.9
Expand All @@ -285,7 +257,7 @@ python-dateutil==2.8.2
# jupyter-client
# matplotlib
# pandas
pytorch-lightning==1.6.5
pytorch-lightning==1.9.5
# via -r requirements/core.in
pytz==2023.3
# via pandas
Expand Down Expand Up @@ -314,13 +286,9 @@ requests==2.31.0
# fsspec
# huggingface-hub
# ray
# requests-oauthlib
# tensorboard
# torchvision
requests-oauthlib==1.3.1
# via google-auth-oauthlib
rsa==4.9
# via google-auth
safetensors==0.3.1
# via timm
scikit-image==0.20.0
# via imgaug
scikit-learn==1.2.2
Expand All @@ -340,7 +308,6 @@ shapely==2.0.1
six==1.16.0
# via
# asttokens
# google-auth
# grpcio
# imgaug
# multipledispatch
Expand All @@ -353,12 +320,6 @@ tabulate==0.9.0
# ray
tenacity==8.2.2
# via plotly
tensorboard==2.11.2
# via pytorch-lightning
tensorboard-data-server==0.6.1
# via tensorboard
tensorboard-plugin-wit==1.8.1
# via tensorboard
tensorboardx==2.6
# via ray
termcolor==2.3.0
Expand All @@ -367,7 +328,7 @@ threadpoolctl==3.1.0
# via scikit-learn
tifffile==2023.4.12
# via scikit-image
timm==0.6.13
timm==0.9.2
# via -r requirements/core.in
torch==1.13.1+cpu
# via
Expand Down Expand Up @@ -414,24 +375,19 @@ typing-extensions==4.6.2
# huggingface-hub
# iopath
# ipython
# lightning-utilities
# pytorch-lightning
# torch
# torchmetrics
# torchvision
tzdata==2023.3
# via pandas
urllib3==1.26.16
# via
# google-auth
# requests
urllib3==2.0.2
# via requests
virtualenv==20.23.0
# via ray
wcwidth==0.2.6
# via prompt-toolkit
werkzeug==2.3.4
# via tensorboard
wheel==0.40.0
# via tensorboard
widgetsnbextension==4.0.7
# via ipywidgets
yacs==0.1.8
Expand All @@ -442,7 +398,3 @@ zipp==3.15.0
# via
# importlib-metadata
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
setuptools==67.8.0
# via tensorboard
9 changes: 5 additions & 4 deletions requirements/core.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
-c ${CONSTRAINTS}

torch >=1.10.0, <2.0.0
torchvision >=0.11.0, <0.15.0
timm~=0.6.5
pytorch-lightning~=1.6.5 # TODO: refactor code to separate model from training code.
nltk # TODO: refactor/reorganize code. This is a train/test dependency.
PyYAML # TODO: can we move this to train/test?
timm >=0.6.5
pytorch-lightning >=1.7.0, <2.0.0 # TODO: refactor code to separate model from training code.
nltk >=3.7.0 # TODO: refactor/reorganize code. This is a train/test dependency.
PyYAML >=6.0.0 # TODO: can we move this to train/test?
35 changes: 6 additions & 29 deletions requirements/core.txt
Original file line number Diff line number Diff line change
@@ -1,57 +1,34 @@
--extra-index-url https://download.pytorch.org/whl/cpu

absl-py==1.4.0
aiohttp==3.8.4
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
cachetools==5.3.1
certifi==2023.5.7
charset-normalizer==3.1.0
click==8.0.4
filelock==3.12.0
frozenlist==1.3.3
fsspec[http]==2023.5.0
google-auth==2.19.0
google-auth-oauthlib==0.4.6
grpcio==1.43.0
huggingface-hub==0.14.1
huggingface-hub==0.15.1
idna==3.4
importlib-metadata==6.6.0
joblib==1.2.0
markdown==3.4.3
markupsafe==2.1.2
lightning-utilities==0.8.0
multidict==6.0.4
nltk==3.8.1
numpy==1.24.3
oauthlib==3.2.2
packaging==23.1
pillow==9.5.0
protobuf==3.20.1
pyasn1==0.5.0
pyasn1-modules==0.3.0
pydeprecate==0.3.2
pytorch-lightning==1.6.5
pytorch-lightning==1.9.5
pyyaml==6.0
regex==2023.5.5
requests==2.31.0
requests-oauthlib==1.3.1
rsa==4.9
six==1.16.0
tensorboard==2.11.2
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
timm==0.6.13
safetensors==0.3.1
timm==0.9.2
torch==1.13.1+cpu
torchmetrics==0.11.4
torchvision==0.14.1+cpu
tqdm==4.65.0
typing-extensions==4.6.2
urllib3==1.26.16
werkzeug==2.3.4
wheel==0.40.0
urllib3==2.0.2
yarl==1.9.2
zipp==3.15.0

# The following packages are considered to be unsafe in a requirements file:
setuptools==67.8.0
7 changes: 4 additions & 3 deletions requirements/test.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-c ${CONSTRAINTS}
lmdb
pillow
tqdm

lmdb >=1.3.0
Pillow >=9.2.0
tqdm >=4.64.0
9 changes: 5 additions & 4 deletions requirements/train.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-c ${CONSTRAINTS}
lmdb
pillow
imgaug
hydra-core~=1.2.0

lmdb >=1.3.0
Pillow >=9.2.0
imgaug >=0.4.0
hydra-core >=1.2.0
2 changes: 1 addition & 1 deletion requirements/train.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ antlr4-python3-runtime==4.9.3
contourpy==1.0.7
cycler==0.11.0
fonttools==4.39.4
hydra-core==1.2.0
hydra-core==1.3.2
imageio==2.30.0
imgaug==0.4.0
importlib-resources==5.12.0
Expand Down
13 changes: 7 additions & 6 deletions requirements/tune.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
-c ${CONSTRAINTS}
lmdb
pillow
imgaug
hydra-core~=1.2.0
ray[tune]~=1.13.0
ax-platform

lmdb >=1.3.0
Pillow >=9.2.0
imgaug >=0.4.0
hydra-core >=1.2.0
ray[tune] >=1.13.0, <2.0.0
ax-platform >=0.2.5.1
Loading

0 comments on commit dc7c241

Please sign in to comment.