code-loader 1.0.181.dev4__py3-none-any.whl → 1.0.182__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.py +4 -3
- code_loader/leaploader.py +14 -12
- code_loader/leaploaderbase.py +2 -2
- {code_loader-1.0.181.dev4.dist-info → code_loader-1.0.182.dist-info}/METADATA +1 -1
- {code_loader-1.0.181.dev4.dist-info → code_loader-1.0.182.dist-info}/RECORD +7 -7
- {code_loader-1.0.181.dev4.dist-info → code_loader-1.0.182.dist-info}/LICENSE +0 -0
- {code_loader-1.0.181.dev4.dist-info → code_loader-1.0.182.dist-info}/WHEEL +0 -0
|
@@ -690,10 +690,11 @@ class LeapBinder:
|
|
|
690
690
|
preprocess_response.tl_generated = True
|
|
691
691
|
if not preprocess_response.length or preprocess_response.length < 1:
|
|
692
692
|
raise Exception("Simulation '{}' returned PreprocessResponse with length < 1".format(sim.name))
|
|
693
|
+
preprocess_response.sample_ids = [0]
|
|
693
694
|
for handler in self.setup_container.inputs:
|
|
694
|
-
out1 = handler.function(0, preprocess_response)
|
|
695
|
-
out2 = handler.function(0, preprocess_response)
|
|
696
|
-
if not np.
|
|
695
|
+
out1 = handler.function(preprocess_response.sample_ids[0], preprocess_response)
|
|
696
|
+
out2 = handler.function(preprocess_response.sample_ids[0], preprocess_response)
|
|
697
|
+
if not np.allclose(out1, out2):
|
|
697
698
|
raise Exception(
|
|
698
699
|
"Simulation '{}': encoder '{}' is non-deterministic — consecutive calls with seed=0 returned different outputs".format(
|
|
699
700
|
sim.name, handler.name
|
code_loader/leaploader.py
CHANGED
|
@@ -324,10 +324,11 @@ class LeapLoader(LeapLoaderBase):
|
|
|
324
324
|
preprocess_response.tl_generated = True
|
|
325
325
|
if preprocess_response.length < 1:
|
|
326
326
|
raise ValueError("Simulation returned PreprocessResponse with length < 1")
|
|
327
|
+
preprocess_response.sample_ids = [0]
|
|
327
328
|
for handler in global_leap_binder.setup_container.inputs:
|
|
328
|
-
out1 = handler.function(0, preprocess_response)
|
|
329
|
-
out2 = handler.function(0, preprocess_response)
|
|
330
|
-
if not np.
|
|
329
|
+
out1 = handler.function(preprocess_response.sample_ids[0], preprocess_response)
|
|
330
|
+
out2 = handler.function(preprocess_response.sample_ids[0], preprocess_response)
|
|
331
|
+
if not np.allclose(out1, out2):
|
|
331
332
|
raise ValueError(
|
|
332
333
|
"Encoder '{}' is non-deterministic: consecutive calls with seed=0 returned different outputs".format(
|
|
333
334
|
handler.name
|
|
@@ -344,8 +345,8 @@ class LeapLoader(LeapLoaderBase):
|
|
|
344
345
|
result_payloads.append(test_result)
|
|
345
346
|
return result_payloads
|
|
346
347
|
|
|
347
|
-
def
|
|
348
|
-
# type: (str) -> Dict[str, npt.NDArray[np.float32]]
|
|
348
|
+
def run_simulation(self, sim_name, params=None, n_samples=1, seed=0):
|
|
349
|
+
# type: (str, Optional[Dict[str, Any]], int, int) -> Dict[str, npt.NDArray[np.float32]]
|
|
349
350
|
self.exec_script()
|
|
350
351
|
sim = next(
|
|
351
352
|
(s for s in global_leap_binder.setup_container.simulations if s.name == sim_name),
|
|
@@ -353,9 +354,9 @@ class LeapLoader(LeapLoaderBase):
|
|
|
353
354
|
)
|
|
354
355
|
if sim is None:
|
|
355
356
|
raise ValueError("No simulation registered with name '{}'".format(sim_name))
|
|
356
|
-
kwargs = sample_sim_params(sim.sim_config)
|
|
357
|
-
kwargs["N"] =
|
|
358
|
-
kwargs["seed"] =
|
|
357
|
+
kwargs = dict(params) if params is not None else sample_sim_params(sim.sim_config)
|
|
358
|
+
kwargs["N"] = n_samples
|
|
359
|
+
kwargs["seed"] = seed
|
|
359
360
|
_simulation_context["active"] = True
|
|
360
361
|
try:
|
|
361
362
|
sim_preprocess = sim.function(**kwargs)
|
|
@@ -363,10 +364,11 @@ class LeapLoader(LeapLoaderBase):
|
|
|
363
364
|
_simulation_context["active"] = False
|
|
364
365
|
sim_preprocess.state = DataStateType.additional
|
|
365
366
|
sim_preprocess.tl_generated = True
|
|
366
|
-
|
|
367
|
-
for
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
per_encoder = {handler.name: [] for handler in global_leap_binder.setup_container.inputs}
|
|
368
|
+
for sample_id in sim_preprocess.sample_ids:
|
|
369
|
+
for handler in global_leap_binder.setup_container.inputs:
|
|
370
|
+
per_encoder[handler.name].append(handler.function(sample_id, sim_preprocess))
|
|
371
|
+
return {name: np.stack(arrays) for name, arrays in per_encoder.items()}
|
|
370
372
|
|
|
371
373
|
@staticmethod
|
|
372
374
|
def _get_all_dataset_base_handlers() -> List[Union[DatasetBaseHandler, MetadataHandler]]:
|
code_loader/leaploaderbase.py
CHANGED
|
@@ -154,8 +154,8 @@ class LeapLoaderBase:
|
|
|
154
154
|
pass
|
|
155
155
|
|
|
156
156
|
@abstractmethod
|
|
157
|
-
def
|
|
158
|
-
# type: (str) -> Dict[str, Any]
|
|
157
|
+
def run_simulation(self, sim_name, params=None, n_samples=1, seed=0):
|
|
158
|
+
# type: (str, Optional[Dict[str, Any]], int, int) -> Dict[str, Any]
|
|
159
159
|
pass
|
|
160
160
|
|
|
161
161
|
def is_custom_latent_space(self) -> bool:
|
|
@@ -21,10 +21,10 @@ code_loader/experiment_api/types.py,sha256=MY8xFARHwdVA7p4dxyhD60ShmttgTvb4qdp1o
|
|
|
21
21
|
code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZJEqBqc,3304
|
|
22
22
|
code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
|
|
23
23
|
code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
|
|
24
|
-
code_loader/inner_leap_binder/leapbinder.py,sha256=
|
|
24
|
+
code_loader/inner_leap_binder/leapbinder.py,sha256=XLYYcV50qjMvoC1S6WW0tLBch_0g5gl1UyHiVSWYbvg,40491
|
|
25
25
|
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=YlK51b5Ryo396f7tOA7Ole3vYCLs3f5ZLm2qDQ9K1NE,105781
|
|
26
|
-
code_loader/leaploader.py,sha256
|
|
27
|
-
code_loader/leaploaderbase.py,sha256=
|
|
26
|
+
code_loader/leaploader.py,sha256=Md-CsdLiBVfeGIlVqpVjNVF_fEAFbg2ahmVCCPl3iOw,36758
|
|
27
|
+
code_loader/leaploaderbase.py,sha256=HrOGX9H8eRbyrFOEdvC2OISJvtZWKMVDah0cry8PXlo,6492
|
|
28
28
|
code_loader/mixpanel_tracker.py,sha256=rNwRmFifNbdUoqLQvvhhgpKczWpWiEmd8MfyJe27sxw,9131
|
|
29
29
|
code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
code_loader/plot_functions/plot_functions.py,sha256=6Q7VWGxetL2W0EK2QeCdObVATvBuHs3YBA09H4uoIk0,14996
|
|
@@ -32,7 +32,7 @@ code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6Lz
|
|
|
32
32
|
code_loader/utils.py,sha256=YecipkdTA-VcE9F0RQcY9cFnY8P3AksPnHM2Db7xUSk,3972
|
|
33
33
|
code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
code_loader/visualizers/default_visualizers.py,sha256=onRnLE_TXfgLN4o52hQIOOhUcFexGlqJ3xSpQDVLuZM,2604
|
|
35
|
-
code_loader-1.0.
|
|
36
|
-
code_loader-1.0.
|
|
37
|
-
code_loader-1.0.
|
|
38
|
-
code_loader-1.0.
|
|
35
|
+
code_loader-1.0.182.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
36
|
+
code_loader-1.0.182.dist-info/METADATA,sha256=bdjOF01oHx8liEGiQIVqgTKHIo4yiol3I4Rd-QMKxgA,1090
|
|
37
|
+
code_loader-1.0.182.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
38
|
+
code_loader-1.0.182.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|