Bump `torch>=1.8.0` and `torchvision>=0.9.0` (#11970)

pull/11971/head
Glenn Jocher 2023-08-11 00:12:11 +02:00 committed by GitHub
parent df48c205c5
commit 1a779ee2b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 12 deletions

View File

@ -63,9 +63,9 @@ jobs:
python-version: '3.9' python-version: '3.9'
model: yolov5n model: yolov5n
- os: ubuntu-latest - 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 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: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
@ -75,8 +75,8 @@ jobs:
- name: Install requirements - name: Install requirements
run: | run: |
python -m pip install --upgrade pip wheel python -m pip install --upgrade pip wheel
if [ "${{ matrix.torch }}" == "1.7.0" ]; then if [ "${{ matrix.torch }}" == "1.8.0" ]; then
pip install -r requirements.txt torch==1.7.0 torchvision==0.8.1 --extra-index-url https://download.pytorch.org/whl/cpu pip install -r requirements.txt torch==1.8.0 torchvision==0.9.0 --extra-index-url https://download.pytorch.org/whl/cpu
else else
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
fi fi

View File

@ -31,7 +31,7 @@ jobs:
## Requirements ## 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 ```bash
git clone https://github.com/ultralytics/yolov5 # clone git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5 cd yolov5

View File

@ -78,8 +78,8 @@ See the [YOLOv5 Docs](https://docs.ultralytics.com/yolov5) for full documentatio
<summary>Install</summary> <summary>Install</summary>
Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a 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 [**Python>=3.8.0**](https://www.python.org/) environment, including
[**PyTorch>=1.7**](https://pytorch.org/get-started/locally/). [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/).
```bash ```bash
git clone https://github.com/ultralytics/yolov5 # clone git clone https://github.com/ultralytics/yolov5 # clone

View File

@ -72,7 +72,7 @@ pip install ultralytics
<details open> <details open>
<summary>安装</summary> <summary>安装</summary>
克隆 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 ```bash
git clone https://github.com/ultralytics/yolov5 # clone git clone https://github.com/ultralytics/yolov5 # clone

View File

@ -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 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(): for m in model.modules():
t = type(m) t = type(m)
if t in (nn.Hardswish, nn.LeakyReLU, nn.ReLU, nn.ReLU6, nn.SiLU, Detect, Model): 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): if t is Detect and not isinstance(m.anchor_grid, list):
delattr(m, 'anchor_grid') delattr(m, 'anchor_grid')
setattr(m, 'anchor_grid', [torch.zeros(1)] * m.nl) setattr(m, 'anchor_grid', [torch.zeros(1)] * m.nl)

View File

@ -12,8 +12,8 @@ PyYAML>=5.3.1
requests>=2.23.0 requests>=2.23.0
scipy>=1.4.1 scipy>=1.4.1
thop>=0.1.1 # FLOPs computation thop>=0.1.1 # FLOPs computation
torch>=1.7.0 # see https://pytorch.org/get-started/locally (recommended) torch>=1.8.0 # see https://pytorch.org/get-started/locally (recommended)
torchvision>=0.8.1 torchvision>=0.9.0
tqdm>=4.64.0 tqdm>=4.64.0
ultralytics>=8.0.147 ultralytics>=8.0.147
# protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012 # protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012