Repository: open-compass/opencompass
Issue: [Bug] We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like Qwen/Qwen2-1.5B-Instruct is not the path to a directory containing a file named config.json.
Root cause: Environment Incompatibility

### 先决条件

- [X] 我已经搜索过 [问题](https://github.com/open-compass/opencompass/issues/) 和 [讨论](https://github.com/open-compass/opencompass/discussions) 但未得到预期的帮助。
- [X] 错误在 [最新版本](https://github.com/open-compass/opencompass) 中尚未被修复。

### 问题类型

我正在使用官方支持的任务/模型/数据集进行评估。

### 环境

```python
{'CUDA available': True,
 'CUDA_HOME': None,
 'GCC': 'gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0',
 'GPU 0': 'NVIDIA GeForce MX450',
 'MMEngine': '0.10.4',
 'MUSA available': False,
 'OpenCV': '4.10.0',
 'PyTorch': '2.4.1+cu121',
 'PyTorch compiling details': 'PyTorch built with:\n'
                              '  - GCC 9.3\n'
                              '  - C++ Version: 201703\n'
                              '  - Intel(R) oneAPI Math Kernel Library Version '
                              '2022.2-Product Build 20220804 for Intel(R) 64 '
                              'architecture applications\n'
                              '  - Intel(R) MKL-DNN v3.4.2 (Git Hash '
                              '1137e04ec0b5251ca2b4400a4fd3c667ce843d67)\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: AVX512\n'
                              '  - CUDA Runtime 12.1\n'
                              '  - NVCC architecture flags: '
                              '-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;-gencode;arch=compute_90,code=sm_90\n'
                              '  - CuDNN 90.1  (built against CUDA 12.4)\n'
                              '  - Magma 2.6.1\n'
                              '  - Build settings: BLAS_INFO=mkl, '
                              'BUILD_TYPE=Release, CUDA_VERSION=12.1, '
                              'CUDNN_VERSION=9.1.0, '
                              'CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, '
                              'CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 '
                              '-fabi-version=11 -fvisibility-inlines-hidden '
                              '-DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO '
                              '-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=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=mkl, '
                              'PERF_WITH_AVX=1, PERF_WITH_AVX2=1, '
                              'PERF_WITH_AVX512=1, TORCH_VERSION=2.4.1, '
                              'USE_CUDA=ON, USE_CUDNN=ON, USE_CUSPARSELT=1, '
                              'USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, '
                              'USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=ON, '
                              'USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, '
                              'USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, '
                              'USE_ROCM_KERNEL_ASSERT=OFF, \n',
 'Python': '3.10.14 (main, May  6 2024, 19:42:50) [GCC 11.2.0]',
 'TorchVision': '0.19.1+cu121',
 'lmdeploy': "not installed:No module named 'lmdeploy'",
 'numpy_random_seed': 2147483648,
 'opencompass': '0.3.2.post1+b5f8afb',
 'sys.platform': 'linux',
 'transformers': '4.44.2'}
```

### 重现问题 - 代码/配置示例

```python
from mmengine.config import read_base

with read_base():
    from opencompass.configs.datasets.demo.demo_gsm8k_chat_gen import gsm8k_datasets
    from opencompass.configs.datasets.demo.demo_math_chat_gen import math_datasets
    from opencompass.configs.models.qwen.hf_qwen2_1_5b_instruct import models as hf_qwen2_1_5b_instruct_models
    from opencompass.configs.models.hf_internlm.hf_internlm2_chat_1_8b import models as hf_internlm2_chat_1_8b_models

datasets = gsm8k_datasets + math_datasets
models = hf_qwen2_1_5b_instruct_models + hf_internlm2_chat_1_8b_models

```

### 重现问题 - 命令或脚本

```shell
opencompass ./configs/eval_chat_demo.py
```

### 重现问题 - 错误信息

```
09/09 15:58:55 - OpenCompass - INFO - Current exp folder: outputs/default/20240909_155855
09/09 15:58:55 - OpenCompass - WARNING - SlurmRunner is not used, so the partition argument is ignored.
09/09 15:58:55 - OpenCompass - INFO - Partitioned into 2 tasks.
launch OpenICLInfer[qwen2-1.5b-instruct-hf/demo_gsm8k,qwen2-1.5b-instruct-hf/demo_math] on GPU 0
  0%|                                                                                                                                                        | 0/2 [00:00<?, ?it/s]09/09 15:59:11 - OpenCompass - ERROR - /home/dream/opencompass/opencompass/runners/local.py - _launch - 228 - task OpenICLInfer[qwen2-1.5b-instruct-hf/demo_gsm8k,qwen2-1.5b-instruct-hf/demo_math] fail, see
outputs/default/20240909_155855/logs/infer/qwen2-1.5b-instruct-hf/demo_gsm8k.out
launch OpenICLInfer[internlm2-chat-1.8b-hf/demo_gsm8k,internlm2-chat-1.8b-hf/demo_math] on GPU 0
 50%|████████████████████████████████████████████████████████████████████████                                                                        | 1/2 [00:16<00:16, 16.05s/it]09/09 15:59:26 - OpenCompass - ERROR - /home/dream/opencompass/opencompass/runners/local.py - _launch - 228 - task OpenICLInfer[internlm2-chat-1.8b-hf/demo_gsm8k,internlm2-chat-1.8b-hf/demo_math] fail, see
outputs/default/20240909_155855/logs/infer/internlm2-chat-1.8b-hf/demo_gsm8k.out
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:31<00:00, 15.58s/it]
09/09 15:59:26 - OpenCompass - ERROR - /home/dream/opencompass/opencompass/runners/base.py - summarize - 64 - OpenICLInfer[qwen2-1.5b-instruct-hf/demo_gsm8k,qwen2-1.5b-instruct-hf/demo_math] failed with code 1
09/09 15:59:26 - OpenCompass - ERROR - /home/dream/opencompass/opencompass/runners/base.py - summarize - 64 - OpenICLInfer[internlm2-chat-1.8b-hf/demo_gsm8k,internlm2-chat-1.8b-hf/demo_math] failed with code 1
09/09 15:59:26 - OpenCompass - INFO - Partitioned into 4 tasks.
launch OpenICLEval[qwen2-1.5b-instruct-hf/demo_gsm8k] on CPU
launch OpenICLEval[qwen2-1.5b-instruct-hf/demo_math] on CPU
launch OpenICLEval[internlm2-chat-1.8b-hf/demo_gsm8k] on CPU
launch OpenICLEval[internlm2-chat-1.8b-hf/demo_math] on CPU
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:25<00:00,  6.37s/it]
dataset     version    metric    mode    qwen2-1.5b-instruct-hf    internlm2-chat-1.8b-hf
----------  ---------  --------  ------  ------------------------  ------------------------
demo_gsm8k  -          -         -       -                         -
demo_math   -          -         -       -                         -
09/09 15:59:52 - OpenCompass - INFO - write summary to /home/dream/opencompass/outputs/default/20240909_155855/summary/summary_20240909_155855.txt
09/09 15:59:52 - OpenCompass - INFO - write csv to /home/dream/opencompass/outputs/default/20240909_155855/summary/summary_20240909_155855.csv
```

### 其他信息

`outputs/default/20240909_155855/logs/infer/qwen2-1.5b-instruct-hf/demo_gsm8k.out`日志文件内报错如下：
```
Traceback (most recent call last):
  File "/home/dream/opencompass/opencompass/tasks/openicl_infer.py", line 161, in <module>
    inferencer.run()
  File "/home/dream/opencompass/opencompass/tasks/openicl_infer.py", line 73, in run
    self.model = build_model_from_cfg(model_cfg)
  File "/home/dream/opencompass/opencompass/utils/build.py", line 25, in build_model_from_cfg
    return MODELS.build(model_cfg)
  File "/home/dream/miniconda3/envs/opencompass_lmdeploy/lib/python3.10/site-packages/mmengine/registry/registry.py", line 570, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/home/dream/miniconda3/envs/opencompass_lmdeploy/lib/python3.10/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg
    obj = obj_cls(**args)  # type: ignore
  File "/home/dream/opencompass/opencompass/models/huggingface_above_v4_33.py", line 174, in __init__
    self.max_seq_len = _get_possible_max_seq_len(max_seq_len, path)
  File "/home/dream/opencompass/opencompass/models/huggingface_above_v4_33.py", line 49, in _get_possible_max_seq_len
    config = AutoConfig.from_pretrained(path, trust_remote_code=True)
  File "/home/dream/miniconda3/envs/opencompass_lmdeploy/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 976, in from_pretrained
    config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/dream/miniconda3/envs/opencompass_lmdeploy/lib/python3.10/site-packages/transformers/configuration_utils.py", line 632, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/dream/miniconda3/envs/opencompass_lmdeploy/lib/python3.10/site-packages/transformers/configuration_utils.py", line 689, in _get_config_dict
    resolved_config_file = cached_file(
  File "/home/dream/miniconda3/envs/opencompass_lmdeploy/lib/python3.10/site-packages/transformers/utils/hub.py", line 445, 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 Qwen/Qwen2-1.5B-Instruct 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'.
```
因为日志提示是网络问题，尝试启用huggingface的离线模式，运行了`HF_DATASETS_OFFLINE=1 HF_HUB_OFFLINE=1 opencompass ./configs/eval_chat_demo.py`，但是依然没有解决问题，日志显示错误依然如上

除此之外， 我也遵循README，通过`wget`解压了数据库的包，并且放入`data/`文件夹中，但是没有起作用

 HF_EVALUATE_OFFLINE=1 HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1 

HUGGINGFACE_HUB_CACHE=/path-to-hf/hub  HF_HUB_CACHE=/path-to-hf/hub HF_EVALUATE_OFFLINE=1 HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1

Feel free to re-open if needed.