pixeltable 0.2.18__py3-none-any.whl → 0.2.20__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 +1 -1
- pixeltable/__version__.py +2 -2
- pixeltable/catalog/insertable_table.py +9 -7
- pixeltable/catalog/table.py +18 -5
- pixeltable/catalog/table_version.py +1 -1
- pixeltable/catalog/view.py +1 -1
- pixeltable/dataframe.py +1 -1
- pixeltable/env.py +140 -40
- pixeltable/exceptions.py +12 -5
- pixeltable/exec/component_iteration_node.py +63 -42
- pixeltable/exprs/__init__.py +1 -2
- pixeltable/exprs/expr.py +5 -6
- pixeltable/exprs/function_call.py +8 -10
- pixeltable/exprs/inline_expr.py +200 -0
- pixeltable/exprs/json_path.py +3 -6
- pixeltable/ext/functions/whisperx.py +2 -0
- pixeltable/ext/functions/yolox.py +5 -3
- pixeltable/functions/huggingface.py +89 -12
- pixeltable/functions/image.py +3 -3
- pixeltable/functions/together.py +37 -16
- pixeltable/functions/vision.py +43 -21
- pixeltable/functions/whisper.py +3 -0
- pixeltable/globals.py +7 -1
- pixeltable/io/globals.py +1 -1
- pixeltable/io/hf_datasets.py +3 -3
- pixeltable/iterators/document.py +1 -1
- pixeltable/metadata/__init__.py +1 -1
- pixeltable/metadata/converters/convert_18.py +1 -1
- pixeltable/metadata/converters/convert_20.py +56 -0
- pixeltable/metadata/converters/util.py +29 -4
- pixeltable/metadata/notes.py +1 -0
- pixeltable/tool/create_test_db_dump.py +15 -4
- pixeltable/type_system.py +3 -1
- pixeltable/utils/filecache.py +126 -79
- pixeltable-0.2.20.dist-info/LICENSE +201 -0
- {pixeltable-0.2.18.dist-info → pixeltable-0.2.20.dist-info}/METADATA +16 -6
- {pixeltable-0.2.18.dist-info → pixeltable-0.2.20.dist-info}/RECORD +39 -39
- pixeltable/exprs/inline_array.py +0 -117
- pixeltable/exprs/inline_dict.py +0 -104
- pixeltable-0.2.18.dist-info/LICENSE +0 -18
- {pixeltable-0.2.18.dist-info → pixeltable-0.2.20.dist-info}/WHEEL +0 -0
- {pixeltable-0.2.18.dist-info → pixeltable-0.2.20.dist-info}/entry_points.txt +0 -0
pixeltable/utils/filecache.py
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from collections import OrderedDict, defaultdict, namedtuple
|
|
4
|
-
import os
|
|
2
|
+
|
|
5
3
|
import glob
|
|
6
|
-
|
|
7
|
-
from time import time
|
|
4
|
+
import hashlib
|
|
8
5
|
import logging
|
|
6
|
+
import os
|
|
7
|
+
import warnings
|
|
8
|
+
from collections import OrderedDict, defaultdict, namedtuple
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
from datetime import datetime, timezone
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Optional
|
|
9
13
|
from uuid import UUID
|
|
10
|
-
import hashlib
|
|
11
14
|
|
|
15
|
+
import pixeltable.exceptions as excs
|
|
12
16
|
from pixeltable.env import Env
|
|
13
17
|
|
|
14
|
-
|
|
15
18
|
_logger = logging.getLogger('pixeltable')
|
|
16
19
|
|
|
20
|
+
@dataclass
|
|
17
21
|
class CacheEntry:
|
|
18
|
-
def __init__(self, key: str, tbl_id: UUID, col_id: int, size: int, last_accessed_ts: int, ext: str):
|
|
19
|
-
self.key = key
|
|
20
|
-
self.tbl_id = tbl_id
|
|
21
|
-
self.col_id = col_id
|
|
22
|
-
self.size = size
|
|
23
|
-
self.last_accessed_ts = last_accessed_ts
|
|
24
|
-
self.ext = ext
|
|
25
22
|
|
|
23
|
+
key: str
|
|
24
|
+
tbl_id: UUID
|
|
25
|
+
col_id: int
|
|
26
|
+
size: int
|
|
27
|
+
last_used: datetime
|
|
28
|
+
ext: str
|
|
29
|
+
|
|
30
|
+
@property
|
|
26
31
|
def path(self) -> Path:
|
|
27
32
|
return Env.get().file_cache_dir / f'{self.tbl_id.hex}_{self.col_id}_{self.key}{self.ext}'
|
|
28
33
|
|
|
@@ -34,7 +39,11 @@ class CacheEntry:
|
|
|
34
39
|
col_id = int(components[1])
|
|
35
40
|
key = components[2]
|
|
36
41
|
file_info = os.stat(str(path))
|
|
37
|
-
|
|
42
|
+
# We use the last modified time (file_info.st_mtime) as the timestamp; `FileCache` will touch the file
|
|
43
|
+
# each time it is retrieved, so that the mtime of the file will always represent the last used time of
|
|
44
|
+
# the cache entry.
|
|
45
|
+
last_used = datetime.fromtimestamp(file_info.st_mtime, tz=timezone.utc)
|
|
46
|
+
return cls(key, tbl_id, col_id, file_info.st_size, last_used, path.suffix)
|
|
38
47
|
|
|
39
48
|
|
|
40
49
|
class FileCache:
|
|
@@ -45,31 +54,60 @@ class FileCache:
|
|
|
45
54
|
access of a cache entries is its file's mtime.
|
|
46
55
|
|
|
47
56
|
TODO:
|
|
48
|
-
- enforce a maximum capacity with LRU eviction
|
|
49
57
|
- implement MRU eviction for queries that exceed the capacity
|
|
50
58
|
"""
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
__instance: Optional[FileCache] = None
|
|
60
|
+
|
|
61
|
+
cache: OrderedDict[str, CacheEntry]
|
|
62
|
+
total_size: int
|
|
63
|
+
capacity_bytes: int
|
|
64
|
+
num_requests: int
|
|
65
|
+
num_hits: int
|
|
66
|
+
num_evictions: int
|
|
67
|
+
keys_retrieved: set[str] # keys retrieved (downloaded or accessed) this session
|
|
68
|
+
keys_evicted_after_retrieval: set[str] # keys that were evicted after having been retrieved this session
|
|
69
|
+
|
|
70
|
+
# A key is added to this set when it is already present in `keys_evicted_this_session` and is downloaded again.
|
|
71
|
+
# In other words, for a key to be added to this set, the following sequence of events must occur in this order:
|
|
72
|
+
# - It is retrieved during this session (either because it was newly downloaded, or because it was in the cache
|
|
73
|
+
# at the start of the session and was accessed at some point during the session)
|
|
74
|
+
# - It is subsequently evicted
|
|
75
|
+
# - It is subsequently retrieved a second time ("download after a previous retrieval")
|
|
76
|
+
# The contents of this set will be used to generate a more informative warning.
|
|
77
|
+
evicted_working_set_keys: set[str]
|
|
78
|
+
new_redownload_witnessed: bool # whether a new re-download has occurred since the last time a warning was issued
|
|
79
|
+
|
|
80
|
+
ColumnStats = namedtuple('FileCacheColumnStats', ('tbl_id', 'col_id', 'num_files', 'total_size'))
|
|
53
81
|
CacheStats = namedtuple(
|
|
54
|
-
'FileCacheStats',
|
|
82
|
+
'FileCacheStats',
|
|
83
|
+
('total_size', 'num_requests', 'num_hits', 'num_evictions', 'column_stats')
|
|
84
|
+
)
|
|
55
85
|
|
|
56
86
|
@classmethod
|
|
57
87
|
def get(cls) -> FileCache:
|
|
58
|
-
if cls.
|
|
59
|
-
cls.
|
|
60
|
-
return cls.
|
|
88
|
+
if cls.__instance is None:
|
|
89
|
+
cls.init()
|
|
90
|
+
return cls.__instance
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def init(cls) -> None:
|
|
94
|
+
cls.__instance = cls()
|
|
61
95
|
|
|
62
96
|
def __init__(self):
|
|
63
|
-
self.cache
|
|
97
|
+
self.cache = OrderedDict()
|
|
64
98
|
self.total_size = 0
|
|
65
|
-
|
|
99
|
+
self.capacity_bytes = Env.get()._file_cache_size_g * (1 << 30)
|
|
66
100
|
self.num_requests = 0
|
|
67
101
|
self.num_hits = 0
|
|
68
102
|
self.num_evictions = 0
|
|
103
|
+
self.keys_retrieved = set()
|
|
104
|
+
self.keys_evicted_after_retrieval = set()
|
|
105
|
+
self.evicted_working_set_keys = set()
|
|
106
|
+
self.new_redownload_witnessed = False
|
|
69
107
|
paths = glob.glob(str(Env.get().file_cache_dir / '*'))
|
|
70
108
|
entries = [CacheEntry.from_file(Path(path_str)) for path_str in paths]
|
|
71
|
-
# we need to insert entries in order
|
|
72
|
-
entries.sort(key=lambda e: e.
|
|
109
|
+
# we need to insert entries in access order
|
|
110
|
+
entries.sort(key=lambda e: e.last_used)
|
|
73
111
|
for entry in entries:
|
|
74
112
|
self.cache[entry.key] = entry
|
|
75
113
|
self.total_size += entry.size
|
|
@@ -82,30 +120,43 @@ class FileCache:
|
|
|
82
120
|
def num_files(self, tbl_id: Optional[UUID] = None) -> int:
|
|
83
121
|
if tbl_id is None:
|
|
84
122
|
return len(self.cache)
|
|
85
|
-
|
|
86
|
-
return len(entries)
|
|
123
|
+
return sum(e.tbl_id == tbl_id for e in self.cache.values())
|
|
87
124
|
|
|
88
|
-
def clear(self, tbl_id: Optional[UUID] = None
|
|
125
|
+
def clear(self, tbl_id: Optional[UUID] = None) -> None:
|
|
89
126
|
"""
|
|
90
127
|
For testing purposes: allow resetting capacity and stats.
|
|
91
128
|
"""
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
129
|
+
if tbl_id is None:
|
|
130
|
+
# We need to store the entries to remove in a list, because we can't remove items from a dict while iterating
|
|
131
|
+
entries_to_remove = list(self.cache.values())
|
|
132
|
+
_logger.debug(f'clearing {self.num_files()} entries from file cache')
|
|
133
|
+
self.num_requests, self.num_hits, self.num_evictions = 0, 0, 0
|
|
134
|
+
self.keys_retrieved.clear()
|
|
135
|
+
self.keys_evicted_after_retrieval.clear()
|
|
136
|
+
self.new_redownload_witnessed = False
|
|
97
137
|
else:
|
|
98
|
-
|
|
99
|
-
|
|
138
|
+
entries_to_remove = [e for e in self.cache.values() if e.tbl_id == tbl_id]
|
|
139
|
+
_logger.debug(f'clearing {self.num_files(tbl_id)} entries from file cache for table {tbl_id}')
|
|
140
|
+
for entry in entries_to_remove:
|
|
141
|
+
os.remove(entry.path)
|
|
100
142
|
del self.cache[entry.key]
|
|
101
143
|
self.total_size -= entry.size
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
144
|
+
|
|
145
|
+
def emit_eviction_warnings(self) -> None:
|
|
146
|
+
if self.new_redownload_witnessed:
|
|
147
|
+
# Compute the additional capacity that would be needed in order to retain all the re-downloaded files
|
|
148
|
+
extra_capacity_needed = sum(self.cache[key].size for key in self.evicted_working_set_keys)
|
|
149
|
+
suggested_cache_size = self.capacity_bytes + extra_capacity_needed + (1 << 30)
|
|
150
|
+
warnings.warn(
|
|
151
|
+
f'{len(self.evicted_working_set_keys)} media file(s) had to be downloaded multiple times this session, '
|
|
152
|
+
'because they were evicted\nfrom the file cache after their first access. The total size '
|
|
153
|
+
f'of the evicted file(s) is {round(extra_capacity_needed / (1 << 30), 1)} GiB.\n'
|
|
154
|
+
f'Consider increasing the cache size to at least {round(suggested_cache_size / (1 << 30), 1)} GiB '
|
|
155
|
+
f'(it is currently {round(self.capacity_bytes / (1 << 30), 1)} GiB).\n'
|
|
156
|
+
f'You can do this by setting the value of `file_cache_size_g` in: {str(Env.get()._config_file)}',
|
|
157
|
+
excs.PixeltableWarning
|
|
158
|
+
)
|
|
159
|
+
self.new_redownload_witnessed = False
|
|
109
160
|
|
|
110
161
|
def _url_hash(self, url: str) -> str:
|
|
111
162
|
h = hashlib.sha256()
|
|
@@ -120,66 +171,62 @@ class FileCache:
|
|
|
120
171
|
_logger.debug(f'file cache miss for {url}')
|
|
121
172
|
return None
|
|
122
173
|
# update mtime and cache
|
|
123
|
-
path = entry.path
|
|
174
|
+
path = entry.path
|
|
124
175
|
path.touch(exist_ok=True)
|
|
125
176
|
file_info = os.stat(str(path))
|
|
126
|
-
entry.
|
|
177
|
+
entry.last_used = file_info.st_mtime
|
|
127
178
|
self.cache.move_to_end(key, last=True)
|
|
128
179
|
self.num_hits += 1
|
|
180
|
+
self.keys_retrieved.add(key)
|
|
129
181
|
_logger.debug(f'file cache hit for {url}')
|
|
130
182
|
return path
|
|
131
183
|
|
|
132
|
-
# def can_admit(self, query_ts: int) -> bool:
|
|
133
|
-
# if self.total_size + self.avg_file_size <= self.capacity:
|
|
134
|
-
# return True
|
|
135
|
-
# assert len(self.cache) > 0
|
|
136
|
-
# # check whether we can evict the current lru entry
|
|
137
|
-
# lru_entry = next(iter(self.cache.values()))
|
|
138
|
-
# if lru_entry.last_accessed_ts >= query_ts:
|
|
139
|
-
# # the current query brought this entry in: we're not going to evict it
|
|
140
|
-
# return False
|
|
141
|
-
# return True
|
|
142
|
-
|
|
143
184
|
def add(self, tbl_id: UUID, col_id: int, url: str, path: Path) -> Path:
|
|
144
185
|
"""Adds url at 'path' to cache and returns its new path.
|
|
145
186
|
'path' will not be accessible after this call. Retains the extension of 'path'.
|
|
146
187
|
"""
|
|
147
188
|
file_info = os.stat(str(path))
|
|
148
|
-
|
|
149
|
-
#if self.total_size + file_info.st_size > self.capacity:
|
|
150
|
-
if False:
|
|
151
|
-
if len(self.cache) == 0:
|
|
152
|
-
# nothing to evict
|
|
153
|
-
return
|
|
154
|
-
# evict entries until we're below the limit or until we run into entries the current query brought in
|
|
155
|
-
while True:
|
|
156
|
-
lru_entry = next(iter(self.cache.values()))
|
|
157
|
-
if lru_entry.last_accessed_ts >= query_ts:
|
|
158
|
-
# the current query brought this entry in: switch to MRU and ignore this put()
|
|
159
|
-
_logger.debug('file cache switched to MRU')
|
|
160
|
-
return
|
|
161
|
-
self.cache.popitem(last=False)
|
|
162
|
-
self.total_size -= lru_entry.size
|
|
163
|
-
self.num_evictions += 1
|
|
164
|
-
os.remove(str(lru_entry.path()))
|
|
165
|
-
_logger.debug(f'evicted entry for cell {lru_entry.cell_id} from file cache')
|
|
166
|
-
if self.total_size + file_info.st_size <= self.capacity:
|
|
167
|
-
break
|
|
168
|
-
|
|
189
|
+
self.ensure_capacity(file_info.st_size)
|
|
169
190
|
key = self._url_hash(url)
|
|
170
191
|
assert key not in self.cache
|
|
192
|
+
if key in self.keys_evicted_after_retrieval:
|
|
193
|
+
# This key was evicted after being retrieved earlier this session, and is now being retrieved again.
|
|
194
|
+
# Add it to `keys_multiply_downloaded` so that we may generate a warning later.
|
|
195
|
+
self.evicted_working_set_keys.add(key)
|
|
196
|
+
self.new_redownload_witnessed = True
|
|
197
|
+
self.keys_retrieved.add(key)
|
|
171
198
|
entry = CacheEntry(key, tbl_id, col_id, file_info.st_size, file_info.st_mtime, path.suffix)
|
|
172
199
|
self.cache[key] = entry
|
|
173
200
|
self.total_size += entry.size
|
|
174
|
-
new_path = entry.path
|
|
201
|
+
new_path = entry.path
|
|
175
202
|
os.rename(str(path), str(new_path))
|
|
203
|
+
new_path.touch(exist_ok=True)
|
|
176
204
|
_logger.debug(f'added entry for cell {url} to file cache')
|
|
177
205
|
return new_path
|
|
178
206
|
|
|
207
|
+
def ensure_capacity(self, size: int) -> None:
|
|
208
|
+
"""
|
|
209
|
+
Evict entries from the cache until there is at least 'size' bytes of free space.
|
|
210
|
+
"""
|
|
211
|
+
while len(self.cache) > 0 and self.total_size + size > self.capacity_bytes:
|
|
212
|
+
_, lru_entry = self.cache.popitem(last=False)
|
|
213
|
+
self.total_size -= lru_entry.size
|
|
214
|
+
self.num_evictions += 1
|
|
215
|
+
if lru_entry.key in self.keys_retrieved:
|
|
216
|
+
# This key was retrieved at some point earlier this session and is now being evicted.
|
|
217
|
+
# Make a record of the eviction, so that we can generate a warning later if the key is retrieved again.
|
|
218
|
+
self.keys_evicted_after_retrieval.add(lru_entry.key)
|
|
219
|
+
os.remove(str(lru_entry.path))
|
|
220
|
+
_logger.debug(f'evicted entry for cell {lru_entry.key} from file cache (of size {lru_entry.size // (1 << 20)} MiB)')
|
|
221
|
+
|
|
222
|
+
def set_capacity(self, capacity_bytes: int) -> None:
|
|
223
|
+
self.capacity_bytes = capacity_bytes
|
|
224
|
+
self.ensure_capacity(0) # evict entries if necessary
|
|
225
|
+
|
|
179
226
|
def stats(self) -> CacheStats:
|
|
180
227
|
# collect column stats
|
|
181
228
|
# (tbl_id, col_id) -> (num_files, total_size)
|
|
182
|
-
d:
|
|
229
|
+
d: dict[tuple[int, int], list[int]] = defaultdict(lambda: [0, 0])
|
|
183
230
|
for entry in self.cache.values():
|
|
184
231
|
t = d[(entry.tbl_id, entry.col_id)]
|
|
185
232
|
t[0] += 1
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pixeltable
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.20
|
|
4
4
|
Summary: Pixeltable: The Multimodal AI Data Plane
|
|
5
5
|
Author: Pixeltable, Inc.
|
|
6
6
|
Author-email: contact@pixeltable.com
|
|
@@ -17,7 +17,7 @@ Requires-Dist: ftfy (>=6.2.0,<7.0.0)
|
|
|
17
17
|
Requires-Dist: jinja2 (>=3.1.3,<4.0.0)
|
|
18
18
|
Requires-Dist: jmespath (>=1.0.1,<2.0.0)
|
|
19
19
|
Requires-Dist: more-itertools (>=10.2,<11.0)
|
|
20
|
-
Requires-Dist: numpy (>=1.25)
|
|
20
|
+
Requires-Dist: numpy (>=1.25,<2.0)
|
|
21
21
|
Requires-Dist: opencv-python-headless (>=4.7.0.68,<5.0.0.0)
|
|
22
22
|
Requires-Dist: pandas (>=2.0,<3.0)
|
|
23
23
|
Requires-Dist: pgvector (>=0.2.1,<0.3.0)
|
|
@@ -31,6 +31,7 @@ Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
|
31
31
|
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
|
32
32
|
Requires-Dist: sqlalchemy (>=2.0.23,<3.0.0)
|
|
33
33
|
Requires-Dist: tenacity (>=8.2,<9.0)
|
|
34
|
+
Requires-Dist: toml (>=0.10)
|
|
34
35
|
Requires-Dist: tqdm (>=4.64)
|
|
35
36
|
Description-Content-Type: text/markdown
|
|
36
37
|
|
|
@@ -40,14 +41,23 @@ Description-Content-Type: text/markdown
|
|
|
40
41
|
|
|
41
42
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
42
43
|

|
|
43
|
-
|
|
44
|
-
|
|
44
|
+

|
|
45
|
+
<br>
|
|
46
|
+
[](https://github.com/pixeltable/pixeltable/actions/workflows/pytest.yml)
|
|
47
|
+
[](https://github.com/pixeltable/pixeltable/actions/workflows/nightly.yml)
|
|
45
48
|
[](https://pypi.org/project/pixeltable/)
|
|
46
49
|
|
|
47
|
-
[Installation](https://pixeltable.github.io/pixeltable/getting-started/) | [Documentation](https://pixeltable.readme.io/) | [API Reference](https://pixeltable.github.io/pixeltable/) | [Code Samples](https://pixeltable
|
|
50
|
+
[Installation](https://pixeltable.github.io/pixeltable/getting-started/) | [Documentation](https://pixeltable.readme.io/) | [API Reference](https://pixeltable.github.io/pixeltable/) | [Code Samples](https://github.com/pixeltable/pixeltable?tab=readme-ov-file#-code-samples) | [Computer Vision](https://docs.pixeltable.com/docs/object-detection-in-videos) | [LLM](https://docs.pixeltable.com/docs/document-indexing-and-rag)
|
|
48
51
|
</div>
|
|
49
52
|
|
|
50
|
-
Pixeltable is a Python library providing a declarative interface for multimodal data (text, images, audio, video). It features built-in versioning, lineage tracking, and incremental updates, enabling users to store
|
|
53
|
+
Pixeltable is a Python library providing a declarative interface for multimodal data (text, images, audio, video). It features built-in versioning, lineage tracking, and incremental updates, enabling users to **store**, **transform**, **index**, and **iterate** on data for their ML workflows.
|
|
54
|
+
|
|
55
|
+
Data transformations, model inference, and custom logic are embedded as **computed columns**.
|
|
56
|
+
- **Load/Query all data types**: Interact with [video data](https://github.com/pixeltable/pixeltable?tab=readme-ov-file#import-media-data-into-pixeltable-videos-images-audio) at the [frame level](https://github.com/pixeltable/pixeltable?tab=readme-ov-file#text-and-image-similarity-search-on-video-frames-with-embedding-indexes) and documents at the [chunk level](https://github.com/pixeltable/pixeltable?tab=readme-ov-file#automate-data-operations-with-views-eg-split-documents-into-chunks)
|
|
57
|
+
- **Incremental updates for data transformation**: Maintain an [embedding index](https://docs.pixeltable.com/docs/embedding-vector-indexes) colocated with your data
|
|
58
|
+
- **Lazy evaluation and cache management**: Eliminates the need for [manual frame extraction](https://docs.pixeltable.com/docs/object-detection-in-videos)
|
|
59
|
+
- **Integrates with any Python libraries**: Use [built-in and custom functions (UDFs)](https://docs.pixeltable.com/docs/user-defined-functions-udfs) without complex pipelines
|
|
60
|
+
- **Data format agnostic and extensibility**: Access tables as Parquet files, [PyTorch datasets](https://pixeltable.github.io/pixeltable/api/data-frame/#pixeltable.DataFrame.to_pytorch_dataset), or [COCO annotations](https://pixeltable.github.io/pixeltable/api/table/#pixeltable.Table.to_coco_dataset)
|
|
51
61
|
|
|
52
62
|
## 💾 Installation
|
|
53
63
|
|