Description
Prerequisite
- I have searched Issues and Discussions but cannot get the expected help.
- The bug has not been fixed in the latest version(https://github.com/open-mmlab/mmengine).
Environment
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
OrderedDict([('sys.platform', 'darwin'), ('Python', '3.8.15 (default, Nov 10 2022, 13:17:42) [Clang 14.0.6 ]'), ('CUDA available', False), ('numpy_random_seed', 2147483648), ('GCC', 'Apple clang version 11.0.0 (clang-1100.0.33.8)'), ('PyTorch', '1.10.1'), ('PyTorch compiling details', 'PyTorch built with:\n - GCC 4.2\n - C++ Version: 201402\n - clang 12.0.0\n - Intel(R) Math Kernel Library Version 2020.0.1 Product Build 20200208 for Intel(R) 64 architecture applications\n - Intel(R) MKL-DNN v2.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)\n - LAPACK is enabled (usually provided by MKL)\n - NNPACK is enabled\n - CPU capability usage: AVX2\n - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CXX_COMPILER=/Applications/Xcode-12.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-invalid-partial-specialization -Wno-typedef-redefinition -Wno-unknown-warning-option -Wno-unused-private-field -Wno-inconsistent-missing-override -Wno-aligned-allocation-unavailable -Wno-c++14-extensions -Wno-constexpr-not-const -Wno-missing-braces -Qunused-arguments -fcolor-diagnostics -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-unused-private-field -Wno-missing-braces -Wno-c++14-extensions -Wno-constexpr-not-const, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.10.1, USE_CUDA=OFF, USE_CUDNN=OFF, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=ON, USE_OPENMP=OFF, \n'), ('TorchVision', '0.11.2'), ('OpenCV', '4.6.0'), ('MMEngine', '0.3.1')])
Reproduces the problem - code sample
test_config.py
mmyolo_configs = './mmyolo/configs'
_base_ = f'{mmyolo_configs}/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py'
test.py
from mmengine.config import Config
if __name__ == '__main__':
cfg = Config.fromfile('./test_config.py')
print(cfg)
Reproduces the problem - command or script
python test.py
Reproduces the problem - error message
Traceback (most recent call last):
File "/Users/wangnu/Documents/GitHub/my_det_engine.mmyolo/test.py", line 5, in
cfg = Config.fromfile('./test_config.py')
File "/Users/wangnu/opt/anaconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/config/config.py", line 172, in fromfile
cfg_dict, cfg_text = Config._file2dict(filename,
File "/Users/wangnu/opt/anaconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/config/config.py", line 401, in _file2dict
for base_cfg_path in Config._get_base_files(temp_config_file.name):
File "/Users/wangnu/opt/anaconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/config/config.py", line 568, in _get_base_files
base_files = eval(compile(base_code, '', mode='eval'))
File "", line 2, in
NameError: name 'mmyolo_configs' is not defined
Exception ignored in: <function _TemporaryFileCloser.del at 0x7fcec570d1f0>
Traceback (most recent call last):
File "/Users/wangnu/opt/anaconda3/envs/mmyolo/lib/python3.8/tempfile.py", line 440, in del
self.close()
File "/Users/wangnu/opt/anaconda3/envs/mmyolo/lib/python3.8/tempfile.py", line 436, in close
unlink(self.name)
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/hv/l3bmh8zd42b9qdr4tmjr6bdw0000gn/T/tmphwtml0mh/tmpn0pg4mv6.py'
Additional information
openmmlab 1.0 mmcv.config.Config.fromfile() is work, so i think there is something wrong in the added code
but i can't solve it
mmengine/mmengine/config/config.py
Lines 398 to 409 in 9b4dbb3