xinference 1.4.0__py3-none-any.whl → 1.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xinference might be problematic. Click here for more details.
- xinference/_compat.py +1 -0
- xinference/_version.py +3 -3
- xinference/api/restful_api.py +4 -0
- xinference/core/model.py +23 -3
- xinference/core/supervisor.py +6 -0
- xinference/core/worker.py +54 -11
- xinference/model/llm/__init__.py +4 -2
- xinference/model/llm/core.py +1 -0
- xinference/model/llm/llama_cpp/core.py +6 -1
- xinference/model/llm/llm_family.json +117 -1
- xinference/model/llm/llm_family_modelscope.json +125 -1
- xinference/model/llm/reasoning_parser.py +3 -3
- xinference/model/llm/sglang/core.py +111 -13
- xinference/model/llm/transformers/core.py +1 -0
- xinference/model/llm/transformers/deepseek_vl.py +1 -1
- xinference/model/llm/transformers/deepseek_vl2.py +287 -0
- xinference/model/llm/utils.py +26 -14
- xinference/model/llm/vllm/core.py +149 -8
- xinference/model/llm/vllm/distributed_executor.py +314 -0
- xinference/model/rerank/core.py +16 -11
- xinference/thirdparty/deepseek_vl2/__init__.py +31 -0
- xinference/thirdparty/deepseek_vl2/models/__init__.py +26 -0
- xinference/thirdparty/deepseek_vl2/models/configuration_deepseek.py +210 -0
- xinference/thirdparty/deepseek_vl2/models/conversation.py +310 -0
- xinference/thirdparty/deepseek_vl2/models/modeling_deepseek.py +1975 -0
- xinference/thirdparty/deepseek_vl2/models/modeling_deepseek_vl_v2.py +697 -0
- xinference/thirdparty/deepseek_vl2/models/processing_deepseek_vl_v2.py +675 -0
- xinference/thirdparty/deepseek_vl2/models/siglip_vit.py +661 -0
- xinference/thirdparty/deepseek_vl2/serve/__init__.py +0 -0
- xinference/thirdparty/deepseek_vl2/serve/app_modules/__init__.py +0 -0
- xinference/thirdparty/deepseek_vl2/serve/app_modules/gradio_utils.py +83 -0
- xinference/thirdparty/deepseek_vl2/serve/app_modules/overwrites.py +81 -0
- xinference/thirdparty/deepseek_vl2/serve/app_modules/presets.py +115 -0
- xinference/thirdparty/deepseek_vl2/serve/app_modules/utils.py +333 -0
- xinference/thirdparty/deepseek_vl2/serve/assets/Kelpy-Codos.js +100 -0
- xinference/thirdparty/deepseek_vl2/serve/assets/avatar.png +0 -0
- xinference/thirdparty/deepseek_vl2/serve/assets/custom.css +355 -0
- xinference/thirdparty/deepseek_vl2/serve/assets/custom.js +22 -0
- xinference/thirdparty/deepseek_vl2/serve/assets/favicon.ico +0 -0
- xinference/thirdparty/deepseek_vl2/serve/assets/simsun.ttc +0 -0
- xinference/thirdparty/deepseek_vl2/serve/inference.py +197 -0
- xinference/thirdparty/deepseek_vl2/utils/__init__.py +18 -0
- xinference/thirdparty/deepseek_vl2/utils/io.py +80 -0
- xinference/web/ui/build/asset-manifest.json +3 -3
- xinference/web/ui/build/index.html +1 -1
- xinference/web/ui/build/static/js/{main.3cea968e.js → main.5ca4eea1.js} +3 -3
- xinference/web/ui/build/static/js/main.5ca4eea1.js.map +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/0f0967acaec5df1d45b80010949c258d64297ebbb0f44b8bb3afcbd45c6f0ec4.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/68249645124f37d01eef83b1d897e751f895bea919b6fb466f907c1f87cebc84.json +1 -0
- {xinference-1.4.0.dist-info → xinference-1.4.1.dist-info}/METADATA +4 -4
- {xinference-1.4.0.dist-info → xinference-1.4.1.dist-info}/RECORD +56 -31
- xinference/web/ui/build/static/js/main.3cea968e.js.map +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/7f59e45e3f268ab8a4788b6fb024cf8dab088736dff22f5a3a39c122a83ab930.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/dcd60488509450bfff37bfff56de2c096d51de17dd00ec60d4db49c8b483ada1.json +0 -1
- /xinference/web/ui/build/static/js/{main.3cea968e.js.LICENSE.txt → main.5ca4eea1.js.LICENSE.txt} +0 -0
- {xinference-1.4.0.dist-info → xinference-1.4.1.dist-info}/LICENSE +0 -0
- {xinference-1.4.0.dist-info → xinference-1.4.1.dist-info}/WHEEL +0 -0
- {xinference-1.4.0.dist-info → xinference-1.4.1.dist-info}/entry_points.txt +0 -0
- {xinference-1.4.0.dist-info → xinference-1.4.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Copyright (c) 2023-2024 DeepSeek.
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
# this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
# the Software without restriction, including without limitation the rights to
|
|
6
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
7
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
|
8
|
+
# subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
# copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
|
|
20
|
+
import json
|
|
21
|
+
from typing import Dict, List
|
|
22
|
+
|
|
23
|
+
import PIL.Image
|
|
24
|
+
import torch
|
|
25
|
+
from transformers import AutoModelForCausalLM
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def load_pretrained_model(model_path: str):
|
|
29
|
+
|
|
30
|
+
from deepseek_vl2.models.processing_deepseek_vl_v2 import DeepseekVLV2Processor
|
|
31
|
+
from deepseek_vl2.models.modeling_deepseek_vl_v2 import DeepseekVLV2ForCausalLM
|
|
32
|
+
|
|
33
|
+
vl_chat_processor = DeepseekVLV2Processor.from_pretrained(model_path)
|
|
34
|
+
tokenizer = vl_chat_processor.tokenizer
|
|
35
|
+
|
|
36
|
+
vl_gpt: DeepseekVLV2ForCausalLM = AutoModelForCausalLM.from_pretrained(
|
|
37
|
+
model_path, trust_remote_code=True
|
|
38
|
+
)
|
|
39
|
+
vl_gpt = vl_gpt.to(torch.bfloat16).cuda().eval()
|
|
40
|
+
|
|
41
|
+
return tokenizer, vl_chat_processor, vl_gpt
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def load_pil_images(conversations: List[Dict[str, str]]) -> List[PIL.Image.Image]:
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
conversations (List[Dict[str, str]]): the conversations with a list of messages. An example is :
|
|
49
|
+
[
|
|
50
|
+
{
|
|
51
|
+
"role": "User",
|
|
52
|
+
"content": "<image>\nExtract all information from this image and convert them into markdown format.",
|
|
53
|
+
"images": ["./examples/table_datasets.png"]
|
|
54
|
+
},
|
|
55
|
+
{"role": "Assistant", "content": ""},
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
pil_images (List[PIL.Image.Image]): the list of PIL images.
|
|
60
|
+
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
pil_images = []
|
|
64
|
+
|
|
65
|
+
for message in conversations:
|
|
66
|
+
if "images" not in message:
|
|
67
|
+
continue
|
|
68
|
+
|
|
69
|
+
for image_path in message["images"]:
|
|
70
|
+
pil_img = PIL.Image.open(image_path)
|
|
71
|
+
pil_img = pil_img.convert("RGB")
|
|
72
|
+
pil_images.append(pil_img)
|
|
73
|
+
|
|
74
|
+
return pil_images
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def load_json(filepath):
|
|
78
|
+
with open(filepath, "r") as f:
|
|
79
|
+
data = json.load(f)
|
|
80
|
+
return data
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "./static/css/main.b494ae7e.css",
|
|
4
|
-
"main.js": "./static/js/main.
|
|
4
|
+
"main.js": "./static/js/main.5ca4eea1.js",
|
|
5
5
|
"static/media/icon.webp": "./static/media/icon.4603d52c63041e5dfbfd.webp",
|
|
6
6
|
"index.html": "./index.html",
|
|
7
7
|
"main.b494ae7e.css.map": "./static/css/main.b494ae7e.css.map",
|
|
8
|
-
"main.
|
|
8
|
+
"main.5ca4eea1.js.map": "./static/js/main.5ca4eea1.js.map"
|
|
9
9
|
},
|
|
10
10
|
"entrypoints": [
|
|
11
11
|
"static/css/main.b494ae7e.css",
|
|
12
|
-
"static/js/main.
|
|
12
|
+
"static/js/main.5ca4eea1.js"
|
|
13
13
|
]
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.svg"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>Xinference</title><script defer="defer" src="./static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.svg"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>Xinference</title><script defer="defer" src="./static/js/main.5ca4eea1.js"></script><link href="./static/css/main.b494ae7e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|