You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KeyError: 'ASGD is already registered in optimizer at torch.optim.asgd'
Additional information
Expected result: Tests run successfully
Dataset: not applicable
Supposed reason: New version of pytorch (2.5.0)
All the tests fail in the same way:
________ ERROR collecting tests/test_hooks/test_early_stopping_hook.py _________
tests/test_hooks/test_early_stopping_hook.py:13: in <module>
from mmengine.hooks import EarlyStoppingHook
mmengine/hooks/__init__.py:4: in <module>
from .ema_hook import EMAHook
mmengine/hooks/ema_hook.py:8: in <module>
from mmengine.model import is_model_wrapper
mmengine/model/__init__.py:6: in <module>
from .base_model import BaseDataPreprocessor, BaseModel, ImgDataPreprocessor
mmengine/model/base_model/__init__.py:2: in <module>
from .base_model import BaseModel
mmengine/model/base_model/base_model.py:9: in <module>
from mmengine.optim import OptimWrapper
mmengine/optim/__init__.py:2: in <module>
from .optimizer import (OPTIM_WRAPPER_CONSTRUCTORS, OPTIMIZERS,
mmengine/optim/optimizer/__init__.py:5: in <module>
from .builder import (OPTIM_WRAPPER_CONSTRUCTORS, OPTIMIZERS,
mmengine/optim/optimizer/builder.py:33: in <module>
TORCH_OPTIMIZERS = register_torch_optimizers()
mmengine/optim/optimizer/builder.py:28: in register_torch_optimizers
OPTIMIZERS.register_module(module=_optim)
mmengine/registry/registry.py:661: in register_module
self._register_module(module=module, module_name=name, force=force)
mmengine/registry/registry.py:611: in _register_module
raise KeyError(f'{name} is already registered in {self.name} '
E KeyError: 'ASGD is already registered in optimizer at torch.optim.asgd'
The text was updated successfully, but these errors were encountered:
I was not able to reproduce the error - so far I only see the issue with Adafactor which was added to torch in 2.5. Could you please provide some details about your environment? e.g. pip list (or conda equivalent).
This error comes out of the nixpkgs package for mmengine. I verified that this is caused by the upgrade to pytorch 2.5, and that 4c22f78 fixes the issue.
Prerequisite
Environment
Reproduces the problem - code sample
Not applicable.
Reproduces the problem - command or script
Reproduces the problem - error message
Additional information
All the tests fail in the same way:
The text was updated successfully, but these errors were encountered: