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.64k stars 302 forks source link

demo/demo_retrieval_agent.ipynb报错 #359

Open XduSyL opened 6 months ago

XduSyL commented 6 months ago

Initial Checks

What happened + What you expected to happen

作者您好,非常感谢您的工作 我在研究您的工作时,出现了一些问题,还请麻烦您解答一下 在运行demo/demo_retrieval_agent.ipynb的例子进行向量库检索时,在实例化memory类时报错了

memory = MemoryWithRetrievalKnowledge(storage_path=storage_path,
                                         name = memory_agent_name,
                                         memory_path=memory_history_path)

跳到了这一行

self.embedding = embedding or ModelScopeEmbeddings(
            model_id='damo/nlp_gte_sentence-embedding_chinese-base')

报了如下错误 Could not import some python packages.Please install it with pip install modelscope. ImportError: cannot import name 'models' from partially initialized module 'oss2' (most likely due to a circular import) (d:\Anaconda\envs\agent\lib\site-packages\oss2__init__.py)

The above exception was the direct cause of the following exception:

File "D:\Code\modelscope-agent\modelscope_agent\storage\vector_storage.py", line 30, in init self.embedding = embedding or ModelScopeEmbeddings( File "D:\Code\modelscope-agent\modelscope_agent\memory\memory_with_retrieval_knowledge.py", line 31, in init self.store_knowledge = KnowledgeVector( File "D:\Code\modelscope-agent\main.py", line 20, in memory = MemoryWithRetrievalKnowledge(storage_path=storage_path, ImportError: Could not import some python packages.Please install it with pip install modelscope.

Versions / Dependencies

Reproduction script

Issue Severity

None

zzhangpurdue commented 6 months ago

是否本地pip install modelscope

XduSyL commented 6 months ago

是否本地pip install modelscope 在本地安装过modelscope了

XduSyL commented 6 months ago

是否本地pip install modelscope

执行其他demo是正常的

zzhangpurdue commented 6 months ago

目前没法复现,可能的是,里面有些requirements出现了版本问题。你是完全跟据demo一行行执行下来的么?那个requirements.txt也是完整安装的么?

XduSyL commented 6 months ago

请问一下在demo/demo_qwen_agent.ipynb的demo中,如果我要与大模型进行多轮会话的话要怎么操作呀,因为,我看RolePlay这个类实例化之后,最大执行次数默认为10,但是好像是单次就break了。

zzhangpurdue commented 6 months ago

这里的执行测试默认10,相当于他在做self-reflection,每一步他的结果他会去分析,还有什么不对的或者需要完善的,如果没有了,这一轮结束。也就是该单次聊天结束,需要多轮的话,参考这个链接