Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop torch 1.6 support #10367

Merged
merged 16 commits into from Nov 8, 2021
2 changes: 1 addition & 1 deletion .github/workflows/ci_dockers.yml
Expand Up @@ -93,7 +93,7 @@ jobs:
matrix:
# the config used in '.github/workflows/ci_test-conda.yml'
python_version: ["3.8"]
pytorch_version: ["1.6", "1.7", "1.8", "1.9", "1.10"]
pytorch_version: ["1.7", "1.8", "1.9", "1.10"]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_test-conda.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.8"] # previous to last Python version as that one is already used in test-full
pytorch-version: ["1.6", "1.7", "1.8", "1.9", "1.10"]
pytorch-version: ["1.7", "1.8", "1.9", "1.10"]

# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 35
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/ci_test-full.yml
Expand Up @@ -28,11 +28,6 @@ jobs:
- {os: macOS-10.15, python-version: "3.6", requires: "oldest", release: "stable"}
# nightly: add when there's a release candidate
#- {os: ubuntu-20.04, python-version: "3.10", requires: "latest", release: "pre"}
exclude:
# PyTorch 1.6 is not available with Python 3.9: https://github.com/pytorch/pytorch/issues/46205
- {os: ubuntu-18.04, python-version: "3.9", requires: "oldest", release: "stable"}
- {os: windows-2019, python-version: "3.9", requires: "oldest", release: "stable"}
- {os: macOS-10.15, python-version: "3.9", requires: "oldest", release: "stable"}

# Timeout: https://stackoverflow.com/a/59076067/4521646
# TODO: the macOS is taking too long, probably caching did not work...
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/events-nightly.yml
Expand Up @@ -123,7 +123,7 @@ jobs:
matrix:
# the config used in '.github/workflows/ci_test-conda.yml'
python_version: ["3.8"]
pytorch_version: ["1.6", "1.7", "1.8", "1.9", "1.10"]
pytorch_version: ["1.7", "1.8", "1.9", "1.10"]

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-docker.yml
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
python_version: ["3.6", "3.7", "3.8", "3.9"]
pytorch_version: ["1.6", "1.7", "1.8", "1.9"]
pytorch_version: ["1.7", "1.8", "1.9"]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -84,6 +84,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed deprecated property `is_slurm_managing_tasks` from AcceleratorConnector ([#10353](https://github.com/PyTorchLightning/pytorch-lightning/pull/10353))


- Removed PyTorch 1.6 support ([#10367](https://github.com/PyTorchLightning/pytorch-lightning/pull/10367))


- Removed deprecated method `master_params` from PrecisionPlugin ([#10372](https://github.com/PyTorchLightning/pytorch-lightning/pull/10372))


Expand Down
5 changes: 3 additions & 2 deletions environment.yml
Expand Up @@ -29,7 +29,7 @@ dependencies:
- python>=3.6
- pip>20.1
- numpy>=1.17.2
- pytorch>=1.6
- pytorch>=1.7.*
- future>=0.17.1
- PyYAML>=5.1
- tqdm>=4.41.0
Expand All @@ -41,9 +41,10 @@ dependencies:
- scikit-learn>=0.20.0
- matplotlib>=3.1.1
- omegaconf>=2.0.5
- torchtext>=0.8.*

# Examples
- torchvision>=0.6
- torchvision>=0.8.*

- pip:
- test-tube>=0.7.5
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,7 +1,7 @@
# the default package dependencies

numpy>=1.17.2
torch>=1.6
torch>=1.7.*
future>=0.17.1 # required for builtins in setup.py
tqdm>=4.41.0
PyYAML>=5.1
Expand Down
56 changes: 43 additions & 13 deletions requirements/adjust_versions.py
Expand Up @@ -14,7 +14,6 @@
dict(torch="1.8.0", torchvision="0.9.0", torchtext="0.9.0"),
dict(torch="1.7.1", torchvision="0.8.2", torchtext="0.8.1"),
dict(torch="1.7.0", torchvision="0.8.1", torchtext="0.8.0"),
carmocca marked this conversation as resolved.
Show resolved Hide resolved
dict(torch="1.6.0", torchvision="0.7.0", torchtext="0.7"),
]


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


def main(path_req: str, torch_version: Optional[str] = None) -> None:
def main(req: str, torch_version: Optional[str] = None) -> str:
if not torch_version:
import torch

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

with open(path_req) as fp:
req = fp.read()
# remove comments
req = re.sub(rf"\s*#.*{os.linesep}", os.linesep, req)
# remove comments and strip whitespace
req = re.sub(rf"\s*#.*{os.linesep}", os.linesep, req).strip()

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

print(req) # on purpose - to debug
with open(path_req, "w") as fp:
fp.write(req)
return req


def test():
tchaton marked this conversation as resolved.
Show resolved Hide resolved
requirements = """
torch>=1.2.*
torch==1.2.3
torch==1.4
torch
future>=0.17.1
pytorch==1.5.6+123dev0
torchvision
torchmetrics>=0.4.1
"""
expected = """
torch==1.9.1
torch==1.9.1
torch==1.9.1
torch==1.9.1
future>=0.17.1
pytorch==1.5.6+123dev0
torchvision==0.10.1
torchmetrics>=0.4.1
""".strip()
actual = main(requirements, "1.9")
assert actual == expected, (actual, expected)


if __name__ == "__main__":
main(*sys.argv[1:])
test() # sanity check

if len(sys.argv) == 3:
requirements_path, torch_version = sys.argv[1:]
else:
requirements_path, torch_version = sys.argv[1], None

with open(requirements_path, "r+") as fp:
requirements = fp.read()
requirements = main(requirements, torch_version)
print(requirements) # on purpose - to debug
fp.write(requirements)
2 changes: 1 addition & 1 deletion requirements/examples.txt
@@ -1,3 +1,3 @@
torchvision>=0.7
torchvision>=0.8.*
gym>=0.17.0
ipython[all]
2 changes: 1 addition & 1 deletion requirements/extra.txt
Expand Up @@ -2,7 +2,7 @@

matplotlib>3.1
horovod>=0.21.2 # no need to install with [pytorch] as pytorch is already installed
torchtext>=0.7
torchtext>=0.8.*
omegaconf>=2.0.5
hydra-core>=1.0.5
jsonargparse[signatures]>=3.19.3
Expand Down