modelscope /modelscope
ModelScope: bring the notion of Model-as-a-Service to life.
★ 9,218⑂ 977👁 79⑃ 856● 972▤ 80
+4
日增长
9,218
stars
977
forks
79
watchers
856
prs
972
issues
80
releases
README
Discord
English |
中文 |
日本語
简介
ModelScope 是一个 “模型即服务”(MaaS) 平台,旨在汇集来自 AI 社区的最先进的机器学习模型,并简化在实际应用中使用 AI 模型的流程。ModelScope 库使开发人员能够通过丰富的 API 设计执行推理、训练和评估,从而促进跨不同 AI 领域的最先进模型的统一体验。
ModelScope Library 为模型贡献者提供了必要的分层 API,以便将来自 CV、NLP、语音、多模态以及科学计算的模型集成到 ModelScope 生态系统中。所有这些不同模型的实现都以一种简单统一访问的方式进行封装,用户只需几行代码即可完成模型推理、微调和评估。同时,灵活的模块化设计使得在必要时也可以自定义模型训练推理过程中的不同组件。
除了包含各种模型的实现之外,ModelScope Library 还支持与 ModelScope 后端服务进行必要的交互,特别是与 Model-Hub 和 Dataset-Hub 的交互。这种交互促进了模型和数据集的管理在后台无缝执行,包括模型数据集查询、版本控制、缓存管理等。
部分模型和在线体验
ModelScope 开源了数百个 (当前 700+) 模型,涵盖自然语言处理、计算机视觉、语音、多模态、科学计算等,其中包含数百个 SOTA 模型。用户可以进入 ModelScope 网站 (modelscope.cn) 的模型中心零门槛在线体验,或者 Notebook 方式体验模型。
示例如下:
大模型:
Yi-1.5-34B-Chat
Qwen1.5-110B-Chat
DeepSeek-V2-Chat
Ziya2-13B-Chat
Meta-Llama-3-8B-Instruct
Phi-3-mini-128k-instruct
多模态:
Qwen-VL-Chat
Yi-VL-6B
InternVL-Chat-V1-5
deepseek-vl-7b-chat
OpenSoraPlan
OpenSora
I2VGen-XL
计算机视觉:
DamoFD 人脸检测关键点模型-0.5G
BSHM 人像抠图
DCT-Net 人像卡通化-3D
DCT-Net 人像卡通化模型-3D
读光-文字识别-行识别模型-中英-通用领域
读光-文字识别-行识别模型-中英-通用领域
LaMa 图像填充
语音:
Paraformer 语音识别-中文-通用-16k-离线-大型-长音频版本
FSMN 声音端点检测-中文-通用-16k-onnx
Monotonic-Aligner 语音时间戳预测-16k-离线
CT-Transformer 标点-中文-通用-onnx
语音合成-中文-多情绪领域-16k-多发言人
CAM++ 说话人验证-中文-通用-200k-发言人
科学计算:
Uni-Fold-Monomer 开源的蛋白质单体结构预测模型
Uni-Fold-Multimer 开源的蛋白质复合物结构预测模型
快速上手
我们针对不同任务提供了统一的使用接口, 使用 pipeline 进行模型推理、使用 Trainer 进行微调和评估。
对于任意类型输入(图像、文本、音频、视频...)的任何任务,只需 3 行代码即可加载模型并获得推理结果,如下所示:
python
from modelscope.pipelines import pipeline
word_segmentation = pipeline ('word-segmentation',model='damo/nlp_structbert_word-segmentation_chinese-base')
word_segmentation (' 今天天气不错,适合出去游玩 ')
{'output': ' 今天 天气 不错 , 适合 出去 游玩 '}
给定一张图片,你可以使用如下代码进行人像抠图.
!image
python
import cv2
from modelscope.pipelines import pipeline
portrait_matting = pipeline ('portrait-matting')
result = portrait_matting ('https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/image_matting.png')
cv2.imwrite ('result.png', result ['output_img'])
输出图像如下
!image
对于微调和评估模型, 你需要通过十多行代码构建 dataset 和 trainer,调用 trainer.train () 和 trainer.evaluate () 即可。
例如我们利用 gpt3 1.3B 的模型,加载是诗歌数据集进行 finetune,可以完成古诗生成模型的训练。
python
from modelscope.metainfo import Trainers
from modelscope.msdatasets import MsDataset
from modelscope.trainers import build_trainer
train_dataset = MsDataset.load ('chinese-poetry-collection', split='train'). remap_columns ({'text1': 'src_txt'})
eval_dataset = MsDataset.load ('chinese-poetry-collection', split='test').remap_columns ({'text1': 'src_txt'})
max_epochs = 10
tmp_dir = './gpt3_poetry'
kwargs = dict (
model='damo/nlp_gpt3_text-generation_1.3B',
train_dataset=train_dataset,
eval_dataset=eval_dataset,
max_epochs=max_epochs,
work_dir=tmp_dir)
trainer = build_trainer (name=Trainers.gpt3_trainer, default_args=kwargs)
trainer.train ()
为什么要用 ModelScope Library
1. 针对不同任务、不同模型抽象了统一简洁的用户接口,3 行代码完成推理,10 行代码完成模型训练,方便用户使用 MoTop issues
#1658ModelScope于llama.cpp集成无法使用14 comments · 2026-03-27#1809MCP 广场:外部 OAuth Streamable HTTP 服务配置后仍不可部署、未提供工具信息4 comments · 2026-10-05#1842关于 model scope 的API 推理接口是否已支持了音频推理?3 comments · 2026-11-04#1828Mirror of `kernels-community/*` stopped syncing, and has no kernel version branches3 comments · 2026-10-23#18262560x1600分辨率电脑edge打开设计师(AIGC)模板样式个人主页,页面顶端抽动会让CPU/GPU占用率飙升3 comments · 2026-10-22#1822ModelScope绑定的阿里云PAI默认工作空间误删除问题2 comments · 2026-10-14#1849创空间免费 16G CPU(platform/2v-cpu-16g-mem)重新部署后一直「部署中」,ossfs 挂载后应用进程从未启动1 comments · 2026-11-10#1827创空间仓库不小心推了几个无用分支,发现无权限删除1 comments · 2026-10-22
Discussions
#1605You have CSAM on your site1 comments · 2026-02-03#1536如何创建或者下载mcp bundle0 comments · 2025-11-01#1523魔搭的网站出什么Bug了,一点击“模型文件”按钮,就Error页2 comments · 2025-10-11#1387页面有bug点击执行跨域了1 comments · 2025-06-28#1322运行qwen2.5-vl-3b-instrcut-awq时,报错:ImportError: cannot import name 'shard_checkpoint' from 'transformers.modeling_utils' (C:\Users\long\PycharmProjects\qwenvl\.venv\lib\site-packages\transformers\modeling_utils.py)0 comments · 2025-04-25#1310change iotdb-mcp-server, use apache version1 comments · 2025-04-15#1309Add New MCP Server in MCP Square1 comments · 2025-04-15#1295为什么 Qwen2.5-Omni-7B 官方教程都报错 Cannot import available module of Qwen2_5OmniModel in modelscope ?1 comments · 2025-04-02
Latest release
v1.40.3 v1.40.3 2026-11-09Enhance - Requires modelscope-hub=0.7.0. - New modelscope.utils.file_utils.get_hub_cache_root(); modelscope.hub.cache_manager re-exports get_cache_root and resolve_cached_snapshot. MS_CACHE_HOME is normalised to an absolute path when bridged into the hub config. Fix - model_file_download(..., local_files_only=True) no longer calls the API to resolve the default revision, so offline downloads from cache work without network access or credentials. - ms clear-cache lists every resolved target before deleting and delegates to modelscope-hub's scoped cache APIs; cache deletion via FileSystem