open-mmlab / mmengine

OpenMMLab Foundational Library for Training Deep Learning Models
https://mmengine.readthedocs.io/
Apache License 2.0
1.18k stars 360 forks source link

[Bug] test suite fails with `...AttributeError: '<SOME_CLASS>' object has no attribute 'runTest'` #1575

Open GaetanLepage opened 2 months ago

GaetanLepage commented 2 months ago

Prerequisite

Environment

OrderedDict([('sys.platform', 'linux'),
             ('Python', '3.12.5 (main, Aug  6 2024, 19:08:49) [GCC 13.3.0]'),
             ('CUDA available', False),
             ('MUSA available', False),
             ('numpy_random_seed', 2147483648),
             ('GCC', 'gcc (GCC) 13.3.0'),
             ('PyTorch', '2.4.0'),
             ('PyTorch compiling details',
              'PyTorch built with:\n'
              '  - GCC 13.3\n'
              '  - C++ Version: 201703\n'
              '  - Intel(R) MKL-DNN v3.4.2 (Git Hash N/A)\n'
              '  - OpenMP 201511 (a.k.a. OpenMP 4.5)\n'
              '  - LAPACK is enabled (usually provided by MKL)\n'
              '  - CPU capability usage: AVX2\n'
              '  - Build settings: BLAS_INFO=open, BUILD_TYPE=Release, '
              'CXX_COMPILER=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gcc-wrapper-13.3.0/bin/g++, '
              'CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=1 '
              '-fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG '
              '-DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER '
              '-DUSE_FBGEMM -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK '
              '-DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra '
              '-Werror=return-type -Werror=non-virtual-dtor '
              '-Werror=range-loop-construct -Werror=bool-operation -Wnarrowing '
              '-Wno-missing-field-initializers -Wno-type-limits '
              '-Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter '
              '-Wno-unused-function -Wno-unused-result -Wno-strict-overflow '
              '-Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override '
              '-Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast '
              '-Wno-missing-braces -fdiagnostics-color=always -faligned-new '
              '-Wno-unused-but-set-variable -Wno-maybe-uninitialized '
              '-fno-math-errno -fno-trapping-math -Werror=format '
              '-Wno-stringop-overflow, LAPACK_INFO=open, PERF_WITH_AVX=1, '
              'PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=2.4.0, '
              'USE_CUDA=OFF, USE_CUDNN=OFF, USE_CUSPARSELT=OFF, '
              'USE_EIGEN_FOR_BLAS=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, '
              'USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=OFF, USE_MKLDNN=1, '
              'USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=0, USE_OPENMP=ON, '
              'USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF, \n'),
             ('OpenCV', '4.9.0'),
             ('MMEngine', '0.10.5')])

Reproduces the problem - code sample

Not relevant.

Reproduces the problem - command or script

pytest

Reproduces the problem - error message

=========================== short test summary info ============================
ERROR tests/test_hooks/test_sync_buffers_hook.py::MultiProcessTestCase - AttributeError: 'MultiProcessTestCase' object has no attribute 'runTest'. D...
ERROR tests/test_hooks/test_sync_buffers_hook.py::TestSyncBuffersHook - AttributeError: 'TestSyncBuffersHook' object has no attribute 'runTest'. Di...
ERROR tests/test_model/test_wrappers/test_model_wrapper.py::MultiProcessTestCase - AttributeError: 'MultiProcessTestCase' object has no attribute 'runTest'. D...
ERROR tests/test_model/test_wrappers/test_model_wrapper.py::TestDistributedDataParallel - AttributeError: 'TestDistributedDataParallel' object has no attribute 'runT...
ERROR tests/test_model/test_wrappers/test_model_wrapper.py::TestMMSeparateDistributedDataParallel - AttributeError: 'TestMMSeparateDistributedDataParallel' object has no attri...
ERROR tests/test_model/test_wrappers/test_model_wrapper.py::TestMMFullyShardedDataParallel - AttributeError: 'TestMMFullyShardedDataParallel' object has no attribute 'r...
ERROR tests/test_optim/test_optimizer/test_optimizer.py::MultiProcessTestCase - AttributeError: 'MultiProcessTestCase' object has no attribute 'runTest'. D...
ERROR tests/test_optim/test_optimizer/test_optimizer.py::TestZeroOptimizer - AttributeError: 'TestZeroOptimizer' object has no attribute 'runTest'. Did ...
ERROR tests/test_optim/test_optimizer/test_optimizer_wrapper.py::MultiProcessTestCase - AttributeError: 'MultiProcessTestCase' object has no attribute 'runTest'. D...
ERROR tests/test_optim/test_optimizer/test_optimizer_wrapper.py::TestOptimWrapper - AttributeError: 'TestOptimWrapper' object has no attribute 'runTest'. Did y...
!!!!!!!!!!!!!!!!!!! Interrupted: 10 errors during collection !!!!!!!!!!!!!!!!!!!
================ 64 deselected, 18 warnings, 10 errors in 5.03s ================

Additional information

Context: Fixing mmengine in the nixpkgs repository: https://github.com/NixOS/nixpkgs/pull/343207

Could this be caused by a missing test dependency ?

Thank you very much in advance for your help !

tibor-reiss commented 1 month ago

@GaetanLepage Let me know if the proposed PR fixes your problem.

GaetanLepage commented 1 month ago

I should be able to test that soon. However, we have some new test failures (maybe caused by our recent update of pytorch to 2.5.0). 35 tests are failing with:

KeyError: 'ASGD is already registered in optimizer at torch.optim.asgd
tibor-reiss commented 1 month ago

Hi @GaetanLepage, thanks for coming back. I would recommend opening an other issue for the new failures, or use #1573. It certainly makes sense to upgrade to newer pytorch, but I would try to keep the issues separate, and thus the fixes separate and small.

If you could point me in the way of the new failures I can have a look there as well when trying to upgrade pytorch...

GaetanLepage commented 1 month ago

Sure, I opened an issue with additional details: https://github.com/open-mmlab/mmengine/issues/1593