xinference 0.11.2__py3-none-any.whl → 0.11.2.post1__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/model/llm/pytorch/intern_vl.py +3 -43
- {xinference-0.11.2.dist-info → xinference-0.11.2.post1.dist-info}/METADATA +1 -1
- {xinference-0.11.2.dist-info → xinference-0.11.2.post1.dist-info}/RECORD +8 -8
- {xinference-0.11.2.dist-info → xinference-0.11.2.post1.dist-info}/LICENSE +0 -0
- {xinference-0.11.2.dist-info → xinference-0.11.2.post1.dist-info}/WHEEL +0 -0
- {xinference-0.11.2.dist-info → xinference-0.11.2.post1.dist-info}/entry_points.txt +0 -0
- {xinference-0.11.2.dist-info → xinference-0.11.2.post1.dist-info}/top_level.txt +0 -0
xinference/_version.py
CHANGED
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2024-05-
|
|
11
|
+
"date": "2024-05-24T19:39:58+0800",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "0.11.2"
|
|
14
|
+
"full-revisionid": "ac8f33439c25e6fb05eba79e7932cbbadd068174",
|
|
15
|
+
"version": "0.11.2.post1"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -21,9 +21,7 @@ from typing import Dict, Iterator, List, Optional, Tuple, Union
|
|
|
21
21
|
|
|
22
22
|
import requests
|
|
23
23
|
import torch
|
|
24
|
-
import torchvision.transforms as T
|
|
25
24
|
from PIL import Image
|
|
26
|
-
from torchvision.transforms.functional import InterpolationMode
|
|
27
25
|
|
|
28
26
|
from ....model.utils import select_device
|
|
29
27
|
from ....types import (
|
|
@@ -205,47 +203,6 @@ class InternVLChatModel(PytorchChatModel):
|
|
|
205
203
|
history.append(tuple(tmp))
|
|
206
204
|
return history, pixel_values
|
|
207
205
|
|
|
208
|
-
def _load_image(_url):
|
|
209
|
-
if _url.startswith("data:"):
|
|
210
|
-
logging.info("Parse url by base64 decoder.")
|
|
211
|
-
# https://platform.openai.com/docs/guides/vision/uploading-base-64-encoded-images
|
|
212
|
-
# e.g. f"data:image/jpeg;base64,{base64_image}"
|
|
213
|
-
_type, data = _url.split(";")
|
|
214
|
-
_, ext = _type.split("/")
|
|
215
|
-
data = data[len("base64,") :]
|
|
216
|
-
data = base64.b64decode(data.encode("utf-8"))
|
|
217
|
-
|
|
218
|
-
return Image.open(BytesIO(data)).convert("RGB")
|
|
219
|
-
else:
|
|
220
|
-
try:
|
|
221
|
-
response = requests.get(_url)
|
|
222
|
-
except requests.exceptions.MissingSchema:
|
|
223
|
-
return Image.open(_url).convert("RGB")
|
|
224
|
-
else:
|
|
225
|
-
return Image.open(BytesIO(response.content)).convert("RGB")
|
|
226
|
-
|
|
227
|
-
if not isinstance(content, str):
|
|
228
|
-
texts = []
|
|
229
|
-
image_urls = []
|
|
230
|
-
for c in content:
|
|
231
|
-
c_type = c.get("type")
|
|
232
|
-
if c_type == "text":
|
|
233
|
-
texts.append(c["text"])
|
|
234
|
-
elif c_type == "image_url":
|
|
235
|
-
image_urls.append(c["image_url"]["url"])
|
|
236
|
-
image_futures = []
|
|
237
|
-
with ThreadPoolExecutor() as executor:
|
|
238
|
-
for image_url in image_urls:
|
|
239
|
-
fut = executor.submit(_load_image, image_url)
|
|
240
|
-
image_futures.append(fut)
|
|
241
|
-
images = [fut.result() for fut in image_futures]
|
|
242
|
-
text = " ".join(texts)
|
|
243
|
-
if len(images) == 0:
|
|
244
|
-
return text
|
|
245
|
-
else:
|
|
246
|
-
return text, images
|
|
247
|
-
return content
|
|
248
|
-
|
|
249
206
|
def _find_closest_aspect_ratio(
|
|
250
207
|
self, aspect_ratio, target_ratios, width, height, image_size
|
|
251
208
|
):
|
|
@@ -309,6 +266,9 @@ class InternVLChatModel(PytorchChatModel):
|
|
|
309
266
|
return processed_images
|
|
310
267
|
|
|
311
268
|
def _build_transform(self, input_size):
|
|
269
|
+
import torchvision.transforms as T
|
|
270
|
+
from torchvision.transforms.functional import InterpolationMode
|
|
271
|
+
|
|
312
272
|
MEAN, STD = IMAGENET_MEAN, IMAGENET_STD
|
|
313
273
|
transform = T.Compose(
|
|
314
274
|
[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
xinference/__init__.py,sha256=0LgIveLP6CXxoIaSrxhlFyOh0lOqPgJBVcBe0tkWJjc,987
|
|
2
2
|
xinference/_compat.py,sha256=SQAjZMGxtBIce45qtW7ob7RWzA0zhv2yB3AxT0rb0uU,1778
|
|
3
|
-
xinference/_version.py,sha256=
|
|
3
|
+
xinference/_version.py,sha256=mDJV0U5DkMVMiU2azZlEJ4w5LINeGsZFYONO9K3d4d0,504
|
|
4
4
|
xinference/conftest.py,sha256=Qus4KWCeaKS7c5UgNCTpPNucD2bjV8P7u1_qRosgGno,9743
|
|
5
5
|
xinference/constants.py,sha256=Bu_fOJUGAvvqF_6FY5OzOHl7fQ1Nomek3LY17xr9oz4,2882
|
|
6
6
|
xinference/device_utils.py,sha256=zswJiws3VyTIaNO8z-MOcsJH_UiPoePPiKK5zoNrjTA,3285
|
|
@@ -85,7 +85,7 @@ xinference/model/llm/pytorch/compression.py,sha256=U0vMJ-JaBt4oC2LffgWg6HbPj1CeU
|
|
|
85
85
|
xinference/model/llm/pytorch/core.py,sha256=VGJfZ92e3SftQXrOwxiYMUSF1YnWSUU8Z8WHr6yzpJ8,19984
|
|
86
86
|
xinference/model/llm/pytorch/deepseek_vl.py,sha256=T9DKP4cULvRaHSiU08lOWd_j6mt8b3ZIBByneZ0jY8U,11498
|
|
87
87
|
xinference/model/llm/pytorch/falcon.py,sha256=POSP7vzRJaM5PjvX8dh60jNDXgnCwktwSmeZ7kypQU0,4499
|
|
88
|
-
xinference/model/llm/pytorch/intern_vl.py,sha256=
|
|
88
|
+
xinference/model/llm/pytorch/intern_vl.py,sha256=MlP7vcp0qu7ehSg3Z7_qe18aiepi3KKjN9N9P-qVTwM,13166
|
|
89
89
|
xinference/model/llm/pytorch/internlm2.py,sha256=vjspoc2VHbuD1JaUtjt0sOq9MwvRr2OD3_tKQhBVUPc,7244
|
|
90
90
|
xinference/model/llm/pytorch/llama_2.py,sha256=HMhUmn4oYW2maeSMIr1yY7jlAOMD0OVAxnF0dnRWmio,3710
|
|
91
91
|
xinference/model/llm/pytorch/omnilmm.py,sha256=4r6pipch1LU1FPA80sOCE7Z0k3TO_J8CIT7pmVmWKEM,5664
|
|
@@ -15423,9 +15423,9 @@ xinference/web/ui/node_modules/yargs-parser/package.json,sha256=BSwbOzgetKXMK4u0
|
|
|
15423
15423
|
xinference/web/ui/node_modules/yocto-queue/package.json,sha256=6U1XHQPGXJTqsiFvT953ORihUtXTblZy4fXBWP9qxC0,725
|
|
15424
15424
|
xinference/web/ui/node_modules/yup/package.json,sha256=xRFSROB9NKxqSWHEVFvSTsPs9Ll074uo8OS1zEw0qhA,1206
|
|
15425
15425
|
xinference/web/ui/node_modules/yup/node_modules/type-fest/package.json,sha256=JTv2zTTVgxQ2H82m1-6qEpdMv08lHjFx4Puf_MsbB_Q,1134
|
|
15426
|
-
xinference-0.11.2.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
15427
|
-
xinference-0.11.2.dist-info/METADATA,sha256=
|
|
15428
|
-
xinference-0.11.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
15429
|
-
xinference-0.11.2.dist-info/entry_points.txt,sha256=-lDyyzqWMFQF0Rgm7VxBNz0V-bMBMQLRR3pvQ-Y8XTY,226
|
|
15430
|
-
xinference-0.11.2.dist-info/top_level.txt,sha256=L1rQt7pl6m8tmKXpWVHzP-GtmzAxp663rXxGE7qnK00,11
|
|
15431
|
-
xinference-0.11.2.dist-info/RECORD,,
|
|
15426
|
+
xinference-0.11.2.post1.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
15427
|
+
xinference-0.11.2.post1.dist-info/METADATA,sha256=gwgZIL72lulJsk-4NasdYTQc5vxs5ibTFRjrf9TMgJc,15548
|
|
15428
|
+
xinference-0.11.2.post1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
15429
|
+
xinference-0.11.2.post1.dist-info/entry_points.txt,sha256=-lDyyzqWMFQF0Rgm7VxBNz0V-bMBMQLRR3pvQ-Y8XTY,226
|
|
15430
|
+
xinference-0.11.2.post1.dist-info/top_level.txt,sha256=L1rQt7pl6m8tmKXpWVHzP-GtmzAxp663rXxGE7qnK00,11
|
|
15431
|
+
xinference-0.11.2.post1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|