Repository: open-compass/opencompass
Issue: [Bug] python run.py --models hf_llama_7b --datasets agieval_mixed error
Root cause: Documentation Deficiency

### 先决条件

- [X] 我已经搜索过 [问题](https://github.com/open-compass/opencompass/issues/) 和 [讨论](https://github.com/open-compass/opencompass/discussions) 但未得到预期的帮助。
- [X] 错误在 [最新版本](https://github.com/open-compass/opencompass) 中尚未被修复。

### 问题类型

我正在使用官方支持的任务/模型/数据集进行评估。

### 环境

{'CUDA available': True,
 'CUDA_HOME': '/usr/local/cuda',
 'GCC': 'gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0',
 'GPU 0,1,2,3,4,5,6,7': 'NVIDIA A800-SXM4-80GB',
 'MMEngine': '0.9.0',
 'NVCC': 'Cuda compilation tools, release 11.7, V11.7.64',
 'OpenCV': '4.8.1',
 'PyTorch': '1.13.1+cu117',
 'PyTorch compiling details': 'PyTorch built with:\n'
                              '  - GCC 9.3\n'
                              '  - C++ Version: 201402\n'
                              '  - Intel(R) Math Kernel Library Version '
                              '2020.0.0 Product Build 20191122 for Intel(R) 64 '
                              'architecture applications\n'
                              '  - Intel(R) MKL-DNN v2.6.0 (Git Hash '
                              '52b5f107dd9cf10910aaa19cb47f3abf9b349815)\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.7\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_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\n'
                              '  - CuDNN 8.5\n'
                              '  - Magma 2.6.1\n'
                              '  - Build settings: BLAS_INFO=mkl, '
                              'BUILD_TYPE=Release, CUDA_VERSION=11.7, '
                              'CUDNN_VERSION=8.5.0, '
                              'CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, '
                              'CXX_FLAGS= -fabi-version=11 -Wno-deprecated '
                              '-fvisibility-inlines-hidden -DUSE_PTHREADPOOL '
                              '-fopenmp -DNDEBUG -DUSE_KINETO -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 -Werror=non-virtual-dtor '
                              '-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_VERSION=1.13.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.9 (main, Mar  1 2023, 18:23:06) [GCC 11.2.0]',
 'TorchVision': '0.14.1+cu117',
 'numpy_random_seed': 2147483648,
 'opencompass': '0.1.7+6a398d1',
 'sys.platform': 'linux'}


### 重现问题 - 代码/配置示例

first： update opencompass/configs/models/hf_llama/hf_llama2_7b.py like this:
```python
from opencompass.models import HuggingFaceCausalLM


models = [
    dict(
        type=HuggingFaceCausalLM,
        abbr='llama-2-7b-hf',
        **path**="/data/llm_mnt2/weights/LLaMa-2/Llama-2-7B-hf",  (this is my local model file)
        **tokenizer_path**='/data/llm_mnt2/weights/LLaMa-2/Llama-2-7B-hf', (this is my local model file)
        tokenizer_kwargs=dict(padding_side='left',
                              truncation_side='left',
                              use_fast=False,
                              ),
        max_out_len=100,
        max_seq_len=4096,
        batch_size=8,
        model_kwargs=dict(device_map='auto'),
        batch_padding=False, # if false, inference with for-loop without batch padding
        run_cfg=dict(num_gpus=1, num_procs=1),
    )
]

```
execute code:
```bash
python run.py --models hf_llama_7b --datasets agieval_mixed
```
### 重现问题 - 命令或脚本

first： update opencompass/configs/models/hf_llama/hf_llama2_7b.py like this:
```python
from opencompass.models import HuggingFaceCausalLM


models = [
    dict(
        type=HuggingFaceCausalLM,
        abbr='llama-2-7b-hf',
        **path**="/data/llm_mnt2/weights/LLaMa-2/Llama-2-7B-hf",  (this is my local model file)
        **tokenizer_path**='/data/llm_mnt2/weights/LLaMa-2/Llama-2-7B-hf', (this is my local model file)
        tokenizer_kwargs=dict(padding_side='left',
                              truncation_side='left',
                              use_fast=False,
                              ),
        max_out_len=100,
        max_seq_len=4096,
        batch_size=8,
        model_kwargs=dict(device_map='auto'),
        batch_padding=False, # if false, inference with for-loop without batch padding
        run_cfg=dict(num_gpus=1, num_procs=1),
    )
]
```

execute code:
```bash
python run.py --models hf_llama_7b --datasets agieval_mixed
```

### 重现问题 - 错误信息

```
[2023-11-13 06:57:53,110] [INFO] [real_accelerator.py:133:get_accelerator] Setting ds_accelerator to cuda (auto detect)
11/13 06:57:55 - OpenCompass - INFO - Task [llama-7b-hf/agieval-jec-qa-kd_3]
Traceback (most recent call last):
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/transformers/utils/hub.py", line 417, in cached_file
    resolved_file = hf_hub_download(
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1291, in hf_hub_download
    raise LocalEntryNotFoundError(
huggingface_hub.utils._errors.LocalEntryNotFoundError: Connection error, and we cannot find the requested files in the disk cache. Please try again or make sure your Internet connection is on.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dengkaibiao/opencompass/opencompass/tasks/openicl_infer.py", line 148, in <module>
    inferencer.run()
  File "/home/dengkaibiao/opencompass/opencompass/tasks/openicl_infer.py", line 62, in run
    self.model = build_model_from_cfg(model_cfg)
  File "/home/dengkaibiao/opencompass/opencompass/utils/build.py", line 23, in build_model_from_cfg
    return MODELS.build(model_cfg)
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/mmengine/registry/registry.py", line 570, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg
    obj = obj_cls(**args)  # type: ignore
  File "/home/dengkaibiao/opencompass/opencompass/models/huggingface.py", line 82, in __init__
    self._load_tokenizer(path=path,
  File "/home/dengkaibiao/opencompass/opencompass/models/huggingface.py", line 95, in _load_tokenizer
    self.tokenizer = AutoTokenizer.from_pretrained(
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py", line 667, in from_pretrained
    config = AutoConfig.from_pretrained(
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 983, in from_pretrained
config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/transformers/configuration_utils.py", line 617, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/transformers/configuration_utils.py", line 672, in _get_config_dict
    resolved_config_file = cached_file(
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/transformers/utils/hub.py", line 452, in cached_file
    raise EnvironmentError(
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like huggyllama/llama-7b is not the path to a directory containing a file named config.json.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 3277658) of binary: /home/dengkaibiao/anaconda3/bin/python
Traceback (most recent call last):
  File "/home/dengkaibiao/anaconda3/bin/torchrun", line 8, in <module>
    sys.exit(main())
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper
    return f(*args, **kwargs)
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/torch/distributed/run.py", line 762, in main
    run(args)
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/torch/distributed/run.py", line 753, in run
    elastic_launch(
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "/home/dengkaibiao/anaconda3/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 246, in launch_agent
    raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
============================================================
/home/dengkaibiao/opencompass/opencompass/tasks/openicl_infer.py FAILED
------------------------------------------------------------
Failures:
  <NO_OTHER_FAILURES>
------------------------------------------------------------
Root Cause (first observed failure):
[0]:
  time      : 2023-11-13_06:58:16
  host      : pcadmin
  rank      : 0 (local_rank: 0)
  exitcode  : 1 (pid: 3277658)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
============================================================
```

### 其他信息

_No response_

Instead of using 

```bash
python run.py --models hf_llama_7b --datasets agieval_mixed
```

, maybe you need to run with the modified config :-)

```bash
python run.py --models hf_llama2_7b --datasets agieval_mixed
```



> Instead of using
> 
> ```shell
> python run.py --models hf_llama_7b --datasets agieval_mixed
> ```
> 
> , maybe you need to run with the modified config :-)
> 
> ```shell
> python run.py --models hf_llama2_7b --datasets agieval_mixed
> ```

Thank you very much! Use python run.py --models hf_llama2_7b --datasets agieval_mixed run success! My carelessness.