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.71k stars 310 forks source link

LLMFactory错误 #324

Open jchzhao opened 8 months ago

jchzhao commented 8 months ago

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

zzhangpurdue commented 8 months ago

which branch are you using?

xl4533 commented 8 months ago

i have the same problem

xl4533 commented 8 months ago

master branch

zzhangpurdue commented 8 months ago

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

master branch

xl4533 commented 8 months ago

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)

zzhangpurdue commented 8 months ago

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.