开发者社区 > ModelScope模型即服务 > 正文

ModelScope 安装结束后,再次执行环境变量应该怎么写?

ModelScope 安装结束后,再次执行。root@dsw-501212-858f58b9cb-s5b4r:/mnt/workspace/Qwen2-7B-Instruct-DashInfer-Demo# python app.py
2024-06-07 22:15:40,128 - modelscope - INFO - PyTorch version 2.3.0+cpu Found.
2024-06-07 22:15:40,129 - modelscope - INFO - Loading ast index from /mnt/workspace/.cache/modelscope/ast_indexer
2024-06-07 22:15:40,159 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 eccbdad6389abeac8790b84f257211fb and a total number of 980 components indexed
/usr/local/lib/python3.10/site-packages/beartype/_util/error/utilerrwarn.py:67: BeartypeModuleUnimportableWarning: Ignoring module "onnx" importation exception:
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/local/lib/python3.10/site-packages/google/protobuf/internal/init.py)
warn(message, cls)
/usr/local/lib/python3.10/site-packages/beartype/_util/error/utilerrwarn.py:67: BeartypeModuleUnimportableWarning: Ignoring module "onnx" importation exception:
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/local/lib/python3.10/site-packages/google/protobuf/internal/init.py)
warn(message, cls)
Traceback (most recent call last):
File "/mnt/workspace/Qwen2-7B-Instruct-DashInfer-Demo/app.py", line 17, in
api.login(login_token)
File "/usr/local/lib/python3.10/site-packages/modelscope/hub/api.py", line 114, in login
raise_for_http_status(r)
File "/usr/local/lib/python3.10/site-packages/modelscope/hub/errors.py", line 198, in raise_for_http_status
raise HTTPError(http_error_msg, response=rsp)
requests.exceptions.HTTPError: 400 Client Error: Bad Request, Request id: 80bc1e57548b4e98bcddcc44d43ad374 for url: https://www.modelscope.cn/api/v1/login, body: b'{"AccessToken": null}'
环境变量应该怎么写?我已经先执行了这个from modelscope.hub.api import HubApi

YOUR_ACCESS_TOKEN = '~我的sdk~'
api = HubApi()
api.login(YOUR_ACCESS_TOKEN)

展开
收起
夹心789 2024-06-09 16:46:01 46 0
1 条回答
写回答
取消 提交回答
  • ModuleNotFoundError: No module named 'gradio' ,此回答整理自钉群“魔搭ModelScope开发者联盟群 ①”

    2024-06-11 09:54:25
    赞同 展开评论 打赏

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!欢迎加入技术交流群:微信公众号:魔搭ModelScope社区,钉钉群号:44837352

相关电子书

更多
视觉AI能力的开放现状及ModelScope实战 立即下载
ModelScope助力语音AI模型创新与应用 立即下载
低代码开发师(初级)实战教程 立即下载