code-loader 1.0.185__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/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:
@@ -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
- # type: (str, Optional[Dict[str, Any]], int, int, Optional[List[str]]) -> Dict[str, Any]
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.3
1
+ Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.185
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
@@ -22,8 +23,8 @@ code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaS
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
25
  code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=8a7aJ1o4f60VnlErNjX_4RbUXpLWt91pgGcIDLBvOWc,115314
25
- code_loader/leaploader.py,sha256=K9Q5kiCZ_A2GkS5qOEantAMvWGaz3bmO1X8buXDSpgg,44682
26
- code_loader/leaploaderbase.py,sha256=l36qDA00GhZEG5NLKpEtAXgWJA-UQQIhNFGxywK7mUA,6530
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.185.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
- code_loader-1.0.185.dist-info/METADATA,sha256=T0ZdqljpQ1cyo3SpOtdXcf0eg4_p-NUmuzXVi075FGw,1102
36
- code_loader-1.0.185.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
37
- code_loader-1.0.185.dist-info/RECORD,,
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,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.3
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
File without changes