pixeltable 0.3.6__py3-none-any.whl → 0.3.8__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 pixeltable might be problematic. Click here for more details.
- pixeltable/__init__.py +5 -3
- pixeltable/__version__.py +2 -2
- pixeltable/catalog/__init__.py +1 -0
- pixeltable/catalog/catalog.py +335 -128
- pixeltable/catalog/column.py +22 -5
- pixeltable/catalog/dir.py +19 -6
- pixeltable/catalog/insertable_table.py +34 -37
- pixeltable/catalog/named_function.py +0 -4
- pixeltable/catalog/schema_object.py +28 -42
- pixeltable/catalog/table.py +193 -158
- pixeltable/catalog/table_version.py +191 -232
- pixeltable/catalog/table_version_handle.py +50 -0
- pixeltable/catalog/table_version_path.py +49 -33
- pixeltable/catalog/view.py +56 -96
- pixeltable/config.py +103 -0
- pixeltable/dataframe.py +89 -89
- pixeltable/env.py +98 -168
- pixeltable/exec/aggregation_node.py +5 -4
- pixeltable/exec/cache_prefetch_node.py +1 -1
- pixeltable/exec/component_iteration_node.py +13 -9
- pixeltable/exec/data_row_batch.py +3 -3
- pixeltable/exec/exec_context.py +0 -4
- pixeltable/exec/exec_node.py +3 -2
- pixeltable/exec/expr_eval/schedulers.py +2 -1
- pixeltable/exec/in_memory_data_node.py +9 -4
- pixeltable/exec/row_update_node.py +1 -2
- pixeltable/exec/sql_node.py +20 -16
- pixeltable/exprs/__init__.py +2 -0
- pixeltable/exprs/arithmetic_expr.py +7 -11
- pixeltable/exprs/array_slice.py +1 -1
- pixeltable/exprs/column_property_ref.py +3 -3
- pixeltable/exprs/column_ref.py +12 -13
- pixeltable/exprs/comparison.py +3 -6
- pixeltable/exprs/compound_predicate.py +4 -4
- pixeltable/exprs/expr.py +31 -22
- pixeltable/exprs/expr_dict.py +3 -3
- pixeltable/exprs/expr_set.py +1 -1
- pixeltable/exprs/function_call.py +110 -80
- pixeltable/exprs/globals.py +3 -3
- pixeltable/exprs/in_predicate.py +1 -1
- pixeltable/exprs/inline_expr.py +3 -3
- pixeltable/exprs/is_null.py +1 -1
- pixeltable/exprs/json_mapper.py +2 -2
- pixeltable/exprs/json_path.py +17 -10
- pixeltable/exprs/literal.py +1 -1
- pixeltable/exprs/method_ref.py +2 -2
- pixeltable/exprs/row_builder.py +8 -17
- pixeltable/exprs/rowid_ref.py +21 -10
- pixeltable/exprs/similarity_expr.py +5 -5
- pixeltable/exprs/sql_element_cache.py +1 -1
- pixeltable/exprs/type_cast.py +2 -3
- pixeltable/exprs/variable.py +2 -2
- pixeltable/ext/__init__.py +2 -0
- pixeltable/ext/functions/__init__.py +2 -0
- pixeltable/ext/functions/yolox.py +3 -3
- pixeltable/func/__init__.py +3 -1
- pixeltable/func/aggregate_function.py +9 -9
- pixeltable/func/callable_function.py +3 -4
- pixeltable/func/expr_template_function.py +6 -16
- pixeltable/func/function.py +48 -14
- pixeltable/func/function_registry.py +1 -3
- pixeltable/func/query_template_function.py +5 -12
- pixeltable/func/signature.py +23 -22
- pixeltable/func/tools.py +3 -3
- pixeltable/func/udf.py +6 -4
- pixeltable/functions/__init__.py +2 -0
- pixeltable/functions/fireworks.py +7 -4
- pixeltable/functions/globals.py +4 -5
- pixeltable/functions/huggingface.py +1 -5
- pixeltable/functions/image.py +17 -7
- pixeltable/functions/llama_cpp.py +1 -1
- pixeltable/functions/mistralai.py +1 -1
- pixeltable/functions/ollama.py +4 -4
- pixeltable/functions/openai.py +19 -19
- pixeltable/functions/string.py +23 -30
- pixeltable/functions/timestamp.py +11 -6
- pixeltable/functions/together.py +14 -12
- pixeltable/functions/util.py +1 -1
- pixeltable/functions/video.py +5 -4
- pixeltable/functions/vision.py +6 -9
- pixeltable/functions/whisper.py +3 -3
- pixeltable/globals.py +246 -260
- pixeltable/index/__init__.py +2 -0
- pixeltable/index/base.py +1 -1
- pixeltable/index/btree.py +3 -1
- pixeltable/index/embedding_index.py +11 -5
- pixeltable/io/external_store.py +11 -12
- pixeltable/io/label_studio.py +4 -3
- pixeltable/io/parquet.py +57 -56
- pixeltable/iterators/__init__.py +4 -2
- pixeltable/iterators/audio.py +11 -11
- pixeltable/iterators/document.py +10 -10
- pixeltable/iterators/string.py +1 -2
- pixeltable/iterators/video.py +14 -15
- pixeltable/metadata/__init__.py +9 -5
- pixeltable/metadata/converters/convert_10.py +0 -1
- pixeltable/metadata/converters/convert_15.py +0 -2
- pixeltable/metadata/converters/convert_23.py +0 -2
- pixeltable/metadata/converters/convert_24.py +3 -3
- pixeltable/metadata/converters/convert_25.py +1 -1
- pixeltable/metadata/converters/convert_27.py +0 -2
- pixeltable/metadata/converters/convert_28.py +0 -2
- pixeltable/metadata/converters/convert_29.py +7 -8
- pixeltable/metadata/converters/util.py +7 -7
- pixeltable/metadata/schema.py +27 -19
- pixeltable/plan.py +68 -40
- pixeltable/share/__init__.py +2 -0
- pixeltable/share/packager.py +15 -12
- pixeltable/share/publish.py +3 -5
- pixeltable/store.py +37 -38
- pixeltable/type_system.py +41 -28
- pixeltable/utils/coco.py +4 -4
- pixeltable/utils/console_output.py +1 -3
- pixeltable/utils/description_helper.py +1 -1
- pixeltable/utils/documents.py +3 -3
- pixeltable/utils/filecache.py +20 -9
- pixeltable/utils/formatter.py +2 -3
- pixeltable/utils/media_store.py +1 -1
- pixeltable/utils/pytorch.py +1 -1
- pixeltable/utils/sql.py +4 -4
- pixeltable/utils/transactional_directory.py +2 -1
- {pixeltable-0.3.6.dist-info → pixeltable-0.3.8.dist-info}/METADATA +1 -1
- pixeltable-0.3.8.dist-info/RECORD +174 -0
- pixeltable-0.3.6.dist-info/RECORD +0 -172
- {pixeltable-0.3.6.dist-info → pixeltable-0.3.8.dist-info}/LICENSE +0 -0
- {pixeltable-0.3.6.dist-info → pixeltable-0.3.8.dist-info}/WHEEL +0 -0
- {pixeltable-0.3.6.dist-info → pixeltable-0.3.8.dist-info}/entry_points.txt +0 -0
pixeltable/functions/together.py
CHANGED
|
@@ -68,7 +68,7 @@ async def completions(
|
|
|
68
68
|
Generate completions based on a given prompt using a specified model.
|
|
69
69
|
|
|
70
70
|
Equivalent to the Together AI `completions` API endpoint.
|
|
71
|
-
For additional details, see:
|
|
71
|
+
For additional details, see: <https://docs.together.ai/reference/completions-1>
|
|
72
72
|
|
|
73
73
|
Request throttling:
|
|
74
74
|
Applies the rate limit set in the config (section `together.rate_limits`, key `chat`). If no rate
|
|
@@ -82,14 +82,14 @@ async def completions(
|
|
|
82
82
|
prompt: A string providing context for the model to complete.
|
|
83
83
|
model: The name of the model to query.
|
|
84
84
|
|
|
85
|
-
For details on the other parameters, see:
|
|
85
|
+
For details on the other parameters, see: <https://docs.together.ai/reference/completions-1>
|
|
86
86
|
|
|
87
87
|
Returns:
|
|
88
88
|
A dictionary containing the response and other metadata.
|
|
89
89
|
|
|
90
90
|
Examples:
|
|
91
|
-
Add a computed column that applies the model `mistralai/Mixtral-8x7B-v0.1` to an existing Pixeltable column
|
|
92
|
-
of the table `tbl`:
|
|
91
|
+
Add a computed column that applies the model `mistralai/Mixtral-8x7B-v0.1` to an existing Pixeltable column
|
|
92
|
+
`tbl.prompt` of the table `tbl`:
|
|
93
93
|
|
|
94
94
|
>>> tbl.add_computed_column(response=completions(tbl.prompt, model='mistralai/Mixtral-8x7B-v0.1'))
|
|
95
95
|
"""
|
|
@@ -133,7 +133,7 @@ async def chat_completions(
|
|
|
133
133
|
Generate chat completions based on a given prompt using a specified model.
|
|
134
134
|
|
|
135
135
|
Equivalent to the Together AI `chat/completions` API endpoint.
|
|
136
|
-
For additional details, see:
|
|
136
|
+
For additional details, see: <https://docs.together.ai/reference/chat-completions-1>
|
|
137
137
|
|
|
138
138
|
Request throttling:
|
|
139
139
|
Applies the rate limit set in the config (section `together.rate_limits`, key `chat`). If no rate
|
|
@@ -147,14 +147,14 @@ async def chat_completions(
|
|
|
147
147
|
messages: A list of messages comprising the conversation so far.
|
|
148
148
|
model: The name of the model to query.
|
|
149
149
|
|
|
150
|
-
For details on the other parameters, see:
|
|
150
|
+
For details on the other parameters, see: <https://docs.together.ai/reference/chat-completions-1>
|
|
151
151
|
|
|
152
152
|
Returns:
|
|
153
153
|
A dictionary containing the response and other metadata.
|
|
154
154
|
|
|
155
155
|
Examples:
|
|
156
|
-
Add a computed column that applies the model `mistralai/Mixtral-8x7B-v0.1` to an existing Pixeltable column
|
|
157
|
-
of the table `tbl`:
|
|
156
|
+
Add a computed column that applies the model `mistralai/Mixtral-8x7B-v0.1` to an existing Pixeltable column
|
|
157
|
+
`tbl.prompt` of the table `tbl`:
|
|
158
158
|
|
|
159
159
|
>>> messages = [{'role': 'user', 'content': tbl.prompt}]
|
|
160
160
|
... tbl.add_computed_column(response=chat_completions(messages, model='mistralai/Mixtral-8x7B-v0.1'))
|
|
@@ -197,7 +197,7 @@ async def embeddings(input: Batch[str], *, model: str) -> Batch[pxt.Array[(None,
|
|
|
197
197
|
Query an embedding model for a given string of text.
|
|
198
198
|
|
|
199
199
|
Equivalent to the Together AI `embeddings` API endpoint.
|
|
200
|
-
For additional details, see:
|
|
200
|
+
For additional details, see: <https://docs.together.ai/reference/embeddings-2>
|
|
201
201
|
|
|
202
202
|
Request throttling:
|
|
203
203
|
Applies the rate limit set in the config (section `together.rate_limits`, key `embeddings`). If no rate
|
|
@@ -248,7 +248,7 @@ async def image_generations(
|
|
|
248
248
|
Generate images based on a given prompt using a specified model.
|
|
249
249
|
|
|
250
250
|
Equivalent to the Together AI `images/generations` API endpoint.
|
|
251
|
-
For additional details, see:
|
|
251
|
+
For additional details, see: <https://docs.together.ai/reference/post_images-generations>
|
|
252
252
|
|
|
253
253
|
Request throttling:
|
|
254
254
|
Applies the rate limit set in the config (section `together.rate_limits`, key `images`). If no rate
|
|
@@ -262,7 +262,7 @@ async def image_generations(
|
|
|
262
262
|
prompt: A description of the desired images.
|
|
263
263
|
model: The model to use for image generation.
|
|
264
264
|
|
|
265
|
-
For details on the other parameters, see:
|
|
265
|
+
For details on the other parameters, see: <https://docs.together.ai/reference/post_images-generations>
|
|
266
266
|
|
|
267
267
|
Returns:
|
|
268
268
|
The generated image.
|
|
@@ -271,7 +271,9 @@ async def image_generations(
|
|
|
271
271
|
Add a computed column that applies the model `stabilityai/stable-diffusion-xl-base-1.0`
|
|
272
272
|
to an existing Pixeltable column `tbl.prompt` of the table `tbl`:
|
|
273
273
|
|
|
274
|
-
>>> tbl.add_computed_column(
|
|
274
|
+
>>> tbl.add_computed_column(
|
|
275
|
+
... response=image_generations(tbl.prompt, model='stabilityai/stable-diffusion-xl-base-1.0')
|
|
276
|
+
... )
|
|
275
277
|
"""
|
|
276
278
|
result = await _together_client().images.generate(
|
|
277
279
|
prompt=prompt, model=model, steps=steps, seed=seed, height=height, width=width, negative_prompt=negative_prompt
|
pixeltable/functions/util.py
CHANGED
|
@@ -21,7 +21,7 @@ def normalize_image_mode(image: PIL.Image.Image) -> PIL.Image.Image:
|
|
|
21
21
|
Converts grayscale images to 3-channel for compatibility with models that only work with
|
|
22
22
|
multichannel input.
|
|
23
23
|
"""
|
|
24
|
-
if image.mode
|
|
24
|
+
if image.mode in {'1', 'L'}:
|
|
25
25
|
return image.convert('RGB')
|
|
26
26
|
if image.mode == 'LA':
|
|
27
27
|
return image.convert('RGBA')
|
pixeltable/functions/video.py
CHANGED
|
@@ -21,18 +21,19 @@ import numpy as np
|
|
|
21
21
|
import PIL.Image
|
|
22
22
|
|
|
23
23
|
import pixeltable as pxt
|
|
24
|
-
|
|
24
|
+
from pixeltable import env
|
|
25
25
|
from pixeltable.utils.code import local_public_names
|
|
26
26
|
|
|
27
27
|
_format_defaults = { # format -> (codec, ext)
|
|
28
28
|
'wav': ('pcm_s16le', 'wav'),
|
|
29
29
|
'mp3': ('libmp3lame', 'mp3'),
|
|
30
30
|
'flac': ('flac', 'flac'),
|
|
31
|
-
#'mp4': ('aac', 'm4a'),
|
|
31
|
+
# 'mp4': ('aac', 'm4a'),
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
# for mp4:
|
|
35
|
-
# - extract_audio() fails with
|
|
35
|
+
# - extract_audio() fails with
|
|
36
|
+
# "Application provided invalid, non monotonically increasing dts to muxer in stream 0: 1146 >= 290"
|
|
36
37
|
# - chatgpt suggests this can be fixed in the following manner
|
|
37
38
|
# for packet in container.demux(audio_stream):
|
|
38
39
|
# packet.pts = None # Reset the PTS and DTS to allow FFmpeg to set them automatically
|
|
@@ -142,7 +143,7 @@ def _get_metadata(path: str) -> dict:
|
|
|
142
143
|
|
|
143
144
|
|
|
144
145
|
def __get_stream_metadata(stream: av.stream.Stream) -> dict:
|
|
145
|
-
if stream.type
|
|
146
|
+
if stream.type not in {'audio', 'video'}:
|
|
146
147
|
return {'type': stream.type} # Currently unsupported
|
|
147
148
|
|
|
148
149
|
codec_context = stream.codec_context
|
pixeltable/functions/vision.py
CHANGED
|
@@ -250,7 +250,6 @@ class mean_ap(pxt.Aggregator):
|
|
|
250
250
|
eps = np.finfo(np.float32).eps
|
|
251
251
|
result: dict[int, float] = {}
|
|
252
252
|
for class_idx, tpfp in self.class_tpfp.items():
|
|
253
|
-
a1 = [x['tp'] for x in tpfp]
|
|
254
253
|
tp = np.concatenate([x['tp'] for x in tpfp], axis=0)
|
|
255
254
|
fp = np.concatenate([x['fp'] for x in tpfp], axis=0)
|
|
256
255
|
num_gts = np.sum([x['num_gts'] for x in tpfp])
|
|
@@ -341,16 +340,14 @@ def draw_bounding_boxes(
|
|
|
341
340
|
elif len(labels) != num_boxes:
|
|
342
341
|
raise ValueError('Number of boxes and labels must match')
|
|
343
342
|
|
|
344
|
-
DEFAULT_COLOR = 'white'
|
|
345
343
|
if box_colors is not None:
|
|
346
344
|
if len(box_colors) != num_boxes:
|
|
347
345
|
raise ValueError('Number of boxes and box colors must match')
|
|
346
|
+
elif color is not None:
|
|
347
|
+
box_colors = [color] * num_boxes
|
|
348
348
|
else:
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
else:
|
|
352
|
-
label_colors = __create_label_colors(labels)
|
|
353
|
-
box_colors = [label_colors[label] for label in labels]
|
|
349
|
+
label_colors = __create_label_colors(labels)
|
|
350
|
+
box_colors = [label_colors[label] for label in labels]
|
|
354
351
|
|
|
355
352
|
from PIL import ImageColor, ImageDraw, ImageFont
|
|
356
353
|
|
|
@@ -369,13 +366,13 @@ def draw_bounding_boxes(
|
|
|
369
366
|
|
|
370
367
|
if fill:
|
|
371
368
|
rgb_color = ImageColor.getrgb(color)
|
|
372
|
-
fill_color = rgb_color
|
|
369
|
+
fill_color = (*rgb_color, 100) # semi-transparent
|
|
373
370
|
draw.rectangle(bbox, outline=color, width=width, fill=fill_color) # type: ignore[arg-type]
|
|
374
371
|
else:
|
|
375
372
|
draw.rectangle(bbox, outline=color, width=width) # type: ignore[arg-type]
|
|
376
373
|
|
|
377
374
|
# Now draw labels separately, so they are not obscured by the boxes
|
|
378
|
-
for
|
|
375
|
+
for bbox, label in zip(boxes, labels):
|
|
379
376
|
if label is not None:
|
|
380
377
|
label_str = str(label)
|
|
381
378
|
_, _, text_width, text_height = draw.textbbox((0, 0), label_str, font=txt_font)
|
pixeltable/functions/whisper.py
CHANGED
|
@@ -6,7 +6,7 @@ This UDF will cause Pixeltable to invoke the relevant model locally. In order to
|
|
|
6
6
|
first `pip install openai-whisper`.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
from typing import TYPE_CHECKING, Optional
|
|
9
|
+
from typing import TYPE_CHECKING, Optional, Sequence
|
|
10
10
|
|
|
11
11
|
import pixeltable as pxt
|
|
12
12
|
from pixeltable.env import Env
|
|
@@ -20,7 +20,7 @@ def transcribe(
|
|
|
20
20
|
audio: pxt.Audio,
|
|
21
21
|
*,
|
|
22
22
|
model: str,
|
|
23
|
-
temperature: Optional[
|
|
23
|
+
temperature: Optional[Sequence[float]] = (0.0, 0.2, 0.4, 0.6, 0.8, 1.0),
|
|
24
24
|
compression_ratio_threshold: Optional[float] = 2.4,
|
|
25
25
|
logprob_threshold: Optional[float] = -1.0,
|
|
26
26
|
no_speech_threshold: Optional[float] = 0.6,
|
|
@@ -28,7 +28,7 @@ def transcribe(
|
|
|
28
28
|
initial_prompt: Optional[str] = None,
|
|
29
29
|
word_timestamps: bool = False,
|
|
30
30
|
prepend_punctuations: str = '"\'“¿([{-',
|
|
31
|
-
append_punctuations: str = '"\'.。,,!!??::”)]}、',
|
|
31
|
+
append_punctuations: str = '"\'.。,,!!??::”)]}、', # noqa: RUF001
|
|
32
32
|
decode_options: Optional[dict] = None,
|
|
33
33
|
) -> dict:
|
|
34
34
|
"""
|