From 39bf232fe4f10348fdbbb0674acbb7c390c8e051 Mon Sep 17 00:00:00 2001 From: Minamiyama Date: Mon, 24 Feb 2025 01:57:37 +0800 Subject: [PATCH 1/5] github in model card, and open in new --- xinference/model/llm/llm_family.json | 3 ++ xinference/model/llm/llm_family.py | 1 + .../ui/src/scenes/launch_model/modelCard.js | 31 +++++++++++++++++-- .../launch_model/styles/modelCardStyle.css | 6 ++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/xinference/model/llm/llm_family.json b/xinference/model/llm/llm_family.json index b1fe58b1d8..c86cfa67f8 100644 --- a/xinference/model/llm/llm_family.json +++ b/xinference/model/llm/llm_family.json @@ -6784,6 +6784,7 @@ "chat", "vision" ], + "model_repository": "https://github.com/OpenGVLab/InternVL", "model_description": "InternVL 2.5 is an open-source multimodal large language model (MLLM) to bridge the capability gap between open-source and proprietary commercial models in multimodal understanding. ", "model_specs": [ { @@ -7282,6 +7283,7 @@ "chat", "vision" ], + "model_repository": "https://github.com/QwenLM/Qwen2.5-VL", "model_description":"Qwen2.5-VL: Qwen2.5-VL is the latest version of the vision language models in the Qwen model familities.", "model_specs":[ { @@ -7775,6 +7777,7 @@ "chat", "reasoning" ], + "model_repository": "https://github.com/deepseek-ai/DeepSeek-R1", "model_description": "DeepSeek-R1, which incorporates cold-start data before RL. DeepSeek-R1 achieves performance comparable to OpenAI-o1 across math, code, and reasoning tasks.", "model_specs": [ { diff --git a/xinference/model/llm/llm_family.py b/xinference/model/llm/llm_family.py index cd95440e55..6267f507c2 100644 --- a/xinference/model/llm/llm_family.py +++ b/xinference/model/llm/llm_family.py @@ -136,6 +136,7 @@ class LLMFamilyV1(BaseModel): model_ability: List[ Literal["embed", "generate", "chat", "tools", "vision", "audio", "reasoning"] ] + model_repository: Optional[str] model_description: Optional[str] # reason for not required str here: legacy registration model_family: Optional[str] diff --git a/xinference/web/ui/src/scenes/launch_model/modelCard.js b/xinference/web/ui/src/scenes/launch_model/modelCard.js index bb3a547ce5..e8555d3851 100644 --- a/xinference/web/ui/src/scenes/launch_model/modelCard.js +++ b/xinference/web/ui/src/scenes/launch_model/modelCard.js @@ -9,9 +9,11 @@ import { EditNoteOutlined, ExpandLess, ExpandMore, + GitHub, Grade, HelpCenterOutlined, HelpOutline, + OpenInNew, RocketLaunchOutlined, StarBorder, UndoOutlined, @@ -287,8 +289,8 @@ const ModelCard = ({ parseInt(nGPU, 10) === 0 || nGPU === 'CPU' ? null : nGPU === 'auto' - ? 'auto' - : parseInt(nGPU, 10), + ? 'auto' + : parseInt(nGPU, 10), replica: replica, request_limits: String(requestLimits)?.trim() === '' @@ -968,6 +970,31 @@ const ModelCard = ({ {t('launchModel.contextLength')} + {(() => { + if (modelData.model_repository) { + return ( +
{ + event.stopPropagation() + window.open(modelData.model_repository, '_blank') + }} + > + + + GitHub + + +
+ ) + } + })()} {(() => { if ( modelData.model_ability && diff --git a/xinference/web/ui/src/scenes/launch_model/styles/modelCardStyle.css b/xinference/web/ui/src/scenes/launch_model/styles/modelCardStyle.css index 93f536b0a2..cf6d21b4c1 100644 --- a/xinference/web/ui/src/scenes/launch_model/styles/modelCardStyle.css +++ b/xinference/web/ui/src/scenes/launch_model/styles/modelCardStyle.css @@ -108,7 +108,7 @@ display: flex; flex-direction: column; align-items: center; - margin: 20px; + margin: 20px 10px; } .boldIconText { font-weight: bold; @@ -208,7 +208,9 @@ left: 0; visibility: hidden; opacity: 0; - transition: visibility 0.3s ease, opacity 0.3s ease; + transition: + visibility 0.3s ease, + opacity 0.3s ease; } .drawer.open { visibility: visible; From 7d6ebe943a3d43bbc9250a4e59e44fdeea42f3c1 Mon Sep 17 00:00:00 2001 From: Minamiyama Date: Mon, 24 Feb 2025 02:40:19 +0800 Subject: [PATCH 2/5] prettier --- .../web/ui/src/scenes/register_model/registerModel.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xinference/web/ui/src/scenes/register_model/registerModel.js b/xinference/web/ui/src/scenes/register_model/registerModel.js index 0a48c67213..662eda2605 100644 --- a/xinference/web/ui/src/scenes/register_model/registerModel.js +++ b/xinference/web/ui/src/scenes/register_model/registerModel.js @@ -911,8 +911,8 @@ const RegisterModelComponent = ({ modelType, customData }) => { ? '#d32f2f' : 'inherit' : formData.language.length === 0 - ? '#d32f2f' - : 'inherit', + ? '#d32f2f' + : 'inherit', }} > {t('registerModel.modelLanguages')} @@ -1182,8 +1182,8 @@ const RegisterModelComponent = ({ modelType, customData }) => { {testErrorInfo !== '' ? testErrorInfo : testRes - ? testRes - : t('registerModel.noTestResults')} + ? testRes + : t('registerModel.noTestResults')} From 570d20e0c66573424fcd2bea5cfd96e9502555f3 Mon Sep 17 00:00:00 2001 From: Minamiyama Date: Mon, 24 Feb 2025 11:54:25 +0800 Subject: [PATCH 3/5] prettier --- xinference/web/ui/src/scenes/launch_model/modelCard.js | 4 ++-- .../ui/src/scenes/launch_model/styles/modelCardStyle.css | 4 +--- .../web/ui/src/scenes/register_model/registerModel.js | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/xinference/web/ui/src/scenes/launch_model/modelCard.js b/xinference/web/ui/src/scenes/launch_model/modelCard.js index e8555d3851..fc1aef2f58 100644 --- a/xinference/web/ui/src/scenes/launch_model/modelCard.js +++ b/xinference/web/ui/src/scenes/launch_model/modelCard.js @@ -289,8 +289,8 @@ const ModelCard = ({ parseInt(nGPU, 10) === 0 || nGPU === 'CPU' ? null : nGPU === 'auto' - ? 'auto' - : parseInt(nGPU, 10), + ? 'auto' + : parseInt(nGPU, 10), replica: replica, request_limits: String(requestLimits)?.trim() === '' diff --git a/xinference/web/ui/src/scenes/launch_model/styles/modelCardStyle.css b/xinference/web/ui/src/scenes/launch_model/styles/modelCardStyle.css index cf6d21b4c1..1882db10d0 100644 --- a/xinference/web/ui/src/scenes/launch_model/styles/modelCardStyle.css +++ b/xinference/web/ui/src/scenes/launch_model/styles/modelCardStyle.css @@ -208,9 +208,7 @@ left: 0; visibility: hidden; opacity: 0; - transition: - visibility 0.3s ease, - opacity 0.3s ease; + transition: visibility 0.3s ease, opacity 0.3s ease; } .drawer.open { visibility: visible; diff --git a/xinference/web/ui/src/scenes/register_model/registerModel.js b/xinference/web/ui/src/scenes/register_model/registerModel.js index 662eda2605..0a48c67213 100644 --- a/xinference/web/ui/src/scenes/register_model/registerModel.js +++ b/xinference/web/ui/src/scenes/register_model/registerModel.js @@ -911,8 +911,8 @@ const RegisterModelComponent = ({ modelType, customData }) => { ? '#d32f2f' : 'inherit' : formData.language.length === 0 - ? '#d32f2f' - : 'inherit', + ? '#d32f2f' + : 'inherit', }} > {t('registerModel.modelLanguages')} @@ -1182,8 +1182,8 @@ const RegisterModelComponent = ({ modelType, customData }) => { {testErrorInfo !== '' ? testErrorInfo : testRes - ? testRes - : t('registerModel.noTestResults')} + ? testRes + : t('registerModel.noTestResults')} From 6fbb8d6a1617d520d95b6eee5e38ef84c78cc572 Mon Sep 17 00:00:00 2001 From: Minamiyama Date: Mon, 24 Feb 2025 17:59:14 +0800 Subject: [PATCH 4/5] for test --- xinference/model/llm/tests/test_llm_family.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xinference/model/llm/tests/test_llm_family.py b/xinference/model/llm/tests/test_llm_family.py index 86677917d4..b58dd7eba7 100644 --- a/xinference/model/llm/tests/test_llm_family.py +++ b/xinference/model/llm/tests/test_llm_family.py @@ -136,7 +136,7 @@ def test_serialize_llm_family_v1(): stop=["hello", "world"], ) - expected = """{"version": 1, "context_length": 2048, "model_name": "TestModel", "model_lang": ["en"], "model_ability": ["embed", "generate"], "model_description": null, "model_family": null, "model_specs": [{"model_format": "ggufv2", "model_hub": "huggingface", "model_size_in_billions": 2, "quantizations": ["q4_0", "q4_1"], "quantization_parts": {"q4_2": ["a", "b"]}, "model_id": "example/TestModel", "model_revision": "123", "model_file_name_template": "TestModel.{quantization}.bin", "model_file_name_split_template": "TestModel.{quantization}.bin.{part}", "model_uri": null}, {"model_format": "pytorch", "model_hub": "huggingface", "model_size_in_billions": 3, "quantizations": ["int8", "int4", "none"], "model_id": "example/TestModel", "model_revision": "456", "model_uri": null}], "chat_template": "xyz", "stop_token_ids": [1, 2, 3], "stop": ["hello", "world"], "reasoning_start_tag":null, "reasoning_end_tag":null}""" + expected = """{"version": 1, "context_length": 2048, "model_name": "TestModel", "model_lang": ["en"], "model_ability": ["embed", "generate"], "model_repository": None, "model_description": null, "model_family": null, "model_specs": [{"model_format": "ggufv2", "model_hub": "huggingface", "model_size_in_billions": 2, "quantizations": ["q4_0", "q4_1"], "quantization_parts": {"q4_2": ["a", "b"]}, "model_id": "example/TestModel", "model_revision": "123", "model_file_name_template": "TestModel.{quantization}.bin", "model_file_name_split_template": "TestModel.{quantization}.bin.{part}", "model_uri": null}, {"model_format": "pytorch", "model_hub": "huggingface", "model_size_in_billions": 3, "quantizations": ["int8", "int4", "none"], "model_id": "example/TestModel", "model_revision": "456", "model_uri": null}], "chat_template": "xyz", "stop_token_ids": [1, 2, 3], "stop": ["hello", "world"], "reasoning_start_tag":null, "reasoning_end_tag":null}""" assert json.loads(llm_family.json()) == json.loads(expected) llm_family_context_length = LLMFamilyV1( From cb04fd451532e22402295ddf7bc30b7953b79b8a Mon Sep 17 00:00:00 2001 From: Minamiyama Date: Sun, 2 Mar 2025 13:29:31 +0800 Subject: [PATCH 5/5] fix expected --- xinference/model/llm/tests/test_llm_family.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xinference/model/llm/tests/test_llm_family.py b/xinference/model/llm/tests/test_llm_family.py index b58dd7eba7..c0b86b6b9c 100644 --- a/xinference/model/llm/tests/test_llm_family.py +++ b/xinference/model/llm/tests/test_llm_family.py @@ -136,7 +136,7 @@ def test_serialize_llm_family_v1(): stop=["hello", "world"], ) - expected = """{"version": 1, "context_length": 2048, "model_name": "TestModel", "model_lang": ["en"], "model_ability": ["embed", "generate"], "model_repository": None, "model_description": null, "model_family": null, "model_specs": [{"model_format": "ggufv2", "model_hub": "huggingface", "model_size_in_billions": 2, "quantizations": ["q4_0", "q4_1"], "quantization_parts": {"q4_2": ["a", "b"]}, "model_id": "example/TestModel", "model_revision": "123", "model_file_name_template": "TestModel.{quantization}.bin", "model_file_name_split_template": "TestModel.{quantization}.bin.{part}", "model_uri": null}, {"model_format": "pytorch", "model_hub": "huggingface", "model_size_in_billions": 3, "quantizations": ["int8", "int4", "none"], "model_id": "example/TestModel", "model_revision": "456", "model_uri": null}], "chat_template": "xyz", "stop_token_ids": [1, 2, 3], "stop": ["hello", "world"], "reasoning_start_tag":null, "reasoning_end_tag":null}""" + expected = """{"version": 1, "context_length": 2048, "model_name": "TestModel", "model_lang": ["en"], "model_ability": ["embed", "generate"], "model_repository": null, "model_description": null, "model_family": null, "model_specs": [{"model_format": "ggufv2", "model_hub": "huggingface", "model_size_in_billions": 2, "quantizations": ["q4_0", "q4_1"], "quantization_parts": {"q4_2": ["a", "b"]}, "model_id": "example/TestModel", "model_revision": "123", "model_file_name_template": "TestModel.{quantization}.bin", "model_file_name_split_template": "TestModel.{quantization}.bin.{part}", "model_uri": null}, {"model_format": "pytorch", "model_hub": "huggingface", "model_size_in_billions": 3, "quantizations": ["int8", "int4", "none"], "model_id": "example/TestModel", "model_revision": "456", "model_uri": null}], "chat_template": "xyz", "stop_token_ids": [1, 2, 3], "stop": ["hello", "world"], "reasoning_start_tag":null, "reasoning_end_tag":null}""" assert json.loads(llm_family.json()) == json.loads(expected) llm_family_context_length = LLMFamilyV1(