【阿里魔搭】modelscope包下载安装

最终解决方案:使用源码安装modelscope

这里写目录标题

  • 问题描述:pip安装包冲突
  • 安装步骤

问题描述:pip安装包冲突

一开始的是在3.11的虚拟环境下使用命令行pip install "modelscope[nlp]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html下载,一直报错显示包冲突

并且是这种报错,根本没办法调和。

 modelscope[nlp] 1.9.0 depends on datasets<=2.13.0 and >=2.8.0
    modelscope[nlp] 1.8.4 depends on datasets<=2.13.0 and >=2.8.0
    modelscope[nlp] 1.8.1 depends on datasets<=2.13.0 and >=2.8.0
 modelscope[nlp] 1.6.1 depends on datasets<=2.8.0 and >=2.7.0
    modelscope[nlp] 1.6.0 depends on datasets<=2.8.0 and >=2.7.0
    modelscope[nlp] 1.5.1 depends on datasets<=2.8.0 and >=2.7.0
    modelscope[nlp] 1.4.3 depends on datasets<=2.8.0 and >=2.7.0
    modelscope[nlp] 1.4.1 depends on datasets<=2.8.0 and >=2.7.0
    modelscope[nlp] 1.3.1 depends on datasets<=2.8.0 and >=2.7.0
 modelscope[nlp] 1.1.4 depends on datasets<=2.5.2
    modelscope[nlp] 1.1.3 depends on datasets<=2.5.2
    modelscope[nlp] 1.1.2 depends on datasets<=2.5.2
    modelscope[nlp] 1.1.1 depends on datasets<=2.5.2
    modelscope[nlp] 1.1.0 depends on datasets<=2.5.2
    modelscope[nlp] 1.0.4 depends on datasets<=2.5.2
    modelscope[nlp] 1.0.3 depends on datasets<=2.5.2
    modelscope[nlp] 1.0.2 depends on datasets<=2.5.2
    modelscope[nlp] 1.0.1 depends on datasets<=2.5.2
modelscope[nlp] 0.3.7 depends on datasets==2.1.0
    modelscope[nlp] 0.3.6 depends on datasets==2.1.0
    modelscope[nlp] 0.3.5 depends on datasets==2.1.0
    modelscope[nlp] 0.3.4 depends on datasets==2.1.0

后来在官网找到环境安装的说明:https://www.modelscope.cn/docs/环境安装
请添加图片描述
环境配置Python版本只显示了3.7和3.8,于是重新创建虚拟环境进行安装。

首先安装深度学习框架,看你的模型是需要pytorch还是tensorflow,根据官网下载对应版本请添加图片描述
后面继续pip install "modelscope[nlp]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html 进行安装但是出现相同问题,于是尝试使用通过源码安装

安装步骤

以下是安装全过程:

  1. 创建虚拟环境并激活

    conda create -n modelscope python=3.8
    conda activate modelscope
    
  2. 安装深度学习框架

    Pytorch:

    pip install torch torchvision torchaudio
    

    或Tensorflow:

    pip install --upgrade tensorflow==2.13.0 # 仅支持 CPU 的版本
    

    注: 客观上在国内使用pip安装的时候,如果默认是用海外的pypi源的话,可能因为网络问题,下载速度受限。如果有这个现象,可以考虑通过pip的"-i"命令行选项来手工配置仓库来源,例如"-i https://pypi.tuna.tsinghua.edu.cn/simple " 可以将配置仓库来源使用"清华源"。例如:

    pip3 install torch torchvision torchaudio -i https://pypi.tuna.tsinghua.edu.cn/simple
    

    常见的可用源还包括 “-i https://mirrors.bfsu.edu.cn/pypi/web/simple”, "-i https://mirrors.ustc.edu.cn/pypi/web/simple "等等,可以根据自己的网络条件自行选择。

  3. ModelScope Library 安装(源码安装)

    我使用pip安装失败遂不介绍,仅介绍源码安装

    1. 源码下载
      a. 可以使用git下载源码

       ```jsx
       git clone git@github.com:modelscope/modelscope.git
       cd modelscope
       git fetch origin master
       git checkout master
       ```
      

      b. 直接在github官网下载 https://github.com/modelscope/modelscope

    2. 一定要先cd去源码所在的目录中先,否则会报错

      请添加图片描述

      可以使用命令行检查是否转到对应目录下:

      dir
      type setup.py
      

      请添加图片描述

    1. 安装依赖:仅需体验NLP领域模型,执行如下命令安装依赖

      pip install ".[nlp]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
      

      期间他会提示缺少某些包而报错,根据提示单独安装对应的包即可
      请添加图片描述

      如果有安装不成功的在后面加**--trusted-host [pypi.mirrors.ustc.edu.cn](http://pypi.mirrors.ustc.edu.cn)** 以避免潜在的安全警告

      pip install xxx --trusted-host pypi.mirrors.ustc.edu.cn
      pip install ".[nlp]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html --trusted-host pypi.mirrors.ustc.edu.cn
      
    2. 验证:安装成功后,即可使用对应领域模型进行推理,训练等操作。这里我们以NLP领域为例。安装后,可执行如下命令,运行中文分词任务,来验证安装是否正确:

      python -c "from modelscope.pipelines import pipeline;print(pipeline('word-segmentation')('今天天气不错,适合 出去游玩'))"
      
      (modelscope) E:\0.University\0.dissertation\code\modelscope\modelscope>python -c "from modelscope.pipelines import pipeline;print(pipeline('word-segmentation')('今
      天天气不错,适合 出去游玩'))"
      2024-03-21 10:23:41,578 - modelscope - INFO - PyTorch version 1.11.0+cpu Found.
      2024-03-21 10:23:41,580 - modelscope - INFO - Loading ast index from C:\Users\ammy\.cache\modelscope\ast_indexer
      2024-03-21 10:23:42,128 - modelscope - INFO - Loading done! Current index file version is 1.9.4, with md5 d07f5c3e9ea59df520487198f306c0b6 and a total number of 972
       components indexed
      2024-03-21 10:23:46,043 - modelscope - INFO - Model revision not specified, use default: master in development mode
      2024-03-21 10:23:46,044 - modelscope - INFO - Development mode use revision: master
      Downloading: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 243k/243k [00:00<00:00, 987kB/s]
      Downloading: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 976/976 [00:00<00:00, 194kB/s]
      Downloading: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 161/161 [00:00<00:00, 40.4kB/s]
      Downloading: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 46.7k/46.7k [00:00<00:00, 413kB/s]
      Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 388M/388M [02:29<00:00, 2.71MB/s]
      Downloading: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 9.74k/9.74k [00:00<00:00, 1.99MB/s]
      Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 30.0/30.0 [00:00<00:00, 7.54kB/s]
      Downloading: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 107k/107k [00:00<00:00, 659kB/s]
      2024-03-21 10:26:20,450 - modelscope - INFO - initiate model from C:\Users\ammy\.cache\modelscope\hub\damo\nlp_structbert_word-segmentation_chinese-base
      2024-03-21 10:26:20,450 - modelscope - INFO - initiate model from location C:\Users\ammy\.cache\modelscope\hub\damo\nlp_structbert_word-segmentation_chinese-base.
      2024-03-21 10:26:20,454 - modelscope - INFO - initialize model from C:\Users\ammy\.cache\modelscope\hub\damo\nlp_structbert_word-segmentation_chinese-base
      You are using a model of type bert to instantiate a model of type structbert. This is not supported for all configurations of models and can yield errors.
      2024-03-21 10:26:22,373 - modelscope - WARNING - No preprocessor field found in cfg.
      2024-03-21 10:26:22,373 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file.
      2024-03-21 10:26:22,373 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': 'C:\\Users\\amm
      y\\.cache\\modelscope\\hub\\damo\\nlp_structbert_word-segmentation_chinese-base'}. trying to build by task and model information.
      2024-03-21 10:26:22,392 - modelscope - INFO - cuda is not available, using cpu instead.
      2024-03-21 10:26:22,397 - modelscope - WARNING - No preprocessor field found in cfg.
      2024-03-21 10:26:22,397 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file.
      2024-03-21 10:26:22,397 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': 'C:\\Users\\amm
      y\\.cache\\modelscope\\hub\\damo\\nlp_structbert_word-segmentation_chinese-base', 'sequence_length': 512}. trying to build by task and model information.
      E:\anaconda\envs\modelscope\lib\site-packages\transformers\modeling_utils.py:977: FutureWarning: The `device` argument is deprecated and will be removed in v5 of Tr
      ansformers.
        warnings.warn(
      {'output': ['今天', '天气', '不错', ',', '适合', '出去', '游玩']}
      
      

参考:

https://www.modelscope.cn/docs/环境安装

https://blog.csdn.net/qq_41185868/article/details/127355894

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/477716.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

DUSt3R:简化三维重建

3D 重建是从二维 (2D) 图像创建对象或场景的 3D 虚拟表示的任务&#xff0c;可用于模拟、可视化或本地化等多种目的。 它广泛应用于计算机视觉、机器人和虚拟现实&#xff08;VR&#xff09;等多个领域。 在基本设置中&#xff0c;3D 重建方法输入一对图像 I1 和 I2&#xff0c…

字体测试集:选取、应用与兼容性指南

1. 字体测试集 本人非专业字体工作者&#xff0c;字体测试集为个人经验总结整理&#xff0c;仅供参考 那时&#xff0c;天下人的口音、言语都是一样。 南去經三國&#xff0c;東來過五湖 南去经三国&#xff0c;东来过五湖 永东国酬爱郁灵鹰袋 0Oo1lI ga The quick brown fox j…

6个免费的ChatGPT网站

AI 大模型的出现给时代带来了深远的影响&#xff1a; 改变了产业格局&#xff1a;AI 大模型的发展推动了人工智能技术在各行业的广泛应用&#xff0c;改变了传统产业的运作方式&#xff0c;促进了新兴产业的崛起&#xff0c;如智能驾驶、医疗健康、金融科技等。提升了科学研究…

微软发布首款AI PC ,产业链有望迎来新一轮量价齐升

3月21日晚&#xff0c;微软举办主题为“办公新时代”的线上新品发布会&#xff0c;发布Surface Pro 10和Surface Laptop 6&#xff0c;新品将搭载基于英特尔酷睿Ultra或高通骁龙X Elite的处理器&#xff0c;配备新一代NPU&#xff0c;以增强AI性能。 这两款AI PC将支持“AI Exp…

土地利用的时序建模

1、LULC 模型的现状 最近的土地利用和土地覆盖 (LULC) 建模进展来自两种方法。 在一种方法中&#xff0c;现有模型适用于 LULC&#xff0c;而在另一种方法中&#xff0c;模型架构是针对 LULC 明确设计的。 随着大型基础模型的兴起&#xff0c;人工智能和深度学习取得了重大进…

数据结构 二叉树 力扣例题AC——代码以及思路记录

LCR 175. 计算二叉树的深 某公司架构以二叉树形式记录&#xff0c;请返回该公司的层级数。 AC int calculateDepth(struct TreeNode* root) {if (root NULL){return 0;}else{return 1 fmax(calculateDepth(root->left), calculateDepth(root->right));} } 代码思路 …

【Linux C | 多线程编程】线程的创建、线程ID、线程属性

&#x1f601;博客主页&#x1f601;&#xff1a;&#x1f680;https://blog.csdn.net/wkd_007&#x1f680; &#x1f911;博客内容&#x1f911;&#xff1a;&#x1f36d;嵌入式开发、Linux、C语言、C、数据结构、音视频&#x1f36d; ⏰发布时间⏰&#xff1a;2024-03-22 0…

SSC9211_USB-CAM解决方案

一、方案描述 SSC9211是一种用于USB-CAM应用程序跟场景的高度集成的SOC产品。平台本身基于ARM层-A7双核&#xff0c;内置16位&#xff0c;64M的DDR2&#xff0c;集成了图像传感器接口、高级ISP、高性能JPEG编码器和其他丰富的外设接口。支持单&#xff0c;双 MIPI sensor方案&…

H3C--堆叠(IRF)

拓扑图 配置流程 配置SW1与SW2堆叠 一、SW1&#xff1a; shutdown 物理端口配置堆叠优先级&#xff0c;优先级高的成为主设备创建堆叠逻辑接口&#xff0c;将物理接口加入到堆叠逻辑接口中 二、SW1&#xff1a; sysname SW1 # irf member 1 priority 6 # irf-port 1/1port…

基于时空上下文(STC)的运动目标跟踪算法,Matlab实现

博主简介&#xff1a; 专注、专一于Matlab图像处理学习、交流&#xff0c;matlab图像代码代做/项目合作可以联系&#xff08;QQ:3249726188&#xff09; 个人主页&#xff1a;Matlab_ImagePro-CSDN博客 原则&#xff1a;代码均由本人编写完成&#xff0c;非中介&#xff0c;提供…

windowsVMware虚拟机中扩展linux磁盘空间

1.虚拟磁盘扩容 VM中&#xff0c;关闭linux虚拟机&#xff0c;直接编辑虚拟机-硬盘-扩展磁盘容量 2.通过Gparted工具进行LINUX系统磁盘分区 未分区挂载前可以看到/挂载点下空间为20G&#xff1a; 通过虚拟机-快照-拍摄快照&#xff0c;操作前可拍摄快照&#xff08;便于恢复之前…

科技云报道:造完“大模型”,“具身智能”将引领AI下一个浪潮?

科技云报道原创。 资深机器人专家Eric Jang不久前曾预言&#xff1a;“ChatGPT 曾在一夜之间出现。我认为&#xff0c;有智慧的机器人技术也将如此。” 3月13日深夜&#xff0c;一段人形机器人的视频开始热传。 在视频中&#xff0c;Figure的人形机器人&#xff0c;可以完全…

基于java+springboot+vue实现的健身房管理系统(文末源码+Lw+ppt)23-523

摘 要 健身房管理的以往工作流程繁杂、多样、管理复杂与设备维护繁琐。而如今计算机已完全能够胜任健身房管理工作&#xff0c;而且更加准确、方便、快捷、高效、清晰、透明&#xff0c;它完全可以克服以上所述的不足之处。这将给查询信息和管理带来很大的方便&#xff0c;从…

从0写一个问卷调查APP的第13天-1

1.今日任务 我也只是一个大学生&#xff0c;有什么思路不对的地方给我指出来哟! 分析&#xff1a;上次我们实现了任务调查的插入。但是我们插入的问卷调查只有它的标题&#xff0c;也就是这个问卷调查是什么我们告诉数据库了&#xff0c;但是现在我们还没有给它添加任何问题&…

图片如何去除水印?试试这三款去水印工具!

在处理图片时&#xff0c;经常会遇到一个棘手的问题&#xff1a;水印。不论是想去除不美观的版权标记&#xff0c;还是希望消除图片上的杂物&#xff0c;一个好用的去水印工具都是必不可少的。今天&#xff0c;我们就为大家介绍三款功能强大、操作简便的图片去水印软件&#xf…

JavaScrpt学习笔记_一

一、Js编写位置 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>Title</title> <!-- 可以将js代码编写到外部js文件中&#xff0c;然后通过script标签引入写到外部文件中可以在不同页面中…

梦百合发布“正确睡眠观”,再次呼吁“别睡硬床”

3月21日“世界睡眠日”当天,MLILY梦百合召开了主题为“别睡硬床”的品牌发布会,梦百合家居董事长倪张根发布了一场线上主题演讲,普及睡硬床可能带来的危害,呼吁国人“别睡硬床!”,并发布“100万张硬床垫改造计划”,期望消费者通过从体验一张薄垫开始,从而逐步认识到睡硬床的危害…

1.C#对接微信Native支付(接入前准备)

在申请微信支付商户和微信公众号成功后&#xff0c;我们需要根据官方文档继续进行下一步操作。 1.申请appid和申请mchid 其实只要申请了支付商户和公众号那么这两个id就已经生成了。 我们在公众号管理端的微信支付中可以看到appid 在微信支付商户管理端中可以看到mchid 2…

20240316-1-向量化搜索

向量化搜索 在高维空间内快速搜索最近邻&#xff08;Approximate Nearest Neighbor&#xff09;。召回中&#xff0c;Embedding向量的搜索。 FAISS、kd-tree、局部敏感哈希、【Amnoy、HNSW】 FAISS faiss是Facebook的AI团队开源的一套用于做聚类或者相似性搜索的软件库&…

图中的边关系和节点关系之间的转换

图中的边关系和节点关系之间的转换 边关系转为图 在relation数组中记录的是从一个节点到一个节点&#xff0c;前面的就叫做from&#xff0c;后面的就叫做to&#xff0c;因此每次添加进节点关系的数组的时候&#xff0c;from就是数组索引&#xff0c;to就是需要加入的值。也就是…