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

Feature: update to torch 2.5.0 #1595

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG PYTORCH="1.8.1"
ARG CUDA="10.2"
ARG CUDNN="7"
ARG PYTORCH="2.5.0"
ARG CUDA="12.4"
ARG CUDNN="9"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel

Expand Down
16 changes: 8 additions & 8 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
pip install wheel
- run:
name: Install PyTorch
command: pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
command: pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch -f https://download.pytorch.org/whl/torchvision
- run:
name: Build MMEngine from source
command: pip install -e . -v
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
type: string
cuda:
type: enum
enum: ["10.1", "10.2", "11.1", "11.7", "11.8"]
enum: ["10.1", "10.2", "11.1", "11.7", "11.8", "12.1", "12.4"]
cudnn:
type: integer
default: 7
Expand Down Expand Up @@ -267,9 +267,9 @@ workflows:
- lint
- build_cpu:
name: maximum_version_cpu
torch: 2.1.0
torchvision: 0.16.0
python: 3.9.0
torch: 2.5.0
torchvision: 0.20.0
python: 3.11.9
requires:
- minimum_version_cpu
- hold_integration_test:
Expand All @@ -296,9 +296,9 @@ workflows:
- hold
- build_cuda:
name: maximum_version_gpu
torch: 2.1.0
cuda: "11.8"
cudnn: 8
torch: 2.5.0
cuda: "12.4"
cudnn: 9
requires:
- hold
merge_stage_test:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ venv.bak/
.vscode
.idea
.DS_Store
.aim
.dvc
.dvcignore

# custom
*.pkl
Expand Down
6 changes: 3 additions & 3 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG PYTORCH="1.8.1"
ARG CUDA="10.2"
ARG CUDNN="7"
ARG PYTORCH="2.5.0"
ARG CUDA="12.4"
ARG CUDNN="9"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel

Expand Down
6 changes: 3 additions & 3 deletions docker/release/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG PYTORCH="1.8.1"
ARG CUDA="10.2"
ARG CUDNN="7"
ARG PYTORCH="2.5.0"
ARG CUDA="12.4"
ARG CUDNN="9"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel

Expand Down
12 changes: 3 additions & 9 deletions mmengine/optim/optimizer/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,9 @@ def register_bitsandbytes_optimizers() -> List[str]:


def register_transformers_optimizers():
transformer_optimizers = []
try:
from transformers import Adafactor
except ImportError:
pass
else:
OPTIMIZERS.register_module(name='Adafactor', module=Adafactor)
transformer_optimizers.append('Adafactor')
return transformer_optimizers
return [
'Adafactor',
]


TRANSFORMERS_OPTIMIZERS = register_transformers_optimizers()
Expand Down
24 changes: 16 additions & 8 deletions mmengine/testing/_internal/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,15 @@ def wrapper(self):
# or run the underlying test function.
def __init__(self, method_name: str = 'runTest') -> None:
super().__init__(method_name)
fn = getattr(self, method_name)
setattr(self, method_name, self.join_or_run(fn))
try:
fn = getattr(self, method_name)
setattr(self, method_name, self.join_or_run(fn))
except AttributeError as e:
if method_name != 'runTest':
# we allow instantiation with no explicit method name
# but not an *incorrect* or missing method name
raise ValueError(f'no such test method in {self.__class__}:'
f' {method_name}') from e

def setUp(self) -> None:
super().setUp()
Expand Down Expand Up @@ -345,12 +352,13 @@ def _check_return_codes(self, elapsed_time) -> None:
if first_process.exitcode == skip.exit_code:
raise unittest.SkipTest(skip.message)

# Skip the unittest since the raised error maybe not caused by
# the tested function. For example, in CI environment, the tested
# method could be terminated by system signal for the limited
# resources.
self.skipTest(f'Skip test {self._testMethodName} due to '
'the program abort')
if first_process.exitcode != 0:
# Skip the unittest since the raised error maybe not caused by
# the tested function. For example, in CI environment, the tested
# method could be terminated by system signal for the limited
# resources.
self.skipTest(f'Skip test {self._testMethodName} due to '
'the program abort')

@property
def is_master(self) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aim<=3.17.5;sys_platform!='win32'
aim;sys_platform!='win32'
bitsandbytes
clearml
coverage
Expand Down