From 1a779ee2b11f48d3ce51ac61f80a6453c8c4e8bc Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 11 Aug 2023 00:12:11 +0200 Subject: [PATCH] Bump `torch>=1.8.0` and `torchvision>=0.9.0` (#11970) --- .github/workflows/ci-testing.yml | 8 ++++---- .github/workflows/greetings.yml | 2 +- README.md | 4 ++-- README.zh-CN.md | 2 +- models/experimental.py | 4 ++-- requirements.txt | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 13f9787ed8c9..80ae42955605 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -63,9 +63,9 @@ jobs: python-version: '3.9' model: yolov5n - os: ubuntu-latest - python-version: '3.8' # torch 1.7.0 requires python >=3.6, <=3.8 + python-version: '3.8' # torch 1.8.0 requires python >=3.6, <=3.8 model: yolov5n - torch: '1.7.0' # min torch version CI https://pypi.org/project/torchvision/ + torch: '1.8.0' # min torch version CI https://pypi.org/project/torchvision/ steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -75,8 +75,8 @@ jobs: - name: Install requirements run: | python -m pip install --upgrade pip wheel - if [ "${{ matrix.torch }}" == "1.7.0" ]; then - pip install -r requirements.txt torch==1.7.0 torchvision==0.8.1 --extra-index-url https://download.pytorch.org/whl/cpu + if [ "${{ matrix.torch }}" == "1.8.0" ]; then + pip install -r requirements.txt torch==1.8.0 torchvision==0.9.0 --extra-index-url https://download.pytorch.org/whl/cpu else pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu fi diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index 8aca12d3c370..2203b2c60a94 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -31,7 +31,7 @@ jobs: ## Requirements - [**Python>=3.7.0**](https://www.python.org/) with all [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) installed including [**PyTorch>=1.7**](https://pytorch.org/get-started/locally/). To get started: + [**Python>=3.7.0**](https://www.python.org/) with all [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) installed including [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). To get started: ```bash git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 diff --git a/README.md b/README.md index a27fe2474fd8..b9941b74ef34 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,8 @@ See the [YOLOv5 Docs](https://docs.ultralytics.com/yolov5) for full documentatio Install Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a -[**Python>=3.7.0**](https://www.python.org/) environment, including -[**PyTorch>=1.7**](https://pytorch.org/get-started/locally/). +[**Python>=3.8.0**](https://www.python.org/) environment, including +[**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). ```bash git clone https://github.com/ultralytics/yolov5 # clone diff --git a/README.zh-CN.md b/README.zh-CN.md index fe382af359a0..49503c3c8b68 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -72,7 +72,7 @@ pip install ultralytics
安装 -克隆 repo,并要求在 [**Python>=3.7.0**](https://www.python.org/) 环境中安装 [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) ,且要求 [**PyTorch>=1.7**](https://pytorch.org/get-started/locally/) 。 +克隆 repo,并要求在 [**Python>=3.7.0**](https://www.python.org/) 环境中安装 [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) ,且要求 [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/) 。 ```bash git clone https://github.com/ultralytics/yolov5 # clone diff --git a/models/experimental.py b/models/experimental.py index d60d1808da11..11f75e2254b3 100644 --- a/models/experimental.py +++ b/models/experimental.py @@ -87,11 +87,11 @@ def attempt_load(weights, device=None, inplace=True, fuse=True): model.append(ckpt.fuse().eval() if fuse and hasattr(ckpt, 'fuse') else ckpt.eval()) # model in eval mode - # Module compatibility updates + # Module updates for m in model.modules(): t = type(m) if t in (nn.Hardswish, nn.LeakyReLU, nn.ReLU, nn.ReLU6, nn.SiLU, Detect, Model): - m.inplace = inplace # torch 1.7.0 compatibility + m.inplace = inplace if t is Detect and not isinstance(m.anchor_grid, list): delattr(m, 'anchor_grid') setattr(m, 'anchor_grid', [torch.zeros(1)] * m.nl) diff --git a/requirements.txt b/requirements.txt index ee9e7dbcfb80..33bb7dba2611 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,8 +12,8 @@ PyYAML>=5.3.1 requests>=2.23.0 scipy>=1.4.1 thop>=0.1.1 # FLOPs computation -torch>=1.7.0 # see https://pytorch.org/get-started/locally (recommended) -torchvision>=0.8.1 +torch>=1.8.0 # see https://pytorch.org/get-started/locally (recommended) +torchvision>=0.9.0 tqdm>=4.64.0 ultralytics>=8.0.147 # protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012