eval-scope icon indicating copy to clipboard operation
eval-scope copied to clipboard

RuntimeError: Cannot run the event loop while another loop is running

Open ArlanCooper opened this issue 9 months ago • 4 comments

自查清单

在提交 issue 之前,请确保您已完成以下步骤:

问题描述

运行示例代码,报错

EvalScope 版本(必填)

v0.16.0

使用的工具

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

执行的代码或指令

from evalscope.perf.main import run_perf_benchmark
from evalscope.perf.arguments import Arguments

task_cfg = Arguments(
    parallel=[1],
    number=[10],
    model='qwen3-32b',
    url='http://10.59.144.57:6008/v1',
    api='openai',
    dataset='random',
    min_tokens=1024,
    max_tokens=1024,
    prefix_length=0,
    min_prompt_length=1024,
    max_prompt_length=1024,
    tokenizer_path='/home/octopus/data/llm_list/qwen3_32b/Qwen/Qwen3-32B',
    extra_args={'ignore_eos': True}
)
results = run_perf_benchmark(task_cfg)

错误日志

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[2], line 1
----> 1 results = run_perf_benchmark(task_cfg)

File ~/.local/lib/python3.10/site-packages/evalscope/perf/main.py:87, in run_perf_benchmark(args)
     85 # Start benchmark
     86 if len(args.number) == 1:
---> 87     return run_one_benchmark(args, output_path=output_path)
     88 else:
     89     return run_multi_benchmark(args, output_path=output_path)

File ~/.local/lib/python3.10/site-packages/evalscope/perf/main.py:39, in run_one_benchmark(args, output_path)
     36 if platform.system() != 'Windows':
     37     add_signal_handlers(loop)
---> 39 return loop.run_until_complete(benchmark(args))

File ~/work/conda/envs/bert_env/lib/python3.10/asyncio/base_events.py:625, in BaseEventLoop.run_until_complete(self, future)
    614 """Run until the Future is done.
    615 
    616 If the argument is a coroutine, it is wrapped in a Task.
   (...)
    622 Return the Future's result, or raise its exception.
    623 """
    624 self._check_closed()
--> 625 self._check_running()
    627 new_task = not futures.isfuture(future)
    628 future = tasks.ensure_future(future, loop=self)

File ~/work/conda/envs/bert_env/lib/python3.10/asyncio/base_events.py:586, in BaseEventLoop._check_running(self)
    584     raise RuntimeError('This event loop is already running')
    585 if events._get_running_loop() is not None:
--> 586     raise RuntimeError(
    587         'Cannot run the event loop while another loop is running')

RuntimeError: Cannot run the event loop while another loop is running

运行环境

  • 操作系统:ubuntu16.04
  • Python版本:3.10.12

其他信息

如果有其他相关信息,请在此处提供。

ArlanCooper avatar May 20 '25 08:05 ArlanCooper

是在notebook中运行的代码吗,还是在终端中运行的python脚本呢

Yunnglin avatar May 20 '25 09:05 Yunnglin

是在notebook中运行的代码吗,还是在终端中运行的python脚本呢

对的

ArlanCooper avatar May 20 '25 09:05 ArlanCooper

不要在notebook环境中运行,请写一个python脚本,在终端中运行

Yunnglin avatar May 20 '25 09:05 Yunnglin

不要在notebook环境中运行,请写一个python脚本,在终端中运行

好滴,我试一下

ArlanCooper avatar May 20 '25 09:05 ArlanCooper

感谢你的反馈!我们将关闭此问题。如果您有任何疑问,请随时重新打开它。如果EvalScope对您有所帮助,欢迎给我们点个STAR以示支持,谢谢!

Yunnglin avatar Jun 04 '25 06:06 Yunnglin