Skip to content

Commit 5b90253

Browse files
authored
Drop torch 1.6 support (#10367)
1 parent 613aa09 commit 5b90253

File tree

11 files changed

+56
-27
lines changed

11 files changed

+56
-27
lines changed

.github/workflows/ci_dockers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
matrix:
9494
# the config used in '.github/workflows/ci_test-conda.yml'
9595
python_version: ["3.8"]
96-
pytorch_version: ["1.6", "1.7", "1.8", "1.9", "1.10"]
96+
pytorch_version: ["1.7", "1.8", "1.9", "1.10"]
9797
steps:
9898
- name: Checkout
9999
uses: actions/checkout@v2

.github/workflows/ci_test-conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
python-version: ["3.8"] # previous to last Python version as that one is already used in test-full
18-
pytorch-version: ["1.6", "1.7", "1.8", "1.9", "1.10"]
18+
pytorch-version: ["1.7", "1.8", "1.9", "1.10"]
1919

2020
# Timeout: https://stackoverflow.com/a/59076067/4521646
2121
timeout-minutes: 35

.github/workflows/ci_test-full.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ jobs:
2828
- {os: macOS-10.15, python-version: "3.6", requires: "oldest", release: "stable"}
2929
# nightly: add when there's a release candidate
3030
#- {os: ubuntu-20.04, python-version: "3.10", requires: "latest", release: "pre"}
31-
exclude:
32-
# PyTorch 1.6 is not available with Python 3.9: https://github.com/pytorch/pytorch/issues/46205
33-
- {os: ubuntu-18.04, python-version: "3.9", requires: "oldest", release: "stable"}
34-
- {os: windows-2019, python-version: "3.9", requires: "oldest", release: "stable"}
35-
- {os: macOS-10.15, python-version: "3.9", requires: "oldest", release: "stable"}
3631

3732
# Timeout: https://stackoverflow.com/a/59076067/4521646
3833
# TODO: the macOS is taking too long, probably caching did not work...

.github/workflows/events-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ jobs:
123123
matrix:
124124
# the config used in '.github/workflows/ci_test-conda.yml'
125125
python_version: ["3.8"]
126-
pytorch_version: ["1.6", "1.7", "1.8", "1.9", "1.10"]
126+
pytorch_version: ["1.7", "1.8", "1.9", "1.10"]
127127

128128
steps:
129129
- name: Checkout

.github/workflows/release-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
python_version: ["3.6", "3.7", "3.8", "3.9"]
19-
pytorch_version: ["1.6", "1.7", "1.8", "1.9"]
19+
pytorch_version: ["1.7", "1.8", "1.9"]
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v2

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
8484
- Removed deprecated property `is_slurm_managing_tasks` from AcceleratorConnector ([#10353](https://github.com/PyTorchLightning/pytorch-lightning/pull/10353))
8585

8686

87+
- Removed PyTorch 1.6 support ([#10367](https://github.com/PyTorchLightning/pytorch-lightning/pull/10367))
88+
89+
8790
- Removed deprecated method `master_params` from PrecisionPlugin ([#10372](https://github.com/PyTorchLightning/pytorch-lightning/pull/10372))
8891

8992

environment.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies:
2929
- python>=3.6
3030
- pip>20.1
3131
- numpy>=1.17.2
32-
- pytorch>=1.6
32+
- pytorch>=1.7.*
3333
- future>=0.17.1
3434
- PyYAML>=5.1
3535
- tqdm>=4.41.0
@@ -41,9 +41,10 @@ dependencies:
4141
- scikit-learn>=0.20.0
4242
- matplotlib>=3.1.1
4343
- omegaconf>=2.0.5
44+
- torchtext>=0.8.*
4445

4546
# Examples
46-
- torchvision>=0.6
47+
- torchvision>=0.8.*
4748

4849
- pip:
4950
- test-tube>=0.7.5

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# the default package dependencies
22

33
numpy>=1.17.2
4-
torch>=1.6
4+
torch>=1.7.*
55
future>=0.17.1 # required for builtins in setup.py
66
tqdm>=4.41.0
77
PyYAML>=5.1

requirements/adjust_versions.py

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
dict(torch="1.8.0", torchvision="0.9.0", torchtext="0.9.0"),
1515
dict(torch="1.7.1", torchvision="0.8.2", torchtext="0.8.1"),
1616
dict(torch="1.7.0", torchvision="0.8.1", torchtext="0.8.0"),
17-
dict(torch="1.6.0", torchvision="0.7.0", torchtext="0.7"),
1817
]
1918

2019

@@ -33,28 +32,59 @@ def find_latest(ver: str) -> Dict[str, str]:
3332
raise ValueError(f"Missing {ver} in {VERSIONS}")
3433

3534

36-
def main(path_req: str, torch_version: Optional[str] = None) -> None:
35+
def main(req: str, torch_version: Optional[str] = None) -> str:
3736
if not torch_version:
3837
import torch
3938

4039
torch_version = torch.__version__
4140
assert torch_version, f"invalid torch: {torch_version}"
4241

43-
with open(path_req) as fp:
44-
req = fp.read()
45-
# remove comments
46-
req = re.sub(rf"\s*#.*{os.linesep}", os.linesep, req)
42+
# remove comments and strip whitespace
43+
req = re.sub(rf"\s*#.*{os.linesep}", os.linesep, req).strip()
4744

4845
latest = find_latest(torch_version)
4946
for lib, version in latest.items():
50-
replace = f"{lib}=={version}" if version else lib
51-
replace += os.linesep
52-
req = re.sub(rf"{lib}[>=]*[\d\.]*{os.linesep}", replace, req)
47+
replace = f"{lib}=={version}" if version else ""
48+
req = re.sub(rf"\b{lib}(?!\w).*", replace, req)
5349

54-
print(req) # on purpose - to debug
55-
with open(path_req, "w") as fp:
56-
fp.write(req)
50+
return req
51+
52+
53+
def test():
54+
requirements = """
55+
torch>=1.2.*
56+
torch==1.2.3
57+
torch==1.4
58+
torch
59+
future>=0.17.1
60+
pytorch==1.5.6+123dev0
61+
torchvision
62+
torchmetrics>=0.4.1
63+
"""
64+
expected = """
65+
torch==1.9.1
66+
torch==1.9.1
67+
torch==1.9.1
68+
torch==1.9.1
69+
future>=0.17.1
70+
pytorch==1.5.6+123dev0
71+
torchvision==0.10.1
72+
torchmetrics>=0.4.1
73+
""".strip()
74+
actual = main(requirements, "1.9")
75+
assert actual == expected, (actual, expected)
5776

5877

5978
if __name__ == "__main__":
60-
main(*sys.argv[1:])
79+
test() # sanity check
80+
81+
if len(sys.argv) == 3:
82+
requirements_path, torch_version = sys.argv[1:]
83+
else:
84+
requirements_path, torch_version = sys.argv[1], None
85+
86+
with open(requirements_path, "r+") as fp:
87+
requirements = fp.read()
88+
requirements = main(requirements, torch_version)
89+
print(requirements) # on purpose - to debug
90+
fp.write(requirements)

requirements/examples.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
torchvision>=0.7
1+
torchvision>=0.8.*
22
gym>=0.17.0
33
ipython[all]

0 commit comments

Comments
 (0)