Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions en/development/models-integration/modelscope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Integrate Models from ModelScope

[ModelScope](https://www.modelscope.cn/my/overview) is an open source community for deep learning models and techenologies. ModelScope offers several ways to deploy models and provides backend services for Dify.

## ModelScope API service

ModelScope offers [SaaS API services](https://www.modelscope.cn/docs/model-service/API-Inference/intro) for users and can be configured in the web page.

Now we support Qwen series models and will be expanded to other important models as well in a short future. View the documentation link listed above to check the detail information.

There is also one way to support model deployment, which is [SwingDeploy](https://www.modelscope.cn/my/modelService/deploy). SwingDeploy is a way to deploy a model in Aliyun with your own quota. After deployment, this service is exclusive.

Both of these SaaS services offer standard OpenAI interfaces, and can be filled into the Dify ModelScope model page, and provide backend support for applications.

## SWIFT

[SWIFT](https://github.com/modelscope/ms-swift) is a framework provided by ModelScope. SWIFT is able to train and infer as many as 300+ pure text large language models and over 100 multi modal language models, which may cover most models that user need, like LLaMA/Qwen/Mistral/ChatGLM/DeepSeek series models. All models supported can be viewed [here](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%92%8C%E6%95%B0%E6%8D%AE%E9%9B%86.html).

SWIFT has several commands to support LLMs, like pt/sft/rlhf for training, infer/deploy for LLM inference, here we only introduce the deploy command which is able to deploy a model in your local env.

Please install SWIFT by:

```shell
pip install ms-swift[llm]
# if you are using mac:
# pip install "ms-swift[llm]"
```

Next you may use a command to run a deployment:

```shell
swift deploy --model Qwen/Qwen2.5-7B-Instruct --port 8000
```

Deploy a model is as simple as one command listed above.

SWIFT supports several infer backend, including pt(vanilla transformers generate), vLLM and LMDeploy.

you can switch these infer backend by:

```shell
swift deploy --model Qwen/Qwen2.5-7B-Instruct --port 8000 --infer_backend pt/vllm/lmdeploy
```

The documentation for deployment is [here](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%8E%A8%E7%90%86%E5%92%8C%E9%83%A8%E7%BD%B2.html#id4).

SWIFT offers a standard OpenAI interface, which is easy to be intergrated into Kubernates or Docker. Just fill in the model name `Qwen2.5-7B-Instruct` and the OpenAI url into the ModelScope model provider, you can use SWIFT for Dify.
9 changes: 9 additions & 0 deletions en/getting-started/readme/model-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ Dify supports the below model providers out-of-box:
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td align="center">ModelScope</td>
<td align="center">✔️</td>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td align="center">Xorbits inference</td>
<td align="center">✔️</td>
Expand Down Expand Up @@ -386,6 +394,7 @@ Dify supports the below model providers out-of-box:
</tbody>
</table>


where (🛠️) ︎ denotes "function calling" and (👓) denotes "support for vision".

---
Expand Down
47 changes: 47 additions & 0 deletions jp/development/models-integration/modelscope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# モダ(ModelScope)コミュニティのモデルサービス

[モダ(ModelScope)](https://www.modelscope.cn/my/overview)は、深層学習モデルと技術に特化したオープンソースコミュニティです。モダは、さまざまなモデル展開方法とDifyとの連携を提供しています。

## モダAPIサービス

モダは、さまざまなニーズを持つユーザー向けに[APIサービス](https://www.modelscope.cn/docs/model-service/API-Inference/intro)を提供しています。このサービスは、ページ上で設定可能であり、SaaS形式で提供されています。

現在、Qwenシリーズモデルのサービスをサポートしており、今後は他の主要なモデルにも対応を拡大する予定です。最新の進捗やサービスの利用方法については、上記のドキュメントをご覧ください。

モデルサービスを利用するもう一つの方法は、[SwingDeploy](https://www.modelscope.cn/my/modelService/deploy)です。SwingDeployは、ユーザーが自己負担でAlibaba Cloud上にモデルを展開する専用サービスです。

これらの2つのソリューションはどちらも標準的なOpenAIインターフェースを提供しており、Difyのモダモデルサービス画面に簡単に統合できるため、便利なモデルバックエンドサポートを提供します。

## SWIFT

[SWIFT](https://github.com/modelscope/ms-swift)は、モダコミュニティが開発したオープンソースフレームワークであり、300以上のテキスト生成モデルおよび100以上のマルチモーダルモデルに対して、トレーニングや推論・展開の能力を提供します。これらのモデルは、LLaMA/Qwen/Mistral/ChatGLM/DeepSeekなど、多くのシリーズモデルを含み、利用者のニーズに応じた大部分のモデルを網羅しています。モデルのリストについては[こちら](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%92%8C%E6%95%B0%E6%8D%AE%E9%9B%86.html)をご覧ください。

SWIFTでは、大規模モデル向けに便利なコマンドを数多く提供しています。例えば、トレーニング用の`pt/sft/rlhf`や、推論用の`infer/deploy`などです。ここでは、Difyと連携するための`deploy`機能を利用したローカル展開について説明します。

以下のコマンドを実行してSWIFTをインストールします:

```shell
pip install ms-swift[llm]
# macを使用している場合:
# pip install "ms-swift[llm]"
```

続いて、展開を実行します:

```shell
swift deploy --model Qwen/Qwen2.5-7B-Instruct --port 8000
```

展開機能は、上記の1つのコマンドで簡単に起動できます。

SWIFTは、複数の推論加速フレームワークをサポートしており、`pt`(ネイティブtransformers)、`vLLM`、`LMDeploy`が含まれます。

これらの推論加速フレームワークを切り替えることも可能です:

```shell
swift deploy --model Qwen/Qwen2.5-7B-Instruct --port 8000 --infer_backend pt/vllm/lmdeploy
```

推論に関する詳細なドキュメントは[こちら](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%8E%A8%E7%90%86%E5%92%8C%E9%83%A8%E7%BD%B2.html#id4)をご覧ください。

SWIFTは、標準的なOpenAIインターフェースを提供しており、KubernetesやDockerなどのエンジニアリング環境への統合が容易です。Difyのモダモデルサービス画面にモデル名`Qwen2.5-7B-Instruct`とOpenAI URLを入力するだけで、Dify内でSWIFTのモデルサービスを利用できます。
8 changes: 8 additions & 0 deletions jp/getting-started/readme/model-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ Difyは以下のモデルプロバイダーをサポートしています:
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td align="center">ModelScope</td>
<td align="center">✔️</td>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td align="center">Xorbits inference</td>
<td align="center">✔️</td>
Expand Down
47 changes: 47 additions & 0 deletions zh_CN/development/models-integration/modelscope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 魔搭社区的模型服务

[魔搭](https://www.modelscope.cn/my/overview)是一个针对深度学习模型和技术的开源社区,魔搭提供了多种模型部署方式和Dify进行结合。

## 魔搭API服务

魔搭提供了[API服务](https://www.modelscope.cn/docs/model-service/API-Inference/intro)给不同需求的用户。该服务可以从页面配置,它是SaaS化的。

目前我们支持了Qwen系列模型的服务,并很快会扩展到其他重要模型上。查看上述列出的文档来关注我们的最新进度以及如何使用该服务。

另一个支持模型服务的方法是[SwingDeploy](https://www.modelscope.cn/my/modelService/deploy)。SwingDeploy是一个用户自行付费在阿里云上执行模型部署的方式,它的服务是独占式的。

上述两个方案都提供了标准OpenAI接口,因此很容易填入Dify的魔搭模型服务界面中,并提供便捷的模型后台支持。

## SWIFT

[SWIFT](https://github.com/modelscope/ms-swift)是魔搭社区开发的开源框架,主要能力是针对300+纯文本大模型和100+多模态大模型提供训练和推理部署能力。这些模型涵盖了用户需要的绝大多数模型,例如LLaMA/Qwen/Mistral/ChatGLM/DeepSeek众多系列模型,这些模型列表可以查看[这里](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%92%8C%E6%95%B0%E6%8D%AE%E9%9B%86.html).

SWIFT针对大模型提供了众多便捷命令,例如针对训练的pt/sft/rlhf,以及针对推理的infer/deploy,在这里我们仅介绍和Dify进行结合的deploy能力来执行本地化部署。

执行下面的命令安装SWIFT:

```shell
pip install ms-swift[llm]
# if you are using mac:
# pip install "ms-swift[llm]"
```

接下来执行部署:

```shell
swift deploy --model Qwen/Qwen2.5-7B-Instruct --port 8000
```

部署能力仅通过上述一个命令就可以启动起来。

SWIFT支持多种推理加速框架,包含了pt(原生transformers),vLLM和LMDeploy。

你可以切换使用这些推理加速框架:

```shell
swift deploy --model Qwen/Qwen2.5-7B-Instruct --port 8000 --infer_backend pt/vllm/lmdeploy
```

推理文档可以参考[这里](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%8E%A8%E7%90%86%E5%92%8C%E9%83%A8%E7%BD%B2.html#id4).

SWIFT提供了标准的OpenAI接口服务,方便集成在Kubernates或Docker等工程环境中。只需要填入模型名称`Qwen2.5-7B-Instruct`以及OpenAI url到Dify的魔搭模型服务界面中,即可在Dify中使用SWIFT的模型服务。
8 changes: 8 additions & 0 deletions zh_CN/getting-started/readme/model-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ Dify 为以下模型提供商提供原生支持:
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td align="center">魔搭社区</td>
<td align="center">✔️</td>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td align="center">Xorbits inference</td>
<td align="center">✔️</td>
Expand Down