modelscope / modelscope-agent

ModelScope-Agent: An agent framework connecting models in ModelScope with the world
https://modelscope-agent.readthedocs.io/en/latest/
Apache License 2.0
2.68k stars 308 forks source link

name 'history' is not defined in modelscope-agent/apps/msgpt/predict.py file #273

Open KaedinLian opened 9 months ago

KaedinLian commented 9 months ago

When I click regenerate button, I got NameError: name 'history' is not defined Is it normal to not define the history variable in advance? How can I solve my problem? The pictures show the specific phenomena and background errors I encountered. image

user_input: 讲一个小男孩的故事,20字左右
upload_image_url: 
Traceback (most recent call last):
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/gradio/queueing.py", line 407, in call_prediction
    output = await route_utils.call_process_api(
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/gradio/route_utils.py", line 226, in call_process_api
    output = await app.get_blocks().process_api(
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/gradio/blocks.py", line 1550, in process_api
    result = await self.call_function(
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/gradio/blocks.py", line 1199, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/gradio/utils.py", line 519, in async_iteration
    return await iterator.__anext__()
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/gradio/utils.py", line 512, in __anext__
    return await anyio.to_thread.run_sync(
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2134, in run_sync_in_worker_thread
    return await future
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/gradio/utils.py", line 495, in run_sync_iterator_async
    return next(iterator)
  File "/data/lhj/miniconda3/envs/RL/lib/python3.10/site-packages/gradio/utils.py", line 649, in gen_wrapper
    yield from f(*args, **kwargs)
  File "/data/lhj/code/modelscope-agent/apps/msgpt/predict.py", line 20, in stream_predict
    if len(history) == 0:
NameError: name 'history' is not defined
KaedinLian commented 9 months ago

I will be very grateful for your answers and help.

mushenL commented 8 months ago

您好,可以提供一下您使用的模型以及代码吗?您可以先使用release/0.3.0分支的apps/agentfabric的方式构建,近期我们会发布新版本来优化已知的问题

KaedinLian commented 8 months ago

您好,可以提供一下您使用的模型以及代码吗?您可以先使用release/0.3.0分支的apps/agentfabric的方式构建,近期我们会发布新版本来优化已知的问题

应该是master。当时参考readme用git clone [https://github.com/modelscope/modelscope-agent.git下载的。后来注释掉history后解决了。 另外,安装配置环境花了很多时间,因为有些版本依赖并没有在requirement里。请问有易于使用是docker版本吗,考虑下次发布docker版本吗?

mushenL commented 8 months ago

您好,有相关的镜像可以尝试拉取下面这个镜像 registry.cn-hangzhou.aliyuncs.com/modelscope/modelscope-agent:v0.3.0 或者使用modelscope的官方镜像也是可以的

zzhangpurdue commented 7 months ago

d

您好,可以提供一下您使用的模型以及代码吗?您可以先使用release/0.3.0分支的apps/agentfabric的方式构建,近期我们会发布新版本来优化已知的问题

应该是master。当时参考readme用git clone [https://github.com/modelscope/modelscope-agent.git下载的。后来注释掉history后解决了。 另外,安装配置环境花了很多时间,因为有些版本依赖并没有在requirement里。请问有易于使用是docker版本吗,考虑下次发布docker版本吗?

docker版本后续安排,开发中