xinference 0.10.3__py3-none-any.whl → 0.11.0__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 (89) hide show
  1. xinference/_version.py +3 -3
  2. xinference/api/oauth2/auth_service.py +1 -1
  3. xinference/api/restful_api.py +53 -61
  4. xinference/client/restful/restful_client.py +52 -57
  5. xinference/conftest.py +1 -1
  6. xinference/core/cache_tracker.py +1 -1
  7. xinference/core/event.py +1 -1
  8. xinference/core/model.py +15 -4
  9. xinference/core/status_guard.py +1 -1
  10. xinference/core/supervisor.py +58 -72
  11. xinference/core/worker.py +68 -101
  12. xinference/deploy/cmdline.py +166 -1
  13. xinference/deploy/test/test_cmdline.py +2 -0
  14. xinference/deploy/utils.py +1 -1
  15. xinference/device_utils.py +29 -3
  16. xinference/fields.py +5 -1
  17. xinference/model/audio/whisper.py +88 -12
  18. xinference/model/core.py +2 -2
  19. xinference/model/image/__init__.py +29 -0
  20. xinference/model/image/core.py +6 -0
  21. xinference/model/image/custom.py +109 -0
  22. xinference/model/llm/__init__.py +92 -32
  23. xinference/model/llm/core.py +57 -102
  24. xinference/model/llm/ggml/tools/convert_ggml_to_gguf.py +2 -2
  25. xinference/model/llm/llm_family.json +306 -4
  26. xinference/model/llm/llm_family.py +45 -41
  27. xinference/model/llm/llm_family_modelscope.json +119 -2
  28. xinference/model/llm/pytorch/deepseek_vl.py +89 -33
  29. xinference/model/llm/pytorch/qwen_vl.py +67 -12
  30. xinference/model/llm/pytorch/yi_vl.py +62 -45
  31. xinference/model/llm/utils.py +29 -15
  32. xinference/model/llm/vllm/core.py +19 -4
  33. xinference/thirdparty/omnilmm/chat.py +2 -1
  34. xinference/thirdparty/omnilmm/model/omnilmm.py +2 -1
  35. xinference/types.py +2 -0
  36. xinference/web/ui/build/asset-manifest.json +6 -3
  37. xinference/web/ui/build/index.html +1 -1
  38. xinference/web/ui/build/static/css/main.54bca460.css +2 -0
  39. xinference/web/ui/build/static/css/main.54bca460.css.map +1 -0
  40. xinference/web/ui/build/static/js/main.8e44da4b.js +3 -0
  41. xinference/web/ui/build/static/js/{main.26fdbfbe.js.LICENSE.txt → main.8e44da4b.js.LICENSE.txt} +7 -0
  42. xinference/web/ui/build/static/js/main.8e44da4b.js.map +1 -0
  43. xinference/web/ui/node_modules/.cache/babel-loader/0b11a5339468c13b2d31ac085e7effe4303259b2071abd46a0a8eb8529233a5e.json +1 -0
  44. xinference/web/ui/node_modules/.cache/babel-loader/29dda700ab913cf7f2cfabe450ddabfb283e96adfa3ec9d315b2fa6c63cd375c.json +1 -0
  45. xinference/web/ui/node_modules/.cache/babel-loader/2c63e940b945fd5817157e08a42b889b30d668ea4c91332f48ef2b1b9d26f520.json +1 -0
  46. xinference/web/ui/node_modules/.cache/babel-loader/4135fe8745434cbce6438d1ebfa47422e0c77d884db4edc75c8bf32ea1d50621.json +1 -0
  47. xinference/web/ui/node_modules/.cache/babel-loader/46b6dd1f6d1109cd0e2455a0ea0be3e9bda1097cd4ebec9c4040070372671cfc.json +1 -0
  48. xinference/web/ui/node_modules/.cache/babel-loader/4de0a71074f9cbe1e7862750dcdd08cbc1bae7d9d9849a78b1783ca670017b3c.json +1 -0
  49. xinference/web/ui/node_modules/.cache/babel-loader/53f6c0c0afb51265cd8fb940daeb65523501879ac2a8c03a1ead22b9793c5041.json +1 -0
  50. xinference/web/ui/node_modules/.cache/babel-loader/8ccbb839002bc5bc03e0a0e7612362bf92f6ae64f87e094f8682d6a6fe4619bb.json +1 -0
  51. xinference/web/ui/node_modules/.cache/babel-loader/97ed30d6e22cf76f0733651e2c18364689a01665d0b5fe811c1b7ca3eb713c82.json +1 -0
  52. xinference/web/ui/node_modules/.cache/babel-loader/9c0c70f1838913aaa792a0d2260f17f90fd177b95698ed46b7bc3050eb712c1c.json +1 -0
  53. xinference/web/ui/node_modules/.cache/babel-loader/9cfd33238ca43e5bf9fc7e442690e8cc6027c73553db36de87e3597ed524ee4b.json +1 -0
  54. xinference/web/ui/node_modules/.cache/babel-loader/ada71518a429f821a9b1dea38bc951447f03c8db509887e0980b893acac938f3.json +1 -0
  55. xinference/web/ui/node_modules/.cache/babel-loader/b6c9558d28b5972bb8b2691c5a76a2c8814a815eb3443126da9f49f7d6a0c118.json +1 -0
  56. xinference/web/ui/node_modules/.cache/babel-loader/bb0f721c084a4d85c09201c984f02ee8437d3b6c5c38a57cb4a101f653daef1b.json +1 -0
  57. xinference/web/ui/node_modules/.cache/babel-loader/ddaec68b88e5eff792df1e39a4b4b8b737bfc832293c015660c3c69334e3cf5c.json +1 -0
  58. xinference/web/ui/node_modules/.package-lock.json +33 -0
  59. xinference/web/ui/node_modules/clipboard/.babelrc.json +11 -0
  60. xinference/web/ui/node_modules/clipboard/.eslintrc.json +24 -0
  61. xinference/web/ui/node_modules/clipboard/.prettierrc.json +9 -0
  62. xinference/web/ui/node_modules/clipboard/bower.json +18 -0
  63. xinference/web/ui/node_modules/clipboard/composer.json +25 -0
  64. xinference/web/ui/node_modules/clipboard/package.json +63 -0
  65. xinference/web/ui/node_modules/delegate/package.json +31 -0
  66. xinference/web/ui/node_modules/good-listener/bower.json +11 -0
  67. xinference/web/ui/node_modules/good-listener/package.json +35 -0
  68. xinference/web/ui/node_modules/select/bower.json +13 -0
  69. xinference/web/ui/node_modules/select/package.json +29 -0
  70. xinference/web/ui/node_modules/tiny-emitter/package.json +53 -0
  71. xinference/web/ui/package-lock.json +34 -0
  72. xinference/web/ui/package.json +1 -0
  73. {xinference-0.10.3.dist-info → xinference-0.11.0.dist-info}/METADATA +11 -11
  74. {xinference-0.10.3.dist-info → xinference-0.11.0.dist-info}/RECORD +78 -57
  75. xinference/client/oscar/__init__.py +0 -13
  76. xinference/client/oscar/actor_client.py +0 -611
  77. xinference/model/llm/pytorch/spec_decoding_utils.py +0 -531
  78. xinference/model/llm/pytorch/spec_model.py +0 -186
  79. xinference/web/ui/build/static/js/main.26fdbfbe.js +0 -3
  80. xinference/web/ui/build/static/js/main.26fdbfbe.js.map +0 -1
  81. xinference/web/ui/node_modules/.cache/babel-loader/63a4c48f0326d071c7772c46598215c006ae41fd3d4ff3577fe717de66ad6e89.json +0 -1
  82. xinference/web/ui/node_modules/.cache/babel-loader/de0299226173b0662b573f49e3992220f6611947073bd66ac079728a8bc8837d.json +0 -1
  83. xinference/web/ui/node_modules/.cache/babel-loader/e9b52d171223bb59fb918316297a051cdfd42dd453e8260fd918e90bc0a4ebdf.json +0 -1
  84. xinference/web/ui/node_modules/.cache/babel-loader/f4d5d1a41892a754c1ee0237450d804b20612d1b657945b59e564161ea47aa7a.json +0 -1
  85. xinference/web/ui/node_modules/.cache/babel-loader/fad4cd70de36ef6e6d5f8fd74a10ded58d964a8a91ef7681693fbb8376552da7.json +0 -1
  86. {xinference-0.10.3.dist-info → xinference-0.11.0.dist-info}/LICENSE +0 -0
  87. {xinference-0.10.3.dist-info → xinference-0.11.0.dist-info}/WHEEL +0 -0
  88. {xinference-0.10.3.dist-info → xinference-0.11.0.dist-info}/entry_points.txt +0 -0
  89. {xinference-0.10.3.dist-info → xinference-0.11.0.dist-info}/top_level.txt +0 -0
@@ -1,186 +0,0 @@
1
- # Copyright 2022-2023 XProbe Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- import logging
16
- from typing import Iterator, List, Optional, Union
17
-
18
- from ....device_utils import (
19
- get_device_preferred_dtype,
20
- gpu_count,
21
- is_hf_accelerate_supported,
22
- )
23
- from ....types import Completion, CompletionChunk, Embedding
24
- from ...utils import select_device
25
- from .. import LLMFamilyV1, LLMSpecV1
26
- from .core import PytorchChatModel, PytorchGenerateConfig, PytorchModelConfig
27
-
28
- logger = logging.getLogger(__name__)
29
-
30
-
31
- class SpeculativeModel(PytorchChatModel):
32
- def __init__(
33
- self,
34
- model_uid: str,
35
- model_family: "LLMFamilyV1",
36
- model_spec: "LLMSpecV1",
37
- quantization: str,
38
- model_path: str,
39
- draft_model_family: "LLMFamilyV1",
40
- draft_model_spec: "LLMSpecV1",
41
- draft_quantization: str,
42
- draft_model_path: str,
43
- ):
44
- super().__init__(model_uid, model_family, model_spec, quantization, model_path)
45
- self._pytorch_model_config: PytorchModelConfig = self._sanitize_model_config(
46
- PytorchModelConfig()
47
- )
48
- self._draft_model_family = draft_model_family
49
- self._draft_model_spec = draft_model_spec
50
- self._draft_quantization = draft_quantization
51
- self._draft_model_path = draft_model_path
52
-
53
- def _load_model(self, model_path, **kwargs):
54
- try:
55
- from transformers import AutoModelForCausalLM, AutoTokenizer
56
- except ImportError:
57
- error_message = "Failed to import module 'transformers'"
58
- installation_guide = [
59
- "Please make sure 'transformers' is installed. ",
60
- "You can install it by `pip install transformers`\n",
61
- ]
62
-
63
- raise ImportError(f"{error_message}\n\n{''.join(installation_guide)}")
64
-
65
- tokenizer = AutoTokenizer.from_pretrained(
66
- model_path,
67
- use_fast=self._use_fast_tokenizer,
68
- trust_remote_code=kwargs["trust_remote_code"],
69
- revision=kwargs["revision"],
70
- )
71
- model = AutoModelForCausalLM.from_pretrained(
72
- model_path,
73
- low_cpu_mem_usage=True,
74
- **kwargs,
75
- )
76
- return model, tokenizer
77
-
78
- def load(self):
79
- try:
80
- import torch # noqa: F401
81
- except ImportError:
82
- raise ImportError(
83
- f"Failed to import module 'torch'. Please make sure 'torch' is installed.\n\n"
84
- )
85
-
86
- num_gpus = gpu_count()
87
- device = self._pytorch_model_config.get("device", "auto")
88
- self._pytorch_model_config["device"] = select_device(device)
89
- self._device = self._pytorch_model_config["device"]
90
-
91
- kwargs = {}
92
-
93
- dtype = get_device_preferred_dtype(self._device)
94
-
95
- if dtype is not None:
96
- kwargs["torch_dtype"] = dtype
97
- else:
98
- raise ValueError(f"Device {self._device} is not supported in temporary")
99
-
100
- kwargs["trust_remote_code"] = self._pytorch_model_config.get(
101
- "trust_remote_code"
102
- )
103
-
104
- if self.quantization != "none":
105
- raise ValueError(
106
- "Quantization is not supported by speculative decoding yet"
107
- )
108
-
109
- is_device_map_auto = False
110
-
111
- if num_gpus > 0 and is_hf_accelerate_supported(self._device):
112
- kwargs.update({"device_map": "auto"})
113
- is_device_map_auto = True
114
-
115
- self._model, self._tokenizer = self._load_model(
116
- model_path=self.model_path,
117
- revision=self.model_spec.model_revision,
118
- **kwargs,
119
- )
120
- if not is_device_map_auto:
121
- self._model.to(self._device)
122
- logger.debug(
123
- f"Model {self.model_uid} memory footprint: {self._model.get_memory_footprint()}"
124
- )
125
-
126
- self._draft_model, _ = self._load_model(
127
- model_path=self._draft_model_path,
128
- revision=self._draft_model_spec.model_revision,
129
- **kwargs,
130
- )
131
- if not is_device_map_auto:
132
- self._model.to(self._device)
133
- logger.debug(
134
- f"Draft model {self.model_uid} memory footprint: {self._model.get_memory_footprint()}"
135
- )
136
-
137
- def generate(
138
- self, prompt: str, generate_config: Optional[PytorchGenerateConfig] = None
139
- ) -> Union[Completion, Iterator[CompletionChunk]]:
140
- def generator_wrapper(
141
- _prompt: str, _generate_config: PytorchGenerateConfig
142
- ) -> Iterator[CompletionChunk]:
143
- for _completion_chunk, _completion_usage in speculative_generate_stream(
144
- model_uid=self.model_uid,
145
- draft_model=self._draft_model,
146
- model=self._model,
147
- tokenizer=self._tokenizer,
148
- prompt=_prompt,
149
- generate_config=_generate_config,
150
- ):
151
- yield _completion_chunk
152
-
153
- from .spec_decoding_utils import speculative_generate_stream
154
-
155
- generate_config = self._sanitize_generate_config(generate_config)
156
-
157
- assert self._draft_model is not None
158
- assert self._model is not None
159
- assert self._tokenizer is not None
160
-
161
- stream = generate_config.get("stream", False)
162
- if not stream:
163
- for completion_chunk, completion_usage in speculative_generate_stream(
164
- model_uid=self.model_uid,
165
- draft_model=self._draft_model,
166
- model=self._model,
167
- tokenizer=self._tokenizer,
168
- prompt=prompt,
169
- generate_config=generate_config,
170
- ):
171
- pass
172
-
173
- completion = Completion(
174
- id=completion_chunk["id"],
175
- object=completion_chunk["object"],
176
- created=completion_chunk["created"],
177
- model=completion_chunk["model"],
178
- choices=completion_chunk["choices"],
179
- usage=completion_usage,
180
- )
181
- return completion
182
- else:
183
- return generator_wrapper(prompt, generate_config)
184
-
185
- def create_embedding(self, input: Union[str, List[str]]) -> Embedding:
186
- raise NotImplementedError