Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
@@ -5,7 +5,167 @@ colorFrom: green
|
|
5 |
colorTo: red
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
8 |
---
|
9 |
|
10 |
-
https://modelscope.cn/
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
colorTo: red
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
license: apache-2.0
|
9 |
---
|
10 |
|
|
|
11 |
|
12 |
+
# Introduction
|
13 |
+
|
14 |
+
[ModelScope]( https://www.modelscope.cn) is built upon the notion of “Model-as-a-Service” (MaaS). It seeks to bring together most advanced machine learning models from the AI community, and streamlines the process of leveraging AI models in real-world applications. The core ModelScope library open-sourced in this repository provides the interfaces and implementations that allow developers to perform model inference, training and evaluation.
|
15 |
+
|
16 |
+
|
17 |
+
In particular, with rich layers of API-abstraction, the ModelScope library offers unified experience to explore state-of-the-art models spanning across domains such as CV, NLP, Speech, Multi-Modality, and Scientific-computation. Model contributors of different areas can integrate models into the ModelScope ecosystem through the layered-APIs, allowing easy and unified access to their models. Once integrated, model inference, fine-tuning, and evaluations can be done with only a few lines of codes. In the meantime, flexibilities are also provided so that different components in the model applications can be customized wherever necessary.
|
18 |
+
|
19 |
+
Apart from harboring implementations of a wide range of different models, ModelScope library also enables the necessary interactions with ModelScope backend services, particularly with the Model-Hub and Dataset-Hub. Such interactions facilitate management of various entities (models and datasets) to be performed seamlessly under-the-hood, including entity lookup, version control, cache management, and many others.
|
20 |
+
|
21 |
+
# Models and Online Accessibility
|
22 |
+
|
23 |
+
Hundreds of models are made publicly available on [ModelScope]( https://www.modelscope.cn) (700+ and counting), covering the latest development in areas such as NLP, CV, Audio, Multi-modality, and AI for Science, etc. Many of these models represent the SOTA in their specific fields, and made their open-sourced debut on ModelScope. Users can visit ModelScope([modelscope.cn](http://www.modelscope.cn)) and experience first-hand how these models perform via online experience, with just a few clicks. Immediate developer-experience is also possible through the ModelScope Notebook, which is backed by ready-to-use CPU/GPU development environment in the cloud - only one click away on [ModelScope](https://www.modelscope.cn).
|
24 |
+
|
25 |
+
|
26 |
+
<p align="center">
|
27 |
+
<br>
|
28 |
+
<img src="data/resource/inference.gif" width="1024"/>
|
29 |
+
<br>
|
30 |
+
<p>
|
31 |
+
|
32 |
+
Some representative examples include:
|
33 |
+
|
34 |
+
NLP:
|
35 |
+
|
36 |
+
* [nlp_gpt3_text-generation_2.7B](https://modelscope.cn/models/damo/nlp_gpt3_text-generation_2.7B)
|
37 |
+
|
38 |
+
* [ChatYuan-large](https://modelscope.cn/models/ClueAI/ChatYuan-large)
|
39 |
+
|
40 |
+
* [mengzi-t5-base](https://modelscope.cn/models/langboat/mengzi-t5-base)
|
41 |
+
|
42 |
+
* [nlp_csanmt_translation_en2zh](https://modelscope.cn/models/damo/nlp_csanmt_translation_en2zh)
|
43 |
+
|
44 |
+
* [nlp_raner_named-entity-recognition_chinese-base-news](https://modelscope.cn/models/damo/nlp_raner_named-entity-recognition_chinese-base-news)
|
45 |
+
|
46 |
+
* [nlp_structbert_word-segmentation_chinese-base](https://modelscope.cn/models/damo/nlp_structbert_word-segmentation_chinese-base)
|
47 |
+
|
48 |
+
* [Erlangshen-RoBERTa-330M-Sentiment](https://modelscope.cn/models/fengshenbang/Erlangshen-RoBERTa-330M-Sentiment)
|
49 |
+
|
50 |
+
* [nlp_convai_text2sql_pretrain_cn](https://modelscope.cn/models/damo/nlp_convai_text2sql_pretrain_cn)
|
51 |
+
|
52 |
+
Multi-Modal:
|
53 |
+
|
54 |
+
* [multi-modal_clip-vit-base-patch16_zh](https://modelscope.cn/models/damo/multi-modal_clip-vit-base-patch16_zh)
|
55 |
+
|
56 |
+
* [ofa_pretrain_base_zh](https://modelscope.cn/models/damo/ofa_pretrain_base_zh)
|
57 |
+
|
58 |
+
* [Taiyi-Stable-Diffusion-1B-Chinese-v0.1](https://modelscope.cn/models/fengshenbang/Taiyi-Stable-Diffusion-1B-Chinese-v0.1)
|
59 |
+
|
60 |
+
* [mplug_visual-question-answering_coco_large_en](https://modelscope.cn/models/damo/mplug_visual-question-answering_coco_large_en)
|
61 |
+
|
62 |
+
CV:
|
63 |
+
|
64 |
+
* [cv_controlnet_controllable-image-generation_nine-annotators](https://modelscope.cn/models/dienstag/cv_controlnet_controllable-image-generation_nine-annotators/summary)
|
65 |
+
|
66 |
+
* [cv_tinynas_object-detection_damoyolo](https://modelscope.cn/models/damo/cv_tinynas_object-detection_damoyolo)
|
67 |
+
|
68 |
+
* [cv_unet_person-image-cartoon_compound-models](https://modelscope.cn/models/damo/cv_unet_person-image-cartoon_compound-models)
|
69 |
+
|
70 |
+
* [cv_convnextTiny_ocr-recognition-general_damo](https://modelscope.cn/models/damo/cv_convnextTiny_ocr-recognition-general_damo)
|
71 |
+
|
72 |
+
* [cv_resnet18_human-detection](https://modelscope.cn/models/damo/cv_resnet18_human-detection)
|
73 |
+
|
74 |
+
* [cv_resnet50_face-detection_retinaface](https://modelscope.cn/models/damo/cv_resnet50_face-detection_retinaface)
|
75 |
+
|
76 |
+
* [cv_unet_image-matting](https://modelscope.cn/models/damo/cv_unet_image-matting)
|
77 |
+
|
78 |
+
* [cv_F3Net_product-segmentation](https://modelscope.cn/models/damo/cv_F3Net_product-segmentation)
|
79 |
+
|
80 |
+
* [cv_resnest101_general_recognition](https://modelscope.cn/models/damo/cv_resnest101_general_recognition)
|
81 |
+
|
82 |
+
|
83 |
+
Audio:
|
84 |
+
|
85 |
+
* [speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch)
|
86 |
+
|
87 |
+
* [speech_sambert-hifigan_tts_zh-cn_16k](https://modelscope.cn/models/damo/speech_sambert-hifigan_tts_zh-cn_16k)
|
88 |
+
|
89 |
+
* [speech_charctc_kws_phone-xiaoyun](https://modelscope.cn/models/damo/speech_charctc_kws_phone-xiaoyun)
|
90 |
+
|
91 |
+
* [u2pp_conformer-asr-cn-16k-online](https://modelscope.cn/models/wenet/u2pp_conformer-asr-cn-16k-online)
|
92 |
+
|
93 |
+
* [speech_frcrn_ans_cirm_16k](https://modelscope.cn/models/damo/speech_frcrn_ans_cirm_16k)
|
94 |
+
|
95 |
+
* [speech_dfsmn_aec_psm_16k](https://modelscope.cn/models/damo/speech_dfsmn_aec_psm_16k)
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
AI for Science:
|
100 |
+
|
101 |
+
* [uni-fold-monomer](https://modelscope.cn/models/DPTech/uni-fold-monomer/summary)
|
102 |
+
|
103 |
+
* [uni-fold-multimer](https://modelscope.cn/models/DPTech/uni-fold-multimer/summary)
|
104 |
+
|
105 |
+
**Note:** Most models on ModelScope are public and can be downloaded without account registration on modelscope website([www.modelscope.cn](www.modelscope.cn)), please refer to instructions for [model download](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E4%B8%8B%E8%BD%BD), for dowloading models with api provided by modelscope library or git.
|
106 |
+
|
107 |
+
# QuickTour
|
108 |
+
|
109 |
+
We provide unified interface for inference using `pipeline`, fine-tuning and evaluation using `Trainer` for different tasks.
|
110 |
+
|
111 |
+
For any given task with any type of input (image, text, audio, video...), inference pipeline can be implemented with only a few lines of code, which will automatically load the underlying model to get inference result, as is exemplified below:
|
112 |
+
|
113 |
+
```python
|
114 |
+
>>> from modelscope.pipelines import pipeline
|
115 |
+
>>> word_segmentation = pipeline('word-segmentation',model='damo/nlp_structbert_word-segmentation_chinese-base')
|
116 |
+
>>> word_segmentation('今天天气不错,适合出去游玩')
|
117 |
+
{'output': '今天 天气 不错 , 适合 出去 游玩'}
|
118 |
+
```
|
119 |
+
|
120 |
+
Given an image, portrait matting (aka. background-removal) can be accomplished with the following code snippet:
|
121 |
+
|
122 |
+

|
123 |
+
|
124 |
+
```python
|
125 |
+
>>> import cv2
|
126 |
+
>>> from modelscope.pipelines import pipeline
|
127 |
+
|
128 |
+
>>> portrait_matting = pipeline('portrait-matting')
|
129 |
+
>>> result = portrait_matting('https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/image_matting.png')
|
130 |
+
>>> cv2.imwrite('result.png', result['output_img'])
|
131 |
+
```
|
132 |
+
|
133 |
+
The output image with the background removed is:
|
134 |
+

|
135 |
+
|
136 |
+
|
137 |
+
Fine-tuning and evaluation can also be done with a few more lines of code to set up training dataset and trainer, with the heavy-lifting work of training and evaluation a model encapsulated in the implementation of `traner.train()` and
|
138 |
+
`trainer.evaluate()` interfaces.
|
139 |
+
|
140 |
+
For example, the gpt3 base model (1.3B) can be fine-tuned with the chinese-poetry dataset, resulting in a model that can be used for chinese-poetry generation.
|
141 |
+
|
142 |
+
```python
|
143 |
+
>>> from modelscope.metainfo import Trainers
|
144 |
+
>>> from modelscope.msdatasets import MsDataset
|
145 |
+
>>> from modelscope.trainers import build_trainer
|
146 |
+
|
147 |
+
>>> train_dataset = MsDataset.load('chinese-poetry-collection', split='train'). remap_columns({'text1': 'src_txt'})
|
148 |
+
>>> eval_dataset = MsDataset.load('chinese-poetry-collection', split='test').remap_columns({'text1': 'src_txt'})
|
149 |
+
>>> max_epochs = 10
|
150 |
+
>>> tmp_dir = './gpt3_poetry'
|
151 |
+
|
152 |
+
>>> kwargs = dict(
|
153 |
+
model='damo/nlp_gpt3_text-generation_1.3B',
|
154 |
+
train_dataset=train_dataset,
|
155 |
+
eval_dataset=eval_dataset,
|
156 |
+
max_epochs=max_epochs,
|
157 |
+
work_dir=tmp_dir)
|
158 |
+
|
159 |
+
>>> trainer = build_trainer(name=Trainers.gpt3_trainer, default_args=kwargs)
|
160 |
+
>>> trainer.train()
|
161 |
+
```
|
162 |
+
|
163 |
+
# Why should I use ModelScope library
|
164 |
+
|
165 |
+
1. A unified and concise user interface is abstracted for different tasks and different models. Model inferences and training can be implemented by as few as 3 and 10 lines of code, respectively. It is convenient for users to explore models in different fields in the ModelScope community. All models integrated into ModelScope are ready to use, which makes it easy to get started with AI, in both educational and industrial settings.
|
166 |
+
|
167 |
+
2. ModelScope offers a model-centric development and application experience. It streamlines the support for model training, inference, export and deployment, and facilitates users to build their own MLOps based on the ModelScope ecosystem.
|
168 |
+
|
169 |
+
3. For the model inference and training process, a modular design is put in place, and a wealth of functional module implementations are provided, which is convenient for users to customize their own model inference, training and other processes.
|
170 |
+
|
171 |
+
4. For distributed model training, especially for large models, it provides rich training strategy support, including data parallel, model parallel, hybrid parallel and so on.
|