Repository: modelscope/evalscope
Issue: opencompass作为后端，但type参数’'opencompass.models.OpenAIExtra'‘是否未写generate方法导致报错？
Root cause: External Dependency Breakage

## 自查清单

在提交 issue 之前，请确保您已完成以下步骤:
- [x] 我已仔细阅读了[相关使用说明文档](https://evalscope.readthedocs.io/zh-cn/latest/get_started/parameters.html)
- [x] 我已查看了[常见问题解答](https://evalscope.readthedocs.io/zh-cn/latest/get_started/faq.html)
- [x] 我已搜索并查看了现有的 issues，确认这不是一个重复的问题

## 问题描述

opencompass作为后端，但type参数’'opencompass.models.OpenAIExtra'‘是否未写generate方法导致报错？

## EvalScope 版本（必填）
最新版本

## 使用的工具
- [ ] Native / 原生框架
- [x] Opencompass backend
- [ ] VLMEvalKit backend
- [ ] RAGEval backend
- [ ] Perf / 模型推理压测工具
- [ ] Arena / 竞技场模式

## 执行的代码或指令

from evalscope.run import run_task
import os
from dotenv import load_dotenv
load_dotenv()

task_cfg_dict = dict(
    eval_backend='OpenCompass',
    eval_config={
        'datasets': ['gsm8k'],
        'models': [
            {'abbr':"Qwen2-0.5B",
            'path': 'qwen2-0.5b-instruct',
            # 'type': 'opencompass.models.qwen_api.Qwen',
            'key': os.getenv("QWEN_API_KEY"),
            'openai_api_base': os.getenv("QWEN_BASE_URL"),
            'is_chat': True,
            'batch_size': 2},
        ],
        'work_dir': 'outputs/test',
        'limit': 6,
        },
    
    )

run_task(task_cfg=task_cfg_dict)


## 错误日志

12/17 09:22:09 - OpenCompass - INFO - Task [qwen2-0.5b-instruct/gsm8k]
C:\Project\evalscope-main\.venv\Lib\site-packages\jieba\_compat.py:18: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  import pkg_resources
12/17 09:22:19 - OpenCompass - WARNING - Max Completion tokens for qwen2-0.5b-instruct is :16384
12/17 09:22:43 - OpenCompass - INFO - Start inferencing [qwen2-0.5b-instruct/gsm8k]
[2025-12-17 09:22:43,534] [opencompass.openicl.icl_inferencer.icl_gen_inferencer] [INFO] Starting build dataloader
[2025-12-17 09:22:43,534] [opencompass.openicl.icl_inferencer.icl_gen_inferencer] [INFO] Starting inference process...

  0%|          | 0/3 [00:00<?, ?it/s]--- Logging error ---
Traceback (most recent call last):
  File "C:\Project\evalscope-main\.venv\Lib\site-packages\requests\models.py", line 976, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Project\evalscope-main\.venv\Lib\site-packages\simplejson\__init__.py", line 514, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Project\evalscope-main\.venv\Lib\site-packages\simplejson\decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
               ^^^^^^^^^^^^^^^^^^
  File "C:\Project\evalscope-main\.venv\Lib\site-packages\simplejson\decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Project\evalscope-main\.venv\Lib\site-packages\opencompass\models\openai_api.py", line 310, in _generate
    response = raw_response.json()
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Project\evalscope-main\.venv\Lib\site-packages\requests\models.py", line 980, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "C:\Project\evalscope-main\.venv\Lib\site-packages\mmengine\logging\logger.py", line 124, in format
    result = logging.Formatter.format(self, record)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py", line 703, in format
    record.message = record.getMessage()
                     ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py", line 392, in getMessage
    msg = msg % self.args
          ~~~~^~~~~~~~~~~
TypeError: not all arguments converted during string formatting
Call stack:
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\thread.py", line 92, in _worker
    work_item.run()
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Project\evalscope-main\.venv\Lib\site-packages\opencompass\models\openai_api.py", line 312, in _generate
    self.logger.error('JsonDecode error, got',
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py", line 1568, in error
    self._log(ERROR, msg, args, **kwargs)
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py", line 1684, in _log
    self.handle(record)
  File "C:\Users\maxweli\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "C:\Project\evalscope-main\.venv\Lib\site-packages\mmengine\logging\logger.py", line 306, in callHandlers
    handler.handle(record)
Message: 'JsonDecode error, got'
Arguments: ("b''",)

## 运行环境

- 操作系统：windows11
- Python版本：3.12.3

## 其他信息

openai_api的代码是：
@MODELS.register_module()
class OpenAIExtra(OpenAI):
    """
    Model wrapper around OpenAI's models with extra features.
    Args:
        path (str): The name of OpenAI's model.
        max_seq_len (int): The maximum allowed sequence length of a model.
            Note that the length of prompt + generated tokens shall not exceed
            this value. Defaults to 2048.
        query_per_second (int): The maximum queries allowed per second
            between two consecutive calls of the API. Defaults to 1.
        retry (int): Number of retires if the API call fails. Defaults to 2.
        key (str or List[str]): OpenAI key(s). In particular, when it
            is set to "ENV", the key will be fetched from the environment
            variable $OPENAI_API_KEY, as how openai defaults to be. If it's a
            list, the keys will be used in round-robin manner. Defaults to
            'ENV'.
        org (str or List[str], optional): OpenAI organization(s). If not
            specified, OpenAI uses the default organization bound to each API
            key. If specified, the orgs will be posted with each request in
            round-robin manner. Defaults to None.
        meta_template (Dict, optional): The model's meta prompt
            template if needed, in case the requirement of injecting or
            wrapping of any meta instructions.
        openai_api_base (str): The base url of OpenAI's API. Defaults to
            'https://api.openai.com/v1/chat/completions'.
        mode (str, optional): The method of input truncation when input length
            exceeds max_seq_len. 'front','mid' and 'rear' represents the part
            of input to truncate. Defaults to 'none'.
        temperature (float, optional): What sampling temperature to use.
            If not None, will override the temperature in the `generate()`
            call. Defaults to None.
    """

    def __init__(self, *args, **kwargs):

        super(OpenAIExtra, self).__init__(*args, **kwargs)

    def get_token_len(self, prompt: str) -> int:
        """Get lengths of the tokenized string. Only English and Chinese
        characters are counted for now. Users are encouraged to override this
        method if more accurate length is needed.
        Args:
            prompt (str): Input string.
        Returns:
            int: Length of the input tokens
        """
        english_parts = re.findall(r'[A-Za-z0-9]+', prompt)
        chinese_parts = re.findall(r'[\u4e00-\u9FFF]+', prompt)

        # Count English words
        english_count = sum(len(part.split()) for part in english_parts)

        # Count Chinese words
        chinese_count = sum(len(part) for part in chinese_parts)

        return english_count + chinese_count

而opencompass的默认type参数是’opencompass.models.OpenAIExtra‘，但该方法没有generate方法，是否是导致报错的原因？


opencompass版本是多少，如何安装的呢，是否是`pip install ms-opencompass`

> opencompass版本是多少，如何安装的呢，是否是`pip install ms-opencompass`

ms-opencompass是 0.1.6，但我记得是pip install -e .这种安装方式

> > opencompass版本是多少，如何安装的呢，是否是`pip install ms-opencompass`
> 
> ms-opencompass是 0.1.6，但我记得是pip install -e .这种安装方式

下载的源码安装