xinference 0.13.0__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.

Files changed (66) hide show
  1. xinference/_version.py +3 -3
  2. xinference/api/restful_api.py +50 -2
  3. xinference/client/restful/restful_client.py +49 -2
  4. xinference/core/model.py +15 -0
  5. xinference/core/supervisor.py +132 -15
  6. xinference/core/worker.py +165 -8
  7. xinference/deploy/cmdline.py +5 -0
  8. xinference/model/audio/chattts.py +6 -6
  9. xinference/model/audio/core.py +23 -15
  10. xinference/model/core.py +12 -3
  11. xinference/model/embedding/core.py +25 -16
  12. xinference/model/flexible/__init__.py +40 -0
  13. xinference/model/flexible/core.py +228 -0
  14. xinference/model/flexible/launchers/__init__.py +15 -0
  15. xinference/model/flexible/launchers/transformers_launcher.py +63 -0
  16. xinference/model/flexible/utils.py +33 -0
  17. xinference/model/image/core.py +18 -14
  18. xinference/model/image/custom.py +1 -1
  19. xinference/model/llm/__init__.py +0 -2
  20. xinference/model/llm/core.py +3 -2
  21. xinference/model/llm/ggml/llamacpp.py +1 -10
  22. xinference/model/llm/llm_family.json +52 -35
  23. xinference/model/llm/llm_family.py +71 -46
  24. xinference/model/llm/llm_family_modelscope.json +55 -27
  25. xinference/model/llm/pytorch/core.py +0 -80
  26. xinference/model/llm/utils.py +4 -2
  27. xinference/model/rerank/core.py +24 -25
  28. xinference/types.py +0 -1
  29. xinference/web/ui/build/asset-manifest.json +3 -3
  30. xinference/web/ui/build/index.html +1 -1
  31. xinference/web/ui/build/static/js/{main.0fb6f3ab.js → main.95c1d652.js} +3 -3
  32. xinference/web/ui/build/static/js/main.95c1d652.js.map +1 -0
  33. xinference/web/ui/node_modules/.cache/babel-loader/07ce9e632e6aff24d7aa3ad8e48224433bbfeb0d633fca723453f1fcae0c9f1c.json +1 -0
  34. xinference/web/ui/node_modules/.cache/babel-loader/40f17338fc75ae095de7d2b4d8eae0d5ca0193a7e2bcece4ee745b22a7a2f4b7.json +1 -0
  35. xinference/web/ui/node_modules/.cache/babel-loader/5262556baf9207738bf6a8ba141ec6599d0a636345c245d61fdf88d3171998cb.json +1 -0
  36. xinference/web/ui/node_modules/.cache/babel-loader/709711edada3f1596b309d571285fd31f1c364d66f4425bc28723d0088cc351a.json +1 -0
  37. xinference/web/ui/node_modules/.cache/babel-loader/70fa8c07463a5fe57c68bf92502910105a8f647371836fe8c3a7408246ca7ba0.json +1 -0
  38. xinference/web/ui/node_modules/.cache/babel-loader/f3e02274cb1964e99b1fe69cbb6db233d3d8d7dd05d50ebcdb8e66d50b224b7b.json +1 -0
  39. {xinference-0.13.0.dist-info → xinference-0.13.1.dist-info}/METADATA +7 -11
  40. {xinference-0.13.0.dist-info → xinference-0.13.1.dist-info}/RECORD +45 -54
  41. xinference/model/llm/ggml/chatglm.py +0 -457
  42. xinference/thirdparty/ChatTTS/__init__.py +0 -1
  43. xinference/thirdparty/ChatTTS/core.py +0 -200
  44. xinference/thirdparty/ChatTTS/experimental/__init__.py +0 -0
  45. xinference/thirdparty/ChatTTS/experimental/llm.py +0 -40
  46. xinference/thirdparty/ChatTTS/infer/__init__.py +0 -0
  47. xinference/thirdparty/ChatTTS/infer/api.py +0 -125
  48. xinference/thirdparty/ChatTTS/model/__init__.py +0 -0
  49. xinference/thirdparty/ChatTTS/model/dvae.py +0 -155
  50. xinference/thirdparty/ChatTTS/model/gpt.py +0 -265
  51. xinference/thirdparty/ChatTTS/utils/__init__.py +0 -0
  52. xinference/thirdparty/ChatTTS/utils/gpu_utils.py +0 -23
  53. xinference/thirdparty/ChatTTS/utils/infer_utils.py +0 -141
  54. xinference/thirdparty/ChatTTS/utils/io_utils.py +0 -14
  55. xinference/web/ui/build/static/js/main.0fb6f3ab.js.map +0 -1
  56. xinference/web/ui/node_modules/.cache/babel-loader/0f6b391abec76271137faad13a3793fe7acc1024e8cd2269c147b653ecd3a73b.json +0 -1
  57. xinference/web/ui/node_modules/.cache/babel-loader/30a0c79d8025d6441eb75b2df5bc2750a14f30119c869ef02570d294dff65c2f.json +0 -1
  58. xinference/web/ui/node_modules/.cache/babel-loader/40486e655c3c5801f087e2cf206c0b5511aaa0dfdba78046b7181bf9c17e54c5.json +0 -1
  59. xinference/web/ui/node_modules/.cache/babel-loader/b5507cd57f16a3a230aa0128e39fe103e928de139ea29e2679e4c64dcbba3b3a.json +0 -1
  60. xinference/web/ui/node_modules/.cache/babel-loader/d779b915f83f9c7b5a72515b6932fdd114f1822cef90ae01cc0d12bca59abc2d.json +0 -1
  61. xinference/web/ui/node_modules/.cache/babel-loader/d87824cb266194447a9c0c69ebab2d507bfc3e3148976173760d18c035e9dd26.json +0 -1
  62. /xinference/web/ui/build/static/js/{main.0fb6f3ab.js.LICENSE.txt → main.95c1d652.js.LICENSE.txt} +0 -0
  63. {xinference-0.13.0.dist-info → xinference-0.13.1.dist-info}/LICENSE +0 -0
  64. {xinference-0.13.0.dist-info → xinference-0.13.1.dist-info}/WHEEL +0 -0
  65. {xinference-0.13.0.dist-info → xinference-0.13.1.dist-info}/entry_points.txt +0 -0
  66. {xinference-0.13.0.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