xinference 0.12.3__py3-none-any.whl → 0.13.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/_version.py +3 -3
- xinference/api/restful_api.py +56 -8
- xinference/client/restful/restful_client.py +49 -4
- xinference/core/model.py +36 -4
- xinference/core/scheduler.py +2 -0
- xinference/core/supervisor.py +132 -15
- xinference/core/worker.py +239 -53
- xinference/deploy/cmdline.py +5 -0
- xinference/deploy/utils.py +33 -2
- xinference/model/audio/chattts.py +6 -6
- xinference/model/audio/core.py +23 -15
- xinference/model/core.py +12 -3
- xinference/model/embedding/core.py +25 -16
- xinference/model/flexible/__init__.py +40 -0
- xinference/model/flexible/core.py +228 -0
- xinference/model/flexible/launchers/__init__.py +15 -0
- xinference/model/flexible/launchers/transformers_launcher.py +63 -0
- xinference/model/flexible/utils.py +33 -0
- xinference/model/image/core.py +18 -14
- xinference/model/image/custom.py +1 -1
- xinference/model/llm/__init__.py +5 -2
- xinference/model/llm/core.py +3 -2
- xinference/model/llm/ggml/llamacpp.py +1 -10
- xinference/model/llm/llm_family.json +292 -36
- xinference/model/llm/llm_family.py +102 -53
- xinference/model/llm/llm_family_modelscope.json +247 -27
- xinference/model/llm/mlx/__init__.py +13 -0
- xinference/model/llm/mlx/core.py +408 -0
- xinference/model/llm/pytorch/chatglm.py +2 -9
- xinference/model/llm/pytorch/cogvlm2.py +206 -21
- xinference/model/llm/pytorch/core.py +213 -120
- xinference/model/llm/pytorch/glm4v.py +171 -15
- xinference/model/llm/pytorch/qwen_vl.py +168 -7
- xinference/model/llm/pytorch/utils.py +53 -62
- xinference/model/llm/utils.py +28 -7
- xinference/model/rerank/core.py +29 -25
- xinference/thirdparty/deepseek_vl/serve/__init__.py +13 -0
- xinference/thirdparty/deepseek_vl/serve/app_deepseek.py +510 -0
- xinference/thirdparty/deepseek_vl/serve/app_modules/__init__.py +13 -0
- xinference/thirdparty/deepseek_vl/serve/app_modules/gradio_utils.py +94 -0
- xinference/thirdparty/deepseek_vl/serve/app_modules/overwrites.py +81 -0
- xinference/thirdparty/deepseek_vl/serve/app_modules/presets.py +96 -0
- xinference/thirdparty/deepseek_vl/serve/app_modules/utils.py +229 -0
- xinference/thirdparty/deepseek_vl/serve/inference.py +170 -0
- xinference/types.py +0 -1
- xinference/web/ui/build/asset-manifest.json +3 -3
- xinference/web/ui/build/index.html +1 -1
- xinference/web/ui/build/static/js/main.95c1d652.js +3 -0
- xinference/web/ui/build/static/js/main.95c1d652.js.map +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/07ce9e632e6aff24d7aa3ad8e48224433bbfeb0d633fca723453f1fcae0c9f1c.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/1130403f9e46f5738a23b45ac59b57de8f360c908c713e2c0670c2cce9bd367a.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/1444c41a4d04494f1cbc2d8c1537df107b451cb569cb2c1fbf5159f3a4841a5f.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/2c63090c842376cdd368c3ded88a333ef40d94785747651343040a6f7872a223.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/40f17338fc75ae095de7d2b4d8eae0d5ca0193a7e2bcece4ee745b22a7a2f4b7.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/5262556baf9207738bf6a8ba141ec6599d0a636345c245d61fdf88d3171998cb.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/6450605fac003812485f6251b9f0caafbf2e5bfc3bbe2f000050d9e2fdb8dcd3.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/709711edada3f1596b309d571285fd31f1c364d66f4425bc28723d0088cc351a.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/70fa8c07463a5fe57c68bf92502910105a8f647371836fe8c3a7408246ca7ba0.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/8a9742ddd8ba8546ef42dc14caca443f2b4524fabed7bf269e0eff3b7b64ee7d.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/9375a35b05d56989b2755bf72161fa707c92f28569d33765a75f91a568fda6e9.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/d6c643278a0b28320e6f33a60f5fb64c053997cbdc39a60e53ccc574688ade9e.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/d93730e2b5d7e8c957b4d0965d2ed1dac9045a649adbd47c220d11f255d4b1e0.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/e656dc00b4d8b387f0a81ba8fc558767df1601c66369e2eb86a5ef27cf080572.json +1 -0
- xinference/web/ui/node_modules/.cache/babel-loader/f3e02274cb1964e99b1fe69cbb6db233d3d8d7dd05d50ebcdb8e66d50b224b7b.json +1 -0
- {xinference-0.12.3.dist-info → xinference-0.13.1.dist-info}/METADATA +10 -11
- {xinference-0.12.3.dist-info → xinference-0.13.1.dist-info}/RECORD +71 -69
- xinference/model/llm/ggml/chatglm.py +0 -457
- xinference/thirdparty/ChatTTS/__init__.py +0 -1
- xinference/thirdparty/ChatTTS/core.py +0 -200
- xinference/thirdparty/ChatTTS/experimental/__init__.py +0 -0
- xinference/thirdparty/ChatTTS/experimental/llm.py +0 -40
- xinference/thirdparty/ChatTTS/infer/__init__.py +0 -0
- xinference/thirdparty/ChatTTS/infer/api.py +0 -125
- xinference/thirdparty/ChatTTS/model/__init__.py +0 -0
- xinference/thirdparty/ChatTTS/model/dvae.py +0 -155
- xinference/thirdparty/ChatTTS/model/gpt.py +0 -265
- xinference/thirdparty/ChatTTS/utils/__init__.py +0 -0
- xinference/thirdparty/ChatTTS/utils/gpu_utils.py +0 -23
- xinference/thirdparty/ChatTTS/utils/infer_utils.py +0 -141
- xinference/thirdparty/ChatTTS/utils/io_utils.py +0 -14
- xinference/web/ui/build/static/js/main.77dd47c3.js +0 -3
- xinference/web/ui/build/static/js/main.77dd47c3.js.map +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/0cd591866aa345566e0b63fb51ff2043e163a770af6fdc2f3bad395d046353e2.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/37c1476717199863bbba1530e3513a9368f8f73001b75b4a85c2075956308027.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/3da7d55e87882a4af923e187b1351160e34ca102f589086439c15131a227fb6e.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/3fa1f69162f9c6dc0f6a6e21b64d49d6b8e6fa8dfa59a82cf829931c5f97d99f.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/46edc1fe657dfedb2e673148332bb442c6eb98f09f2592c389209e376510afa5.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/62e257ed9016471035fa1a7da57c9e2a4250974ed566b4d1295873d747c68eb2.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/72bcecc71c5267250edeb89608859d449b586f13ff9923a5e70e7172976ec403.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/82db357f3fd5b32215d747ee593f69ff06c95ad6cde37f71a96c8290aaab64c0.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/935efd2867664c58230378fdf2ff1ea85e58d853b7214014e20dfbca8dab7b05.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/bc6da27195ec4607bb472bf61f97c928ad4966fa64e4c2247661bedb7400abba.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/c2abe75f04ad82fba68f35ed9cbe2e287762c876684fddccccfa73f739489b65.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/e606671420d2937102c3c34b4b04056c11736408c1d3347b8cf42dfe61fb394b.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/f118f99c22b713c678c1209c4e1dd43fe86e3f6e801a4c0c35d3bbf41fd05fe6.json +0 -1
- xinference/web/ui/node_modules/.cache/babel-loader/f51bf63ddaa7afd125ef2254a105789333eecc1c94fdf5157a9b88ef7ad0a5bd.json +0 -1
- /xinference/web/ui/build/static/js/{main.77dd47c3.js.LICENSE.txt → main.95c1d652.js.LICENSE.txt} +0 -0
- {xinference-0.12.3.dist-info → xinference-0.13.1.dist-info}/LICENSE +0 -0
- {xinference-0.12.3.dist-info → xinference-0.13.1.dist-info}/WHEEL +0 -0
- {xinference-0.12.3.dist-info → xinference-0.13.1.dist-info}/entry_points.txt +0 -0
- {xinference-0.12.3.dist-info → xinference-0.13.1.dist-info}/top_level.txt +0 -0
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import re
|
|
3
|
-
import torch
|
|
4
|
-
import torch.nn.functional as F
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class CustomRepetitionPenaltyLogitsProcessorRepeat():
|
|
8
|
-
|
|
9
|
-
def __init__(self, penalty: float, max_input_ids, past_window):
|
|
10
|
-
if not isinstance(penalty, float) or not (penalty > 0):
|
|
11
|
-
raise ValueError(f"`penalty` has to be a strictly positive float, but is {penalty}")
|
|
12
|
-
|
|
13
|
-
self.penalty = penalty
|
|
14
|
-
self.max_input_ids = max_input_ids
|
|
15
|
-
self.past_window = past_window
|
|
16
|
-
|
|
17
|
-
def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
|
|
18
|
-
|
|
19
|
-
input_ids = input_ids[:, -self.past_window:]
|
|
20
|
-
freq = F.one_hot(input_ids, scores.size(1)).sum(1)
|
|
21
|
-
freq[self.max_input_ids:] = 0
|
|
22
|
-
alpha = self.penalty**freq
|
|
23
|
-
scores = torch.where(scores < 0, scores*alpha, scores/alpha)
|
|
24
|
-
|
|
25
|
-
return scores
|
|
26
|
-
|
|
27
|
-
class CustomRepetitionPenaltyLogitsProcessor():
|
|
28
|
-
|
|
29
|
-
def __init__(self, penalty: float, max_input_ids, past_window):
|
|
30
|
-
if not isinstance(penalty, float) or not (penalty > 0):
|
|
31
|
-
raise ValueError(f"`penalty` has to be a strictly positive float, but is {penalty}")
|
|
32
|
-
|
|
33
|
-
self.penalty = penalty
|
|
34
|
-
self.max_input_ids = max_input_ids
|
|
35
|
-
self.past_window = past_window
|
|
36
|
-
|
|
37
|
-
def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
|
|
38
|
-
|
|
39
|
-
input_ids = input_ids[:, -self.past_window:]
|
|
40
|
-
score = torch.gather(scores, 1, input_ids)
|
|
41
|
-
_score = score.detach().clone()
|
|
42
|
-
score = torch.where(score < 0, score * self.penalty, score / self.penalty)
|
|
43
|
-
score[input_ids>=self.max_input_ids] = _score[input_ids>=self.max_input_ids]
|
|
44
|
-
scores.scatter_(1, input_ids, score)
|
|
45
|
-
|
|
46
|
-
return scores
|
|
47
|
-
|
|
48
|
-
def count_invalid_characters(s):
|
|
49
|
-
|
|
50
|
-
s = re.sub(r'\[uv_break\]|\[laugh\]|\[lbreak\]', '', s)
|
|
51
|
-
pattern = re.compile(r'[^\u4e00-\u9fffA-Za-z,。、,\. ]')
|
|
52
|
-
non_alphabetic_chinese_chars = pattern.findall(s)
|
|
53
|
-
return set(non_alphabetic_chinese_chars)
|
|
54
|
-
|
|
55
|
-
def detect_language(sentence):
|
|
56
|
-
|
|
57
|
-
chinese_char_pattern = re.compile(r'[\u4e00-\u9fff]')
|
|
58
|
-
english_word_pattern = re.compile(r'\b[A-Za-z]+\b')
|
|
59
|
-
|
|
60
|
-
chinese_chars = chinese_char_pattern.findall(sentence)
|
|
61
|
-
english_words = english_word_pattern.findall(sentence)
|
|
62
|
-
|
|
63
|
-
if len(chinese_chars) > len(english_words):
|
|
64
|
-
return "zh"
|
|
65
|
-
else:
|
|
66
|
-
return "en"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
character_map = {
|
|
70
|
-
':': ',',
|
|
71
|
-
';': ',',
|
|
72
|
-
'!': '。',
|
|
73
|
-
'(': ',',
|
|
74
|
-
')': ',',
|
|
75
|
-
'【': ',',
|
|
76
|
-
'】': ',',
|
|
77
|
-
'『': ',',
|
|
78
|
-
'』': ',',
|
|
79
|
-
'「': ',',
|
|
80
|
-
'」': ',',
|
|
81
|
-
'《': ',',
|
|
82
|
-
'》': ',',
|
|
83
|
-
'-': ',',
|
|
84
|
-
'‘': '',
|
|
85
|
-
'“': '',
|
|
86
|
-
'’': '',
|
|
87
|
-
'”': '',
|
|
88
|
-
':': ',',
|
|
89
|
-
';': ',',
|
|
90
|
-
'!': '.',
|
|
91
|
-
'(': ',',
|
|
92
|
-
')': ',',
|
|
93
|
-
'[': ',',
|
|
94
|
-
']': ',',
|
|
95
|
-
'>': ',',
|
|
96
|
-
'<': ',',
|
|
97
|
-
'-': ',',
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
halfwidth_2_fullwidth_map = {
|
|
101
|
-
'!': '!',
|
|
102
|
-
'"': '“',
|
|
103
|
-
"'": '‘',
|
|
104
|
-
'#': '#',
|
|
105
|
-
'$': '$',
|
|
106
|
-
'%': '%',
|
|
107
|
-
'&': '&',
|
|
108
|
-
'(': '(',
|
|
109
|
-
')': ')',
|
|
110
|
-
',': ',',
|
|
111
|
-
'-': '-',
|
|
112
|
-
'*': '*',
|
|
113
|
-
'+': '+',
|
|
114
|
-
'.': '。',
|
|
115
|
-
'/': '/',
|
|
116
|
-
':': ':',
|
|
117
|
-
';': ';',
|
|
118
|
-
'<': '<',
|
|
119
|
-
'=': '=',
|
|
120
|
-
'>': '>',
|
|
121
|
-
'?': '?',
|
|
122
|
-
'@': '@',
|
|
123
|
-
# '[': '[',
|
|
124
|
-
'\\': '\',
|
|
125
|
-
# ']': ']',
|
|
126
|
-
'^': '^',
|
|
127
|
-
# '_': '_',
|
|
128
|
-
'`': '`',
|
|
129
|
-
'{': '{',
|
|
130
|
-
'|': '|',
|
|
131
|
-
'}': '}',
|
|
132
|
-
'~': '~'
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
def apply_half2full_map(text):
|
|
136
|
-
translation_table = str.maketrans(halfwidth_2_fullwidth_map)
|
|
137
|
-
return text.translate(translation_table)
|
|
138
|
-
|
|
139
|
-
def apply_character_map(text):
|
|
140
|
-
translation_table = str.maketrans(character_map)
|
|
141
|
-
return text.translate(translation_table)
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import os
|
|
3
|
-
import logging
|
|
4
|
-
|
|
5
|
-
def get_latest_modified_file(directory):
|
|
6
|
-
logger = logging.getLogger(__name__)
|
|
7
|
-
|
|
8
|
-
files = [os.path.join(directory, f) for f in os.listdir(directory)]
|
|
9
|
-
if not files:
|
|
10
|
-
logger.log(logging.WARNING, f'No files found in the directory: {directory}')
|
|
11
|
-
return None
|
|
12
|
-
latest_file = max(files, key=os.path.getmtime)
|
|
13
|
-
|
|
14
|
-
return latest_file
|