code-loader 1.0.184.dev5__py3-none-any.whl → 1.0.186.dev1__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.
- code_loader/inner_leap_binder/leapbinder_decorators.py +9 -3
- code_loader/leaploader.py +12 -8
- code_loader/leaploaderbase.py +3 -2
- code_loader-1.0.186.dev1.dist-info/LICENSE +21 -0
- {code_loader-1.0.184.dev5.dist-info → code_loader-1.0.186.dev1.dist-info}/METADATA +3 -3
- {code_loader-1.0.184.dev5.dist-info → code_loader-1.0.186.dev1.dist-info}/RECORD +8 -7
- {code_loader-1.0.184.dev5.dist-info → code_loader-1.0.186.dev1.dist-info}/WHEEL +1 -1
- /code_loader-1.0.184.dev5.dist-info/LICENSE → /LICENSE +0 -0
|
@@ -1189,13 +1189,19 @@ def _warn_image_mask(leap_data, viz_name: str, leap_type_name: str) -> None:
|
|
|
1189
1189
|
f"H x W {tuple(image.shape[:2])}. The mask overlay will fail or be misaligned."),
|
|
1190
1190
|
link_to_docs=_VIZ_DOCS,
|
|
1191
1191
|
)
|
|
1192
|
+
# plot_image_mask colors label index i where mask == (i + 1), so valid class ids are
|
|
1193
|
+
# 1..len(labels); id 0 is background (uncolored) and ids above len(labels) are never
|
|
1194
|
+
# colored. Compare the actual id range, not the count (which mis-fires when labels is a
|
|
1195
|
+
# global class list and only a subset of classes appears in this sample).
|
|
1192
1196
|
nonzero = np.unique(mask)
|
|
1193
1197
|
nonzero = nonzero[nonzero != 0]
|
|
1194
|
-
if
|
|
1198
|
+
if nonzero.size > 0 and int(nonzero.max()) > len(labels):
|
|
1195
1199
|
store_general_warning(
|
|
1196
1200
|
key=("viz_mask_labels", viz_name, leap_type_name),
|
|
1197
|
-
message=(f"{_viz_prefix(viz_name, leap_type_name)} mask
|
|
1198
|
-
f"but {len(labels)} label(s) were provided.
|
|
1201
|
+
message=(f"{_viz_prefix(viz_name, leap_type_name)} mask contains class id(s) up to "
|
|
1202
|
+
f"{int(nonzero.max())} but only {len(labels)} label(s) were provided. plot_image_mask "
|
|
1203
|
+
f"colors ids 1..{len(labels)}, so regions with higher ids will be left uncolored. "
|
|
1204
|
+
f"Provide a label for each class id."),
|
|
1199
1205
|
link_to_docs=_VIZ_DOCS,
|
|
1200
1206
|
)
|
|
1201
1207
|
|
code_loader/leaploader.py
CHANGED
|
@@ -446,8 +446,8 @@ class LeapLoader(LeapLoaderBase):
|
|
|
446
446
|
return result_payloads
|
|
447
447
|
|
|
448
448
|
def run_simulation(self, sim_name, params=None, n_samples=1, seed=0,
|
|
449
|
-
sample_ids=None, extend_preprocess=True):
|
|
450
|
-
# type: (str, Optional[Dict[str, Any]], int, int, Optional[List[str]], bool) -> Dict[str, Any]
|
|
449
|
+
sample_ids=None, extend_preprocess=True, allow_partial=False):
|
|
450
|
+
# type: (str, Optional[Dict[str, Any]], int, int, Optional[List[str]], bool, bool) -> Dict[str, Any]
|
|
451
451
|
# extend_preprocess=True (default): also extend preprocess_result[additional] with the
|
|
452
452
|
# new synthetic sample_ids (producer-side behavior — synthetic worker needs this for
|
|
453
453
|
# enumeration / data_length tracking). Pass False from consumer-side populators that
|
|
@@ -476,17 +476,21 @@ class LeapLoader(LeapLoaderBase):
|
|
|
476
476
|
per_encoder[handler.name].append(handler.function(sample_id, sim_preprocess))
|
|
477
477
|
encoded = {name: np.stack(arrays) for name, arrays in per_encoder.items()}
|
|
478
478
|
if sample_ids is not None:
|
|
479
|
-
if len(sample_ids) != len(original_sample_ids):
|
|
480
|
-
raise ValueError(
|
|
481
|
-
"sample_ids length ({}) does not match simulation output length ({})".format(
|
|
482
|
-
len(sample_ids), len(original_sample_ids)
|
|
483
|
-
)
|
|
484
|
-
)
|
|
485
479
|
for sid in sample_ids:
|
|
486
480
|
if not isinstance(sid, str):
|
|
487
481
|
raise TypeError(
|
|
488
482
|
"All sample_ids must be of type str. Got: {}".format(type(sid))
|
|
489
483
|
)
|
|
484
|
+
if len(sample_ids) != len(original_sample_ids):
|
|
485
|
+
if not allow_partial:
|
|
486
|
+
raise ValueError(
|
|
487
|
+
"sample_ids length ({}) does not match simulation output length ({})".format(
|
|
488
|
+
len(sample_ids), len(original_sample_ids)
|
|
489
|
+
)
|
|
490
|
+
)
|
|
491
|
+
n_bound = min(len(sample_ids), len(original_sample_ids))
|
|
492
|
+
sample_ids = list(sample_ids)[:n_bound]
|
|
493
|
+
original_sample_ids = original_sample_ids[:n_bound]
|
|
490
494
|
for synth_id, original_local_id in zip(sample_ids, original_sample_ids):
|
|
491
495
|
self._synthetic_lookup[synth_id] = (sim_preprocess, original_local_id)
|
|
492
496
|
if extend_preprocess:
|
code_loader/leaploaderbase.py
CHANGED
|
@@ -154,8 +154,9 @@ class LeapLoaderBase:
|
|
|
154
154
|
pass
|
|
155
155
|
|
|
156
156
|
@abstractmethod
|
|
157
|
-
def run_simulation(self, sim_name, params=None, n_samples=1, seed=0, sample_ids=None
|
|
158
|
-
|
|
157
|
+
def run_simulation(self, sim_name, params=None, n_samples=1, seed=0, sample_ids=None,
|
|
158
|
+
extend_preprocess=True, allow_partial=False):
|
|
159
|
+
# type: (str, Optional[Dict[str, Any]], int, int, Optional[List[str]], bool, bool) -> Dict[str, Any]
|
|
159
160
|
pass
|
|
160
161
|
|
|
161
162
|
def is_custom_latent_space(self) -> bool:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 TensorLeap
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: code-loader
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.186.dev1
|
|
4
4
|
Summary:
|
|
5
|
+
Home-page: https://github.com/tensorleap/code-loader
|
|
5
6
|
License: MIT
|
|
6
7
|
Author: dorhar
|
|
7
8
|
Author-email: doron.harnoy@tensorleap.ai
|
|
@@ -19,7 +20,6 @@ Requires-Dist: numpy (>=2.3.2,<3.0.0) ; python_version >= "3.11" and python_vers
|
|
|
19
20
|
Requires-Dist: psutil (>=5.9.5,<6.0.0)
|
|
20
21
|
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
21
22
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
22
|
-
Project-URL: Homepage, https://github.com/tensorleap/code-loader
|
|
23
23
|
Project-URL: Repository, https://github.com/tensorleap/code-loader
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
25
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
1
2
|
code_loader/__init__.py,sha256=outxRQ0M-zMfV0QGVJmAed5qWfRmyD0TV6-goEGAzBw,406
|
|
2
3
|
code_loader/contract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
4
|
code_loader/contract/datasetclasses.py,sha256=RYZcnX7vLMYhyQtCbX2PscVFNAYULxgAA9U4DRRfLqA,10456
|
|
@@ -21,9 +22,9 @@ code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZ
|
|
|
21
22
|
code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
|
|
22
23
|
code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
|
|
23
24
|
code_loader/inner_leap_binder/leapbinder.py,sha256=XLYYcV50qjMvoC1S6WW0tLBch_0g5gl1UyHiVSWYbvg,40491
|
|
24
|
-
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=
|
|
25
|
-
code_loader/leaploader.py,sha256=
|
|
26
|
-
code_loader/leaploaderbase.py,sha256=
|
|
25
|
+
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=8a7aJ1o4f60VnlErNjX_4RbUXpLWt91pgGcIDLBvOWc,115314
|
|
26
|
+
code_loader/leaploader.py,sha256=vg6AzL2ePf_NxDnoibvUKTZB2s4pN5ww9IViM767ejM,44964
|
|
27
|
+
code_loader/leaploaderbase.py,sha256=rXLdPKPUl-2qYKCoLuT-Tv9MUJl1PNh5vYRuLXHz99Y,6610
|
|
27
28
|
code_loader/mixpanel_tracker.py,sha256=rNwRmFifNbdUoqLQvvhhgpKczWpWiEmd8MfyJe27sxw,9131
|
|
28
29
|
code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
30
|
code_loader/plot_functions/plot_functions.py,sha256=6Q7VWGxetL2W0EK2QeCdObVATvBuHs3YBA09H4uoIk0,14996
|
|
@@ -31,7 +32,7 @@ code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6Lz
|
|
|
31
32
|
code_loader/utils.py,sha256=YecipkdTA-VcE9F0RQcY9cFnY8P3AksPnHM2Db7xUSk,3972
|
|
32
33
|
code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
34
|
code_loader/visualizers/default_visualizers.py,sha256=onRnLE_TXfgLN4o52hQIOOhUcFexGlqJ3xSpQDVLuZM,2604
|
|
34
|
-
code_loader-1.0.
|
|
35
|
-
code_loader-1.0.
|
|
36
|
-
code_loader-1.0.
|
|
37
|
-
code_loader-1.0.
|
|
35
|
+
code_loader-1.0.186.dev1.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
36
|
+
code_loader-1.0.186.dev1.dist-info/METADATA,sha256=4pf3RS6nLRFlIbkE1yyJN6ORnyTXtQVZ7EfdXaFLKY0,1095
|
|
37
|
+
code_loader-1.0.186.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
38
|
+
code_loader-1.0.186.dev1.dist-info/RECORD,,
|
|
File without changes
|