ms-agent icon indicating copy to clipboard operation
ms-agent copied to clipboard

LLMFactory错误

Open jchzhao opened this issue 1 year ago • 6 comments

ImportError: cannot import name 'LLMFactory' from 'modelscope_agent.llm' (/mnt/workspace/modelscope-agent/modelscope_agent/llm/init.py)

jchzhao avatar Mar 05 '24 09:03 jchzhao

which branch are you using?

zzhangpurdue avatar Mar 06 '24 07:03 zzhangpurdue

i have the same problem

xl4533 avatar Mar 11 '24 07:03 xl4533

master branch

xl4533 avatar Mar 11 '24 07:03 xl4533

Could you please provide your code, in order to repeat the error. Thanks.

master branch

zzhangpurdue avatar Mar 12 '24 11:03 zzhangpurdue

A start.py file was created in the root directory, but an error occurred while importing the package. This code can run normally in previous versionsA start.py file was created in the root directory, but an error occurred while importing the package. This code can run normally in previous versions。

本地LLM配置

import os from modelscope.utils.config import Config from modelscope_agent.llm import LLMFactory from modelscope_agent.agent import AgentExecutor from modelscope_agent.tools import SearchKnowledgeTool import json import requests import torch

model_name = 'meetingroom-7b' model_cfg = { 'meetingroom-7b':{ 'type': 'modelscope', 'model_id': 'meetingroom-7b', 'model_revision': 'v1.0.0', 'use_raw_generation_config': True, 'custom_chat': True } }

tool_cfg_file = os.getenv('TOOL_CONFIG_FILE', 'config/cfg_tool_template.json') tool_cfg = Config.from_file(tool_cfg_file) llm = LLMFactory.build_llm(model_name, model_cfg) agent = AgentExecutor(llm, tool_cfg,tool_retrieval=False)

#agent.set_available_tools(available_tool_list)

Single-step tool-use

first = agent.run("预定一下明天下午三点的大型会议室", remote=False)

xl4533 avatar Mar 18 '24 03:03 xl4533

I am very sorry that we have an upgrading from 0.2.x to 0.3.x which is backward incompatible upgrading. So, some of the api have changed. Your case is a 0.2.x‘s example, so it will not run on 0.3.x. Could you please run a demo on https://github.com/modelscope/modelscope-agent/blob/master/demo/demo_modelscopegpt_agent.ipynb and try again?

We will avoid such problem in the rest of upgrading.

zzhangpurdue avatar Mar 18 '24 03:03 zzhangpurdue