Skip to content

Commit

Permalink
Update train.py to compat with new config (open-mmlab#11025)
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaAndroid authored and yumion committed Jan 31, 2024
1 parent 7e664bf commit 62bb4d6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
12 changes: 9 additions & 3 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,27 @@ jobs:
type: string
cuda:
type: enum
enum: ["11.1", "11.7"]
enum: ["11.1", "11.7", "11.8"]
cudnn:
type: integer
default: 8
machine:
image: ubuntu-2004-cuda-11.4:202110-01
image: linux-cuda-11:default
# docker_layer_caching: true
resource_class: gpu.nvidia.small
resource_class: gpu.nvidia.small.multi
steps:
- checkout
- run:
# CLoning repos in VM since Docker doesn't have access to the private key
name: Clone Repos
command: |
git clone -b main --depth 1 ssh://git@github.com/open-mmlab/mmengine.git /home/circleci/mmengine
- run:
name: Install nvidia-container-toolkit and Restart Docker
command: |
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
- run:
name: Build Docker image
command: |
Expand Down
2 changes: 1 addition & 1 deletion mmdet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .version import __version__, version_info

mmcv_minimum_version = '2.0.0rc4'
mmcv_maximum_version = '2.1.0'
mmcv_maximum_version = '3.0.0'
mmcv_version = digit_version(mmcv.__version__)

mmengine_minimum_version = '0.7.1'
Expand Down
2 changes: 1 addition & 1 deletion requirements/mminstall.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mmcv>=2.0.0rc4,<2.1.0
mmcv>=2.0.0rc4,<3.0.0
mmengine>=0.7.1,<1.0.0
16 changes: 2 additions & 14 deletions tools/train.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import logging
import os
import os.path as osp

from mmengine.config import Config, DictAction
from mmengine.logging import print_log
from mmengine.registry import RUNNERS
from mmengine.runner import Runner

Expand Down Expand Up @@ -83,18 +81,8 @@ def main():

# enable automatic-mixed-precision training
if args.amp is True:
optim_wrapper = cfg.optim_wrapper.type
if optim_wrapper == 'AmpOptimWrapper':
print_log(
'AMP training is already enabled in your config.',
logger='current',
level=logging.WARNING)
else:
assert optim_wrapper == 'OptimWrapper', (
'`--amp` is only supported when the optimizer wrapper type is '
f'`OptimWrapper` but got {optim_wrapper}.')
cfg.optim_wrapper.type = 'AmpOptimWrapper'
cfg.optim_wrapper.loss_scale = 'dynamic'
cfg.optim_wrapper.type = 'AmpOptimWrapper'
cfg.optim_wrapper.loss_scale = 'dynamic'

# enable automatically scaling LR
if args.auto_scale_lr:
Expand Down

0 comments on commit 62bb4d6

Please sign in to comment.