Support downloading models from ModelScope Community. (#5073)

This PR supports downloading models from ModelScope. The main
modifications are as follows:
-New Feature (non-breaking change which adds functionality)
-Documentation Update

---------

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
yrk111222 2025-02-24 10:12:20 +08:00 committed by GitHub
parent 217caecfda
commit 7ce675030b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 30 additions and 3 deletions

View File

@ -295,6 +295,13 @@
"status": "1",
"llm": []
},
{
"name": "ModelScope",
"logo": "",
"tags": "LLM",
"status": "1",
"llm": []
},
{
"name": "LocalAI",
"logo": "",

View File

@ -35,6 +35,7 @@ A complete list of models supported by RAGFlow, which will continue to expand.
| LM-Studio | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
| MiniMax | :heavy_check_mark: | | | | | |
| Mistral | :heavy_check_mark: | :heavy_check_mark: | | | | |
| ModelScope | :heavy_check_mark: | | | | | |
| Moonshot | :heavy_check_mark: | | | :heavy_check_mark: | | |
| novita.ai | :heavy_check_mark: | | | | | |
| NVIDIA | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |

View File

@ -85,6 +85,7 @@ from .chat_model import (
GoogleChat,
HuggingFaceChat,
GPUStackChat,
ModelScopeChat,
)
from .cv_model import (
@ -231,6 +232,7 @@ ChatModel = {
"Google Cloud": GoogleChat,
"HuggingFace": HuggingFaceChat,
"GPUStack": GPUStackChat,
"ModelScope":ModelScopeChat,
}
RerankModel = {

View File

@ -143,6 +143,16 @@ class HuggingFaceChat(Base):
super().__init__(key, model_name.split("___")[0], base_url)
class ModelScopeChat(Base):
def __init__(self, key=None, model_name="", base_url=""):
if not base_url:
raise ValueError("Local llm url cannot be None")
base_url = base_url.rstrip('/')
if base_url.split("/")[-1] != "v1":
base_url = os.path.join(base_url, "v1")
super().__init__(key, model_name.split("___")[0], base_url)
class DeepSeekChat(Base):
def __init__(self, key, model_name="deepseek-chat", base_url="https://api.deepseek.com/v1"):
if not base_url:

View File

@ -0,0 +1 @@
<svg id="_层_2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 274.37 172.76"><defs><style>.cls-2{fill:#36cfd1}.cls-3{fill:#624aff}</style></defs><g id="_层_1-2"><path class="cls-3" d="M24.78 73.55h25.65V99.2H24.78zm99.14 25.66h25.65v25.65h-25.65zm76.95 25.65h-25.65v22.19h47.84V99.21h-22.19v25.65z"/><path class="cls-2" d="M149.57 73.55h25.65V99.2h-25.65zM24.78 47.9h25.65v25.65H24.78z"/><path class="cls-3" d="M223.06 73.55h25.65V99.2h-25.65z"/><path class="cls-2" d="M223.06 47.9h25.65v25.65h-25.65z"/><path class="cls-3" d="M175.22 25.71V47.9h25.65v25.65h22.19V25.71h-47.84z"/><path class="cls-2" d="M98.27 73.55h25.65V99.2H98.27z"/><path class="cls-3" d="M72.62 47.9h25.65V25.71H50.43v47.84h22.19V47.9zm0 51.31H50.43v47.84h47.84v-22.19H72.62V99.21z"/><path style="fill:none" d="M0 0h274.37v172.76H0z"/></g></svg>

After

Width:  |  Height:  |  Size: 821 B

View File

@ -33,6 +33,7 @@ export const IconMap = {
: 'wenxin',
Ollama: 'ollama',
Xinference: 'xinference',
ModelScope: 'modelscope',
DeepSeek: 'deepseek',
VolcEngine: 'volc_engine',
BaiChuan: 'baichuan',

View File

@ -32,6 +32,7 @@ export const LocalLlmFactories = [
'OpenRouter',
'HuggingFace',
'GPUStack',
'ModelScope',
];
export enum TenantRole {

View File

@ -21,6 +21,7 @@ const llmFactoryToUrlMap = {
Ollama:
'https://github.com/infiniflow/ragflow/blob/main/docs/guides/deploy_local_llm.mdx',
Xinference: 'https://inference.readthedocs.io/en/latest/user_guide',
ModelScope: 'https://www.modelscope.cn/docs/model-service/API-Inference/intro',
LocalAI: 'https://localai.io/docs/getting-started/models/',
'LM-Studio': 'https://lmstudio.ai/docs/basics',
'OpenAI-API-Compatible': 'https://platform.openai.com/docs/models/gpt-4',
@ -77,6 +78,9 @@ const OllamaModal = ({
{ value: 'speech2text', label: 'sequence2text' },
{ value: 'tts', label: 'tts' },
],
ModelScope: [
{ value: 'chat', label: 'chat' },
],
GPUStack: [
{ value: 'chat', label: 'chat' },
{ value: 'embedding', label: 'embedding' },