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

demo_modelscopegpt_agent.ipynb 报错 #17

Closed yhyu13 closed 1 year ago

yhyu13 commented 1 year ago

按照b站官方推荐视频https://www.bilibili.com/video/BV1cu4y1k7Pg/,

运行demo报错了,好像是dashscope py package中的代码?请问能复现吗

modelscope

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[6], line 2
      1 agent.reset()
----> 2 agent.run("调用插件,生成一段两只小猫一起跳舞的视频", remote=True)

File ~/Documents/Git-repoMy/AIResearchVault/repo/LLMApp/modelscope-agent/demo/../modelscope_agent/agent.py:143, in AgentExecutor.run(self, task, remote, print_info)
    141 # generate prompt and call llm
    142 prompt = self.prompt_generator.generate(llm_result, exec_result)
--> 143 llm_result = self.llm.generate(prompt)
    144 if print_info:
    145     print(f'|prompt{idx}: {prompt}')

File ~/Documents/Git-repoMy/AIResearchVault/repo/LLMApp/modelscope-agent/demo/../modelscope_agent/llm/ms_gpt.py:23, in ModelScopeGPT.generate(self, prompt)
     20 def generate(self, prompt):
     22     total_response = ''
---> 23     responses = Generation.call(
     24         model=self.model, prompt=prompt, stream=False, **self.generate_cfg)
     26     if responses.status_code == HTTPStatus.OK:
     27         total_response = responses.output['text']

TypeError: dashscope.aigc.generation.Generation.call() got multiple values for keyword argument 'model'

另外运行demo的时候提示安装faiss-gpu或-cpu,这个requirement里面也没有。

pip install faiss-gpu

这是我本地的conda env

name: modelscope
channels:
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - aiofiles=22.1.0=py310h06a4308_0
  - aiosqlite=0.18.0=py310h06a4308_0
  - anyio=3.5.0=py310h06a4308_0
  - argon2-cffi=21.3.0=pyhd3eb1b0_0
  - argon2-cffi-bindings=21.2.0=py310h7f8727e_0
  - babel=2.11.0=py310h06a4308_0
  - backcall=0.2.0=pyhd3eb1b0_0
  - beautifulsoup4=4.12.2=py310h06a4308_0
  - bleach=4.1.0=pyhd3eb1b0_0
  - brotlipy=0.7.0=py310h7f8727e_1002
  - bzip2=1.0.8=h7b6447c_0
  - ca-certificates=2023.05.30=h06a4308_0
  - cchardet=2.1.7=py310h6a678d5_0
  - certifi=2023.7.22=py310h06a4308_0
  - cffi=1.15.1=py310h5eee18b_3
  - chardet=4.0.0=py310h06a4308_1003
  - comm=0.1.2=py310h06a4308_0
  - debugpy=1.6.7=py310h6a678d5_0
  - defusedxml=0.7.1=pyhd3eb1b0_0
  - entrypoints=0.4=py310h06a4308_0
  - icu=73.1=h6a678d5_0
  - idna=3.4=py310h06a4308_0
  - ipykernel=6.25.0=py310h2f386ee_0
  - ipython_genutils=0.2.0=pyhd3eb1b0_1
  - ipywidgets=8.0.4=py310h06a4308_0
  - jinja2=3.1.2=py310h06a4308_0
  - json5=0.9.6=pyhd3eb1b0_0
  - jsonschema=4.17.3=py310h06a4308_0
  - jupyter_client=7.4.9=py310h06a4308_0
  - jupyter_core=5.3.0=py310h06a4308_0
  - jupyter_events=0.6.3=py310h06a4308_0
  - jupyter_server=1.23.4=py310h06a4308_0
  - jupyter_server_fileid=0.9.0=py310h06a4308_0
  - jupyter_server_ydoc=0.8.0=py310h06a4308_1
  - jupyter_ydoc=0.2.4=py310h06a4308_0
  - jupyterlab=3.6.3=py310h06a4308_0
  - jupyterlab_pygments=0.1.2=py_0
  - jupyterlab_server=2.22.0=py310h06a4308_0
  - jupyterlab_widgets=3.0.5=py310h06a4308_0
  - ld_impl_linux-64=2.38=h1181459_1
  - libffi=3.4.4=h6a678d5_0
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libsodium=1.0.18=h7b6447c_0
  - libstdcxx-ng=11.2.0=h1234567_1
  - libuuid=1.41.5=h5eee18b_0
  - libxml2=2.10.4=hf1b16e4_1
  - libxslt=1.1.37=h5eee18b_1
  - lxml=4.9.2=py310h5eee18b_0
  - matplotlib-inline=0.1.6=py310h06a4308_0
  - mistune=0.8.4=py310h7f8727e_1000
  - nbclassic=0.5.5=py310h06a4308_0
  - nbclient=0.5.13=py310h06a4308_0
  - nbconvert=6.5.4=py310h06a4308_0
  - nbformat=5.7.0=py310h06a4308_0
  - ncurses=6.4=h6a678d5_0
  - nest-asyncio=1.5.6=py310h06a4308_0
  - notebook=6.5.4=py310h06a4308_1
  - notebook-shim=0.2.2=py310h06a4308_0
  - openssl=3.0.10=h7f8727e_2
  - packaging=23.1=py310h06a4308_0
  - pandocfilters=1.5.0=pyhd3eb1b0_0
  - parso=0.8.3=pyhd3eb1b0_0
  - pexpect=4.8.0=pyhd3eb1b0_3
  - pickleshare=0.7.5=pyhd3eb1b0_1003
  - pip=23.2.1=py310h06a4308_0
  - platformdirs=3.10.0=py310h06a4308_0
  - prometheus_client=0.14.1=py310h06a4308_0
  - ptyprocess=0.7.0=pyhd3eb1b0_2
  - pure_eval=0.2.2=pyhd3eb1b0_0
  - pycparser=2.21=pyhd3eb1b0_0
  - pyopenssl=23.2.0=py310h06a4308_0
  - pyrsistent=0.18.0=py310h7f8727e_0
  - pysocks=1.7.1=py310h06a4308_0
  - python=3.10.12=h955ad1f_0
  - python-dateutil=2.8.2=pyhd3eb1b0_0
  - python-fastjsonschema=2.16.2=py310h06a4308_0
  - python-json-logger=2.0.7=py310h06a4308_0
  - pyzmq=23.2.0=py310h6a678d5_0
  - readline=8.2=h5eee18b_0
  - requests=2.31.0=py310h06a4308_0
  - rfc3339-validator=0.1.4=py310h06a4308_0
  - rfc3986-validator=0.1.1=py310h06a4308_0
  - send2trash=1.8.0=pyhd3eb1b0_1
  - setuptools=68.0.0=py310h06a4308_0
  - six=1.16.0=pyhd3eb1b0_1
  - sniffio=1.2.0=py310h06a4308_1
  - soupsieve=2.4=py310h06a4308_0
  - sqlite=3.41.2=h5eee18b_0
  - stack_data=0.2.0=pyhd3eb1b0_0
  - terminado=0.17.1=py310h06a4308_0
  - tinycss2=1.2.1=py310h06a4308_0
  - tk=8.6.12=h1ccaba5_0
  - tomli=2.0.1=py310h06a4308_0
  - tornado=6.3.2=py310h5eee18b_0
  - typing-extensions=4.7.1=py310h06a4308_0
  - typing_extensions=4.7.1=py310h06a4308_0
  - urllib3=1.26.16=py310h06a4308_0
  - webencodings=0.5.1=py310h06a4308_1
  - websocket-client=0.58.0=py310h06a4308_4
  - wheel=0.38.4=py310h06a4308_0
  - widgetsnbextension=4.0.5=py310h06a4308_0
  - xz=5.4.2=h5eee18b_0
  - y-py=0.5.9=py310h52d8a92_0
  - yaml=0.2.5=h7b6447c_0
  - ypy-websocket=0.8.2=py310h06a4308_0
  - zeromq=4.3.4=h2531618_0
  - zlib=1.2.13=h5eee18b_0
  - pip:
      - absl-py==1.4.0
      - accelerate==0.22.0
      - addict==2.4.0
      - aiohttp==3.8.5
      - aiosignal==1.3.1
      - aliyun-python-sdk-core==2.13.36
      - aliyun-python-sdk-kms==2.16.1
      - asttokens==2.4.0
      - async-timeout==4.0.3
      - attrs==23.1.0
      - cachetools==5.3.1
      - charset-normalizer==3.2.0
      - cmake==3.27.2
      - crcmod==1.7
      - cryptography==41.0.3
      - dashscope==1.8.1
      - dataclasses-json==0.5.14
      - datasets==2.13.0
      - decorator==4.4.2
      - diffusers==0.20.2
      - dill==0.3.6
      - einops==0.6.1
      - exceptiongroup==1.1.3
      - executing==1.2.0
      - faiss-gpu==1.7.2
      - filelock==3.12.3
      - frozenlist==1.4.0
      - fsspec==2023.9.0
      - gast==0.5.4
      - google-auth==2.22.0
      - google-auth-oauthlib==1.0.0
      - greenlet==2.0.2
      - grpcio==1.57.0
      - huggingface-hub==0.16.4
      - imageio==2.31.3
      - imageio-ffmpeg==0.4.8
      - importlib-metadata==6.8.0
      - iniconfig==2.0.0
      - ipython==8.15.0
      - jedi==0.19.0
      - jmespath==0.10.0
      - langchain==0.0.283
      - langsmith==0.0.33
      - lit==16.0.6
      - markdown==3.4.4
      - markupsafe==2.1.3
      - marshmallow==3.20.1
      - modelscope==1.9.0
      - moviepy==1.0.3
      - mpmath==1.3.0
      - ms-swift==1.0.0
      - multidict==6.0.4
      - multiprocess==0.70.14
      - mypy-extensions==1.0.0
      - networkx==3.1
      - numexpr==2.8.5
      - numpy==1.25.2
      - nvidia-cublas-cu11==11.10.3.66
      - nvidia-cuda-cupti-cu11==11.7.101
      - nvidia-cuda-nvrtc-cu11==11.7.99
      - nvidia-cuda-runtime-cu11==11.7.99
      - nvidia-cudnn-cu11==8.5.0.96
      - nvidia-cufft-cu11==10.9.0.58
      - nvidia-curand-cu11==10.2.10.91
      - nvidia-cusolver-cu11==11.4.0.1
      - nvidia-cusparse-cu11==11.7.4.91
      - nvidia-nccl-cu11==2.14.3
      - nvidia-nvtx-cu11==11.7.91
      - oauthlib==3.2.2
      - openai==0.28.0
      - opencv-python==4.8.0.76
      - oss2==2.18.1
      - pandas==2.1.0
      - peft==0.5.0
      - pillow==10.0.0
      - pluggy==1.3.0
      - proglog==0.1.10
      - prompt-toolkit==3.0.39
      - protobuf==4.24.2
      - psutil==5.9.5
      - pyarrow==13.0.0
      - pyasn1==0.5.0
      - pyasn1-modules==0.3.0
      - pycryptodome==3.18.0
      - pydantic==1.10.8
      - pygments==2.16.1
      - pytest==7.4.1
      - python-dotenv==1.0.0
      - pytz==2023.3.post1
      - pyyaml==6.0.1
      - regex==2023.8.8
      - requests-oauthlib==1.3.1
      - rsa==4.9
      - safetensors==0.3.3
      - scipy==1.11.2
      - simplejson==3.19.1
      - sortedcontainers==2.4.0
      - soundfile==0.12.1
      - sqlalchemy==2.0.20
      - stack-data==0.6.2
      - sympy==1.12
      - tenacity==8.2.3
      - tensorboard==2.14.0
      - tensorboard-data-server==0.7.1
      - tokenizers==0.13.3
      - torch==2.0.1
      - tqdm==4.66.1
      - traitlets==5.9.0
      - transformers==4.33.0
      - transformers-stream-generator==0.0.4
      - triton==2.0.0
      - typing-inspect==0.9.0
      - tzdata==2023.3
      - wcwidth==0.2.6
      - werkzeug==2.3.7
      - xxhash==3.3.0
      - yapf==0.40.1
      - yarl==1.9.2
      - zipp==3.16.2
prefix: /home/hangyu5/anaconda3/envs/modelscope
yhyu13 commented 1 year ago

能复现的话请说一声,不能的话,能麻烦贴一下conda或pip环境吗 谢谢

lcl6679292 commented 1 year ago

您好,可以完整贴一下您现在的notebook代码吗,如果是要用modelscope-gpt dashscope api模型的话,需要您申请相关的dashscope key才可以访问,如果您本地有GPU环境,可以参考我们的 demo_qwen_agent.ipynb 。具体的教程可以参考这个文章: demo_qwen_agent:https://github.com/modelscope/modelscope-agent/blob/master/demo/demo_qwen_agent.ipynb 教程文章:https://mp.weixin.qq.com/s/L3GiV2QHeybhVZSg_g_JRw

yhyu13 commented 1 year ago

dashcope modelscope api key我都有了。https://github.com/modelscope/modelscope-agent/blob/master/demo/demo_modelscopegpt_agent.ipynb 用的就是这个,没改过。

我试试看另外一个notebook吧

lcl6679292 commented 1 year ago

收到,我们正在排查问题,修复后会第一时间答复

lcl6679292 commented 1 year ago

您好,这个问题已经修复了,请拉取最新的代码,另外dashscope api申请需要选择千问7B,具体过程如下:

  1. 注册登录https://dashscope.aliyun.com/
  2. 打开模型广场
  3. 选择通义开源系列
  4. 申请开通 通义千问7B模型
yhyu13 commented 1 year ago

您好,可以完整贴一下您现在的notebook代码吗,如果是要用modelscope-gpt dashscope api模型的话,需要您申请相关的dashscope key才可以访问,如果您本地有GPU环境,可以参考我们的 demo_qwen_agent.ipynb 。具体的教程可以参考这个文章: demo_qwen_agent:https://github.com/modelscope/modelscope-agent/blob/master/demo/demo_qwen_agent.ipynb 教程文章:https://mp.weixin.qq.com/s/L3GiV2QHeybhVZSg_g_JRw

demo_qwen_agent.ipynb 这个notebook中最后文本转声音,需要一个kantts的module,但是好像找不到。 image

[{'error': "Action call error: modelscope_speech-generation: {'input': '小狗寻找主人,奔跑在熟悉而又陌生的街道上,经过了许多陌生的面孔和场景,最终在街角的转角处找到了主人的熟悉的身影,狂喜地奔向他的怀抱。', 'gender': 'woman'}. \n Error message: Failed to import modelscope.models.audio.tts.sambert_hifi because of the following error (look up to see its traceback):\nNo module named 'kantts'"}]

另外,我发现运行这个notebook时,还需要以下的py package

matplotlib
tiktoken
wenmengzhou commented 1 year ago

agent会自动根据任务描述调用各个领域的modelscope模型,如果你是在本地环境运行,建议使用modelscope镜像,里面覆盖了modelscope所有模型的依赖, 或者请自行安装modelscope各领域的依赖

详细可以参考文档: https://modelscope.cn/docs/%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85