Repository: open-compass/opencompass
Issue: [Bug] --debug mode trying to pickle logger in GenInferencer
Root cause: Validation Gap

### 描述该错误

## Bug Descrption

When using GenInferencer as an inferencer, there is a global variable logger present in each class object. In debug mode, for some unknown reason, dataset_cfg gets updated, causing the previously generated GenInferencer object to be in dataset_cfg['infer_cfg']['model']. This leads to an error when copying this dataset_cfg during the second run.

## Way to Reproduce:

Please checkout my repo:https://github.com/NickLennonLiu/OpenCompass-OpsQA/commit/2e8005cdef8ab8f11d7a9340ea3762ff2bbfb9f3

related files: https://github.com/NickLennonLiu/OpenCompass-OpsQA/blob/2e8005cdef8ab8f11d7a9340ea3762ff2bbfb9f3/configs/datasets/opsqa/opsqa_gen.py

run:
```
python run.py configs/eval_opsqa.py --debug
```

and you will get:

```
Traceback (most recent call last):
  File "/workspace/opencompass/run.py", line 372, in <module>
    main()
  File "/workspace/opencompass/run.py", line 226, in main
    exec_infer_runner(tasks, args, cfg)
  File "/workspace/opencompass/run.py", line 342, in exec_infer_runner
    runner(tasks)
  File "/workspace/opencompass/opencompass/runners/base.py", line 38, in __call__
    status = self.launch(tasks)
  File "/workspace/opencompass/opencompass/runners/local.py", line 57, in launch
    task.run()
  File "/workspace/opencompass/opencompass/tasks/openicl_infer.py", line 66, in run
    self.dataset = build_dataset_from_cfg(self.dataset_cfg)
  File "/workspace/opencompass/opencompass/utils/build.py", line 9, in build_dataset_from_cfg
    dataset_cfg = copy.deepcopy(dataset_cfg)
  File "/opt/conda/envs/opencompass/lib/python3.10/copy.py", line 153, in deepcopy
    y = copier(memo)
  File "/opt/conda/envs/opencompass/lib/python3.10/site-packages/mmengine/config/config.py", line 141, in __deepcopy__
    other[copy.deepcopy(key, memo)] = copy.deepcopy(value, memo)
  File "/opt/conda/envs/opencompass/lib/python3.10/copy.py", line 153, in deepcopy
    y = copier(memo)
  File "/opt/conda/envs/opencompass/lib/python3.10/site-packages/mmengine/config/config.py", line 141, in __deepcopy__
    other[copy.deepcopy(key, memo)] = copy.deepcopy(value, memo)
  File "/opt/conda/envs/opencompass/lib/python3.10/copy.py", line 153, in deepcopy
    y = copier(memo)
  File "/opt/conda/envs/opencompass/lib/python3.10/site-packages/mmengine/config/config.py", line 141, in __deepcopy__
    other[copy.deepcopy(key, memo)] = copy.deepcopy(value, memo)
  File "/opt/conda/envs/opencompass/lib/python3.10/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/opt/conda/envs/opencompass/lib/python3.10/copy.py", line 271, in _reconstruct
    state = deepcopy(state, memo)
  File "/opt/conda/envs/opencompass/lib/python3.10/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/opt/conda/envs/opencompass/lib/python3.10/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/opt/conda/envs/opencompass/lib/python3.10/copy.py", line 161, in deepcopy
    rv = reductor(4)
  File "/opt/conda/envs/opencompass/lib/python3.10/logging/__init__.py", line 1774, in __reduce__
    raise pickle.PicklingError('logger cannot be pickled')
_pickle.PicklingError: logger cannot be pickled
```

### 环境信息

```python
{'CUDA available': True,
 'CUDA_HOME': None,
 'GCC': 'gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0',
 'GPU 0,1,2': 'NVIDIA GeForce RTX 3090',
 'MMEngine': '0.8.4',
 'OpenCV': '4.8.0',
 'PyTorch': '2.0.1',
 'PyTorch compiling details': 'PyTorch built with:\n'
                              '  - GCC 9.3\n'
                              '  - C++ Version: 201703\n'
                              '  - Intel(R) oneAPI Math Kernel Library Version '
                              '2023.1-Product Build 20230303 for Intel(R) 64 '
                              'architecture applications\n'
                              '  - Intel(R) MKL-DNN v2.7.3 (Git Hash '
                              '6dbeffbae1f23cbbeae17adb7b5b13f1f37c080e)\n'
                              '  - OpenMP 201511 (a.k.a. OpenMP 4.5)\n'
                              '  - LAPACK is enabled (usually provided by '
                              'MKL)\n'
                              '  - NNPACK is enabled\n'
                              '  - CPU capability usage: AVX2\n'
                              '  - CUDA Runtime 11.8\n'
                              '  - NVCC architecture flags: '
                              '-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_90,code=sm_90;-gencode;arch=compute_37,code=compute_37\n'
                              '  - CuDNN 8.7\n'
                              '  - Magma 2.6.1\n'
                              '  - Build settings: BLAS_INFO=mkl, '
                              'BUILD_TYPE=Release, CUDA_VERSION=11.8, '
                              'CUDNN_VERSION=8.7.0, '
                              'CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, '
                              'CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 '
                              '-fabi-version=11 -Wno-deprecated '
                              '-fvisibility-inlines-hidden -DUSE_PTHREADPOOL '
                              '-DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER '
                              '-DUSE_FBGEMM -DUSE_QNNPACK '
                              '-DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK '
                              '-DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC '
                              '-Wall -Wextra -Werror=return-type '
                              '-Werror=non-virtual-dtor -Werror=bool-operation '
                              '-Wnarrowing -Wno-missing-field-initializers '
                              '-Wno-type-limits -Wno-array-bounds '
                              '-Wno-unknown-pragmas -Wunused-local-typedefs '
                              '-Wno-unused-parameter -Wno-unused-function '
                              '-Wno-unused-result -Wno-strict-overflow '
                              '-Wno-strict-aliasing '
                              '-Wno-error=deprecated-declarations '
                              '-Wno-stringop-overflow -Wno-psabi '
                              '-Wno-error=pedantic -Wno-error=redundant-decls '
                              '-Wno-error=old-style-cast '
                              '-fdiagnostics-color=always -faligned-new '
                              '-Wno-unused-but-set-variable '
                              '-Wno-maybe-uninitialized -fno-math-errno '
                              '-fno-trapping-math -Werror=format '
                              '-Werror=cast-function-type '
                              '-Wno-stringop-overflow, LAPACK_INFO=mkl, '
                              'PERF_WITH_AVX=1, PERF_WITH_AVX2=1, '
                              'PERF_WITH_AVX512=1, '
                              'TORCH_DISABLE_GPU_ASSERTS=ON, '
                              'TORCH_VERSION=2.0.1, USE_CUDA=ON, USE_CUDNN=ON, '
                              'USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, '
                              'USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, '
                              'USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, '
                              'USE_OPENMP=ON, USE_ROCM=OFF, \n',
 'Python': '3.10.12 (main, Jul  5 2023, 18:54:27) [GCC 11.2.0]',
 'TorchVision': '0.15.2',
 'numpy_random_seed': 2147483648,
 'opencompass': '0.1.0+2e8005c',
 'sys.platform': 'linux'}
```

### 其他信息

checkout the bug descrption above

Thanks for your insightful comment! This bug will be fixed in #174. You're welcome to contribute this dataset to OpenCompass so that the community can benefit from such a skill test. 😊