corvic-engine 0.3.0rc83__cp38-abi3-win_amd64.whl → 0.3.0rc85__cp38-abi3-win_amd64.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.
- corvic/engine/_native.pyd +0 -0
- corvic/system/_embedder.py +0 -8
- corvic/system/_image_embedder.py +28 -16
- corvic/system/in_memory_executor.py +1 -2
- corvic/system/staging.py +1 -1
- corvic/system_sqlite/staging.py +1 -1
- {corvic_engine-0.3.0rc83.dist-info → corvic_engine-0.3.0rc85.dist-info}/METADATA +2 -1
- {corvic_engine-0.3.0rc83.dist-info → corvic_engine-0.3.0rc85.dist-info}/RECORD +10 -10
- {corvic_engine-0.3.0rc83.dist-info → corvic_engine-0.3.0rc85.dist-info}/WHEEL +0 -0
- {corvic_engine-0.3.0rc83.dist-info → corvic_engine-0.3.0rc85.dist-info}/licenses/LICENSE +0 -0
corvic/engine/_native.pyd
CHANGED
Binary file
|
corvic/system/_embedder.py
CHANGED
@@ -39,10 +39,6 @@ class EmbedTextResult:
|
|
39
39
|
class TextEmbedder(Protocol):
|
40
40
|
"""Use a model to embed text."""
|
41
41
|
|
42
|
-
def embed(
|
43
|
-
self, context: EmbedTextContext
|
44
|
-
) -> Ok[EmbedTextResult] | InvalidArgumentError | InternalError: ...
|
45
|
-
|
46
42
|
async def aembed(
|
47
43
|
self,
|
48
44
|
context: EmbedTextContext,
|
@@ -74,10 +70,6 @@ class ImageEmbedder(Protocol):
|
|
74
70
|
@classmethod
|
75
71
|
def model_name(cls) -> str: ...
|
76
72
|
|
77
|
-
def embed(
|
78
|
-
self, context: EmbedImageContext
|
79
|
-
) -> Ok[EmbedImageResult] | InvalidArgumentError | InternalError: ...
|
80
|
-
|
81
73
|
async def aembed(
|
82
74
|
self,
|
83
75
|
context: EmbedImageContext,
|
corvic/system/_image_embedder.py
CHANGED
@@ -3,7 +3,7 @@ import asyncio
|
|
3
3
|
import dataclasses
|
4
4
|
from concurrent.futures import ThreadPoolExecutor
|
5
5
|
from io import BytesIO
|
6
|
-
from typing import TYPE_CHECKING, Any, cast
|
6
|
+
from typing import TYPE_CHECKING, Any, Protocol, cast
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
import polars as pl
|
@@ -17,8 +17,7 @@ from corvic.system._embedder import (
|
|
17
17
|
|
18
18
|
if TYPE_CHECKING:
|
19
19
|
from PIL import Image
|
20
|
-
from
|
21
|
-
from transformers.models.auto.processing_auto import AutoProcessor
|
20
|
+
from torch import FloatTensor
|
22
21
|
|
23
22
|
|
24
23
|
class RandomImageEmbedder(ImageEmbedder):
|
@@ -77,10 +76,23 @@ def image_from_bytes(
|
|
77
76
|
return InvalidArgumentError("invalid image format")
|
78
77
|
|
79
78
|
|
79
|
+
class TransformersImageModel(Protocol):
|
80
|
+
"""Generic class for a Model from transformers."""
|
81
|
+
|
82
|
+
def eval(self): ...
|
83
|
+
def get_image_features(*, pixel_values: "FloatTensor") -> "FloatTensor": ...
|
84
|
+
|
85
|
+
|
86
|
+
class TransformersProcessor(Protocol):
|
87
|
+
"""Generic class for a Processor from transformers."""
|
88
|
+
|
89
|
+
def __call__(self, *, images: list["Image.Image"], return_tensors: str): ...
|
90
|
+
|
91
|
+
|
80
92
|
@dataclasses.dataclass
|
81
93
|
class LoadedModels:
|
82
|
-
model:
|
83
|
-
processor:
|
94
|
+
model: TransformersImageModel
|
95
|
+
processor: TransformersProcessor
|
84
96
|
|
85
97
|
|
86
98
|
class HFModelImageEmbedder(ImageEmbedder):
|
@@ -91,7 +103,7 @@ class HFModelImageEmbedder(ImageEmbedder):
|
|
91
103
|
def model_revision(cls) -> str: ...
|
92
104
|
|
93
105
|
@abc.abstractmethod
|
94
|
-
def
|
106
|
+
def load_models(self) -> LoadedModels: ...
|
95
107
|
|
96
108
|
def embed(
|
97
109
|
self, context: EmbedImageContext
|
@@ -122,19 +134,19 @@ class HFModelImageEmbedder(ImageEmbedder):
|
|
122
134
|
)
|
123
135
|
)
|
124
136
|
|
125
|
-
models = self.
|
137
|
+
models = self.load_models()
|
126
138
|
model = models.model
|
127
139
|
processor = models.processor
|
128
|
-
model.eval()
|
140
|
+
model.eval()
|
129
141
|
|
130
142
|
import torch
|
131
143
|
|
132
144
|
with torch.no_grad():
|
133
145
|
inputs = cast(
|
134
146
|
dict[str, torch.FloatTensor],
|
135
|
-
processor(images=images, return_tensors="pt"),
|
147
|
+
processor(images=images, return_tensors="pt"),
|
136
148
|
)
|
137
|
-
image_features = model.get_image_features(
|
149
|
+
image_features = model.get_image_features(
|
138
150
|
pixel_values=inputs["pixel_values"]
|
139
151
|
)
|
140
152
|
|
@@ -181,21 +193,21 @@ class Clip(HFModelImageEmbedder):
|
|
181
193
|
def model_revision(cls) -> str:
|
182
194
|
return "5812e510083bb2d23fa43778a39ac065d205ed4d"
|
183
195
|
|
184
|
-
def
|
196
|
+
def load_models(self) -> LoadedModels:
|
185
197
|
from transformers.models.clip import (
|
186
198
|
CLIPModel,
|
187
199
|
CLIPProcessor,
|
188
200
|
)
|
189
201
|
|
190
202
|
model = cast(
|
191
|
-
|
203
|
+
TransformersImageModel,
|
192
204
|
CLIPModel.from_pretrained( # pyright: ignore[reportUnknownMemberType]
|
193
205
|
pretrained_model_name_or_path=self.model_name(),
|
194
206
|
revision=self.model_revision(),
|
195
207
|
),
|
196
208
|
)
|
197
209
|
processor = cast(
|
198
|
-
|
210
|
+
TransformersProcessor,
|
199
211
|
CLIPProcessor.from_pretrained( # pyright: ignore[reportUnknownMemberType]
|
200
212
|
pretrained_model_name_or_path=self.model_name(),
|
201
213
|
revision=self.model_revision(),
|
@@ -216,12 +228,12 @@ class SigLIP2(HFModelImageEmbedder):
|
|
216
228
|
def model_revision(cls) -> str:
|
217
229
|
return "a89f5c5093f902bf39d3cd4d81d2c09867f0724b"
|
218
230
|
|
219
|
-
def
|
231
|
+
def load_models(self):
|
220
232
|
from transformers.models.auto.modeling_auto import AutoModel
|
221
233
|
from transformers.models.auto.processing_auto import AutoProcessor
|
222
234
|
|
223
235
|
model = cast(
|
224
|
-
|
236
|
+
TransformersImageModel,
|
225
237
|
AutoModel.from_pretrained( # pyright: ignore[reportUnknownMemberType]
|
226
238
|
pretrained_model_name_or_path=self.model_name(),
|
227
239
|
revision=self.model_revision(),
|
@@ -229,7 +241,7 @@ class SigLIP2(HFModelImageEmbedder):
|
|
229
241
|
),
|
230
242
|
)
|
231
243
|
processor = cast(
|
232
|
-
|
244
|
+
TransformersProcessor,
|
233
245
|
AutoProcessor.from_pretrained( # pyright: ignore[reportUnknownMemberType]
|
234
246
|
pretrained_model_name_or_path=self.model_name(),
|
235
247
|
revision=self.model_revision(),
|
@@ -1539,8 +1539,7 @@ class InMemoryExecutor(OpGraphExecutor):
|
|
1539
1539
|
case Ok(query):
|
1540
1540
|
pass
|
1541
1541
|
return (
|
1542
|
-
await
|
1543
|
-
self._staging_db.run_select_query,
|
1542
|
+
await self._staging_db.run_select_query(
|
1544
1543
|
query,
|
1545
1544
|
expected_schema,
|
1546
1545
|
context.current_slice_args,
|
corvic/system/staging.py
CHANGED
corvic/system_sqlite/staging.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: corvic-engine
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.0rc85
|
4
4
|
Classifier: Environment :: Console
|
5
5
|
Classifier: License :: Other/Proprietary License
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
@@ -27,6 +27,7 @@ Requires-Dist: pillow>=10.0.0 ; extra == 'ml'
|
|
27
27
|
Requires-Dist: scikit-learn>=1.4.0 ; extra == 'ml'
|
28
28
|
Requires-Dist: transformers[torch]>=4.45.0 ; extra == 'ml'
|
29
29
|
Requires-Dist: sentencepiece>=0.2.0 ; extra == 'ml'
|
30
|
+
Requires-Dist: torchvision==0.22.1 ; extra == 'ml'
|
30
31
|
Requires-Dist: opentelemetry-api>=1.20.0 ; extra == 'telemetry'
|
31
32
|
Requires-Dist: opentelemetry-sdk>=1.20.0 ; extra == 'telemetry'
|
32
33
|
Provides-Extra: ml
|
@@ -25,7 +25,7 @@ corvic/emodel/_source.py,sha256=yWZeYHX_jFIwqRZ1eUHIMN9Gu8EIYEZ8fmXDO6QpfyQ,9799
|
|
25
25
|
corvic/emodel/_space.py,sha256=ewAGHHVY4tkoMRjyKwAvLq_3Zky8Zaa7k3DEbhkhM7E,38549
|
26
26
|
corvic/emodel/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
27
|
corvic/engine/__init__.py,sha256=XL4Vg7rNcBi29ccVelpeFizR9oJtGYXDn84W9zok9d4,975
|
28
|
-
corvic/engine/_native.pyd,sha256=
|
28
|
+
corvic/engine/_native.pyd,sha256=P11yaiVhGrz1RBR_GKA93caLSLzHA6hNHTY03-ajVnU,438272
|
29
29
|
corvic/engine/_native.pyi,sha256=KYMPtvXqHZ-jMgZohLf4se3rr-rBpCihmjANcr6s8ag,1390
|
30
30
|
corvic/engine/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
31
|
corvic/eorm/__init__.py,sha256=b4dFnu4fW7wj3Y0SMNVXOp8KoKOp_HAL4GyDN-S8fOY,13704
|
@@ -71,22 +71,22 @@ corvic/sql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
71
|
corvic/system/__init__.py,sha256=PlsjTRklExrPA83n-PM5CqVmNcIQdIRhFHn3tZ0qh1Q,2765
|
72
72
|
corvic/system/_column_encoding.py,sha256=feSWIv4vKstVq-aavWPk53YucUiq7rZvuyofqTicXBE,7574
|
73
73
|
corvic/system/_dimension_reduction.py,sha256=2tg5SIHY4P480DJQj6PSjW1VgAJCAVJAH8D3BY-ZYXA,2964
|
74
|
-
corvic/system/_embedder.py,sha256=
|
75
|
-
corvic/system/_image_embedder.py,sha256=
|
74
|
+
corvic/system/_embedder.py,sha256=5_dXBxfeXnjuCRexTLhGWVpZ9OW9CLZDcYzxZMHgiD0,6653
|
75
|
+
corvic/system/_image_embedder.py,sha256=O2hOEtSIoQRrf_xoRnPpSNGn_-aGZC-X1DPfuWykWPU,13003
|
76
76
|
corvic/system/_planner.py,sha256=ecL-HW8PVz5eWJ1Ktf-RAD2IdZkHu3GuBtXdqElo4ts,8210
|
77
77
|
corvic/system/_text_embedder.py,sha256=NDi--3_tzwIWVImjhFWmp8dHmydGGXNu6GYH8qODsIc,4000
|
78
78
|
corvic/system/client.py,sha256=JcA-fPraqDkl9f8BiClS0qeGY6wzKcEDPymutWrJo54,812
|
79
|
-
corvic/system/in_memory_executor.py,sha256=
|
79
|
+
corvic/system/in_memory_executor.py,sha256=4Wyi5pTCBVlsXJFansx1LT7OmfubzN7Hg6j1Uw8_8wo,66410
|
80
80
|
corvic/system/op_graph_executor.py,sha256=tSKro-yb_y1_sgajZluM-6FCvDqO1oUPsiWw2DRxyMQ,3641
|
81
81
|
corvic/system/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
82
|
-
corvic/system/staging.py,sha256=
|
82
|
+
corvic/system/staging.py,sha256=8XasqXY887n--lrcvp0E_nYnAz_D5_sqAZzgZP5PRoQ,1852
|
83
83
|
corvic/system/storage.py,sha256=bp9llPmE6PwFta_9bhZ6d785ba3wbEysaL_0EzdAjPs,5575
|
84
84
|
corvic/system_sqlite/__init__.py,sha256=F4UN9vFsXiDY2AKk1jYZPuWWJpSugKHS7ghXeZYlbZs,390
|
85
85
|
corvic/system_sqlite/client.py,sha256=OqX2-3sjYzzkuZXRDTBDjfiDzzLx1jNSud7fXp8CO0A,7486
|
86
86
|
corvic/system_sqlite/fs_blob_store.py,sha256=NTLzLFd56QNqA-iCxNjFAC-YePfXqWWTO9i_o1dJRr0,8563
|
87
87
|
corvic/system_sqlite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
88
|
corvic/system_sqlite/rdbms_blob_store.py,sha256=gTP_tQfTVb3wzZkzo8ys1zaz0rSrERzb57rqMHVpuBA,10563
|
89
|
-
corvic/system_sqlite/staging.py,sha256=
|
89
|
+
corvic/system_sqlite/staging.py,sha256=KoSIWV0xA6n8PnsSWSbITFZnYKc_UjYqW-Vx2o16jW4,17338
|
90
90
|
corvic/table/__init__.py,sha256=Gj0IR8BQF5PZK92Us7PP0ZigMsVyrfWJupzH8TgzRQk,588
|
91
91
|
corvic/table/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
92
92
|
corvic/table/table.py,sha256=fvt6G20Jz1Cfhf9zrmYIDPjUR4lGAWKjlx4eWKvoqtk,25815
|
@@ -98,9 +98,9 @@ corvic/version/__init__.py,sha256=JlkRLvKXsu3zIxhdynO_0Ub5NfQOvGjfwCRkNnaOu9U,11
|
|
98
98
|
corvic/version/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
99
99
|
corvic/well_known_types/__init__.py,sha256=Btbeqieik2AcmijeOXeqBptzueBpgNitvH9J5VNm12w,1289
|
100
100
|
corvic/well_known_types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
101
|
-
corvic_engine-0.3.
|
102
|
-
corvic_engine-0.3.
|
103
|
-
corvic_engine-0.3.
|
101
|
+
corvic_engine-0.3.0rc85.dist-info/METADATA,sha256=b7VKq6Fo9qmnMARWRMYQvtnZs_jvOvYVxlF-j4qaUYE,1879
|
102
|
+
corvic_engine-0.3.0rc85.dist-info/WHEEL,sha256=U8GAVPGuk_i_fNfXAys1dgH7mS1u7uA5UI-r13T9uEs,94
|
103
|
+
corvic_engine-0.3.0rc85.dist-info/licenses/LICENSE,sha256=DSS1OD0oIgssKOmAzkMRBv5jvvVuZQbrIv8lpl9DXY8,1035
|
104
104
|
corvic_generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
105
105
|
corvic_generated/algorithm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
106
106
|
corvic_generated/algorithm/graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -211,4 +211,4 @@ corvic_generated/status/v1/service_pb2.py,sha256=CKXPX2ahq8O4cFhPpt6wo6l--6VZcgj
|
|
211
211
|
corvic_generated/status/v1/service_pb2.pyi,sha256=iXLR2FOKQJpBgvBzpD2kVwcYOCksP2aRwK4JYaI9CBw,558
|
212
212
|
corvic_generated/status/v1/service_pb2_grpc.py,sha256=y-a5ldrphWlNJW-yKswyjNmXokK4-5bbEEfczjagJHo,2736
|
213
213
|
corvic_generated/status/v1/service_pb2_grpc.pyi,sha256=OoAnaZ64FD0UTzPoRhYvQU8ecoilhHj3ySjSfHbVDaU,1501
|
214
|
-
corvic_engine-0.3.
|
214
|
+
corvic_engine-0.3.0rc85.dist-info/RECORD,,
|
File without changes
|
File without changes
|