mmpretrain icon indicating copy to clipboard operation
mmpretrain copied to clipboard

[Bug] KeyError: 'RANK' appears when using 'fusion_matrix. py'

Open xiaoerjason opened this issue 1 year ago • 1 comments

Branch

main branch (mmpretrain version)

Describe the bug

KeyError: 'RANK' appears when using 'fusion_matrix. py' When I used the Confusion matrix to evaluate custom models and data sets, I found a bug. This problem will lead to a KeyError: 'RANK' when using a custom configuration file to evaluate the Confusion matrix. The simple way to solve this bug is to annotate the launcher='pytorch' in the configuration file, or change it to launcher='none'.

Environment

System environment: sys.platform: linux Python: 3.8.17 | packaged by conda-forge | (default, Jun 16 2023, 07:06:00) [GCC 11.4.0] CUDA available: True numpy_random_seed: 647731525 GPU 0,1,2,3,4,5,6,7: NVIDIA RTX A6000 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 11.3, V11.3.109 GCC: gcc (Ubuntu 9.5.0-1ubuntu1~22.04) 9.5.0 PyTorch: 1.10.1 PyTorch compiling details: PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v2.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • LAPACK is enabled (usually provided by MKL)
  • NNPACK is enabled
  • CPU capability usage: AVX512
  • CUDA Runtime 11.3

Other information

No response

xiaoerjason avatar Jul 29 '23 07:07 xiaoerjason

Traceback (most recent call last): File "tools/analysis_tools/confusion_matrix.py", line 108, in main() File "tools/analysis_tools/confusion_matrix.py", line 74, in main runner = Runner.from_cfg(cfg) File "/home/user/.conda/envs/lcy_mmpre/lib/python3.8/site-packages/mmengine/runner/runner.py", line 443, in from_cfg runner = cls( File "/home/user/.conda/envs/lcy_mmpre/lib/python3.8/site-packages/mmengine/runner/runner.py", line 353, in init self.setup_env(env_cfg) File "/home/user/.conda/envs/lcy_mmpre/lib/python3.8/site-packages/mmengine/runner/runner.py", line 656, in setup_env init_dist(self.launcher, **dist_cfg) File "/home/user/.conda/envs/lcy_mmpre/lib/python3.8/site-packages/mmengine/dist/utils.py", line 84, in init_dist _init_dist_pytorch(backend, init_backend=init_backend, **kwargs) File "/home/user/.conda/envs/lcy_mmpre/lib/python3.8/site-packages/mmengine/dist/utils.py", line 101, in _init_dist_pytorch rank = int(os.environ['RANK']) File "/home/user/.conda/envs/lcy_mmpre/lib/python3.8/os.py", line 675, in getitem raise KeyError(key) from None KeyError: 'RANK'

xiaoerjason avatar Jul 29 '23 07:07 xiaoerjason