code-loader 1.0.190.dev0__py3-none-any.whl → 1.0.191__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 +26 -26
- code_loader/leaploader.py +19 -0
- {code_loader-1.0.190.dev0.dist-info → code_loader-1.0.191.dist-info}/METADATA +1 -1
- {code_loader-1.0.190.dev0.dist-info → code_loader-1.0.191.dist-info}/RECORD +6 -6
- {code_loader-1.0.190.dev0.dist-info → code_loader-1.0.191.dist-info}/LICENSE +0 -0
- {code_loader-1.0.190.dev0.dist-info → code_loader-1.0.191.dist-info}/WHEEL +0 -0
|
@@ -26,7 +26,7 @@ from code_loader.contract.enums import MetricDirection, LeapDataType, DatasetMet
|
|
|
26
26
|
from code_loader import leap_binder, LeapLoader
|
|
27
27
|
from code_loader.contract.mapping import NodeMapping, NodeMappingType, NodeConnection
|
|
28
28
|
from code_loader.contract.visualizer_classes import LeapImage, LeapImageMask, LeapTextMask, LeapText, LeapGraph, \
|
|
29
|
-
LeapHorizontalBar, LeapImageWithBBox, LeapImageWithHeatmap, LeapVideo
|
|
29
|
+
LeapHorizontalBar, LeapImageWithBBox, LeapImageWithHeatmap, LeapVideo, LeapValidationError
|
|
30
30
|
from code_loader.inner_leap_binder.leapbinder import mapping_runtime_mode_env_var_mame
|
|
31
31
|
from code_loader.mixpanel_tracker import clear_integration_events, AnalyticsEvent, emit_integration_event_once
|
|
32
32
|
|
|
@@ -316,16 +316,16 @@ def tensorleap_integration_test():
|
|
|
316
316
|
first_tb = traceback.extract_tb(e.__traceback__)[-1]
|
|
317
317
|
file_name = Path(first_tb.filename).name
|
|
318
318
|
line_number = first_tb.lineno
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
raise (f'Invalid integration code. File {file_name}, line {line_number}: '
|
|
322
|
-
|
|
319
|
+
update_env_params_func("code_mapping", "x")
|
|
320
|
+
if isinstance(e, LeapValidationError):
|
|
321
|
+
raise Exception(f'Invalid integration code. File {file_name}, line {line_number}: {e}')
|
|
322
|
+
elif isinstance(e, TypeError) and 'is not subscriptable' in str(e):
|
|
323
|
+
raise Exception(f'Invalid integration code. File {file_name}, line {line_number}: '
|
|
324
|
+
f"indexing is supported only on the model's predictions inside the integration test. Please remove this indexing operation usage from the integration test code.")
|
|
323
325
|
else:
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
f'Integration test is only allowed to call Tensorleap decorators. '
|
|
328
|
-
f'Ensure any arithmetics, external library use, Python logic is placed within Tensorleap decoders')
|
|
326
|
+
raise Exception(f'Invalid integration code. File {file_name}, line {line_number}: '
|
|
327
|
+
f'Integration test is only allowed to call Tensorleap decorators. '
|
|
328
|
+
f'Ensure any arithmetics, external library use, Python logic is placed within Tensorleap decoders')
|
|
329
329
|
finally:
|
|
330
330
|
if mapping_runtime_mode_env_var_mame in os.environ:
|
|
331
331
|
del os.environ[mapping_runtime_mode_env_var_mame]
|
|
@@ -575,9 +575,6 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
575
575
|
def get_inputs(self):
|
|
576
576
|
return self.model.get_inputs()
|
|
577
577
|
|
|
578
|
-
def get_outputs(self):
|
|
579
|
-
return self.model.get_outputs()
|
|
580
|
-
|
|
581
578
|
model_placeholder = ModelPlaceholder(prediction_types)
|
|
582
579
|
if not _call_from_tl_platform:
|
|
583
580
|
update_env_params_func("tensorleap_load_model", "v")
|
|
@@ -614,7 +611,9 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
614
611
|
|
|
615
612
|
# onnx runtime interface
|
|
616
613
|
def run(self, output_names, input_dict):
|
|
617
|
-
|
|
614
|
+
if output_names is not None:
|
|
615
|
+
raise LeapValidationError("Tensorleap doesn't support selecting outputs by name — "
|
|
616
|
+
"use model.run(None, inputs) to return all outputs.")
|
|
618
617
|
assert isinstance(input_dict, dict), \
|
|
619
618
|
f'Expected input_dict to be a dict, got {type(input_dict)} instead.'
|
|
620
619
|
for i, (input_key, elem) in enumerate(input_dict.items()):
|
|
@@ -642,13 +641,6 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
642
641
|
|
|
643
642
|
return FollowInputIndex()
|
|
644
643
|
|
|
645
|
-
def get_outputs(self):
|
|
646
|
-
# Mapping-mode counterpart of the ONNX-run get_outputs(): in mapping
|
|
647
|
-
# mode outputs are reached by index, and get_outputs()[i] resolves to
|
|
648
|
-
# Prediction{i} — exactly like run()/__call__, which also return a
|
|
649
|
-
# ModelOutputPlaceholder. Reusing it keeps the mapping unchanged.
|
|
650
|
-
return ModelOutputPlaceholder()
|
|
651
|
-
|
|
652
644
|
return ModelPlaceholder()
|
|
653
645
|
|
|
654
646
|
def final_inner(*args, **kwargs):
|
|
@@ -2445,12 +2437,12 @@ def tensorleap_status_table():
|
|
|
2445
2437
|
ready = False
|
|
2446
2438
|
next_step = row["name"]
|
|
2447
2439
|
|
|
2448
|
-
if
|
|
2449
|
-
print(f"\
|
|
2440
|
+
if code_mapping_failure[0]:
|
|
2441
|
+
print(f"\n{CROSS} {code_mapping_failure_mes}")
|
|
2450
2442
|
return
|
|
2451
2443
|
|
|
2452
|
-
if
|
|
2453
|
-
print(f"\
|
|
2444
|
+
if _crashed["value"]:
|
|
2445
|
+
print(f"\nScript crashed before completing all steps. crashed at function '{_current_func['name']}'.")
|
|
2454
2446
|
return
|
|
2455
2447
|
|
|
2456
2448
|
print(ready_mess) if ready else print(
|
|
@@ -2465,6 +2457,10 @@ def tensorleap_status_table():
|
|
|
2465
2457
|
code_mapping_failure[0] = 1
|
|
2466
2458
|
if status == "v":
|
|
2467
2459
|
_set_status(name, CHECK)
|
|
2460
|
+
# A decorator that reports success is no longer the "currently running"
|
|
2461
|
+
# one, so clear the pointer. This keeps a later body-level raise from
|
|
2462
|
+
# being blamed on the last decorator that actually succeeded.
|
|
2463
|
+
_current_func["name"] = None
|
|
2468
2464
|
else:
|
|
2469
2465
|
_set_status(name, CROSS)
|
|
2470
2466
|
|
|
@@ -2511,10 +2507,14 @@ def tensorleap_status_table():
|
|
|
2511
2507
|
def handle_exception(exc_type, exc_value, exc_traceback):
|
|
2512
2508
|
_crashed["value"] = True
|
|
2513
2509
|
crashed_name = _current_func["name"]
|
|
2514
|
-
if crashed_name:
|
|
2510
|
+
if crashed_name and not code_mapping_failure[0]:
|
|
2515
2511
|
row = _find_row(crashed_name)
|
|
2516
2512
|
if row:
|
|
2517
2513
|
row["Added to integration"] = CROSS
|
|
2514
|
+
elif not crashed_name:
|
|
2515
|
+
# Crash with no decorator currently running = the integration-test body /
|
|
2516
|
+
# code flow itself failed; report that rather than blaming a decorator.
|
|
2517
|
+
code_mapping_failure[0] = 1
|
|
2518
2518
|
|
|
2519
2519
|
traceback.print_exception(exc_type, exc_value, exc_traceback)
|
|
2520
2520
|
run_on_exit()
|
code_loader/leaploader.py
CHANGED
|
@@ -320,6 +320,8 @@ class LeapLoader(LeapLoaderBase):
|
|
|
320
320
|
try:
|
|
321
321
|
self.exec_script()
|
|
322
322
|
|
|
323
|
+
integration_test_test_payload = self._check_integration_test_exists()
|
|
324
|
+
test_payloads.append(integration_test_test_payload)
|
|
323
325
|
preprocess_test_payload = self._check_preprocess()
|
|
324
326
|
test_payloads.append(preprocess_test_payload)
|
|
325
327
|
handlers_test_payloads = self._check_handlers()
|
|
@@ -356,6 +358,23 @@ class LeapLoader(LeapLoaderBase):
|
|
|
356
358
|
engine_file_contract=EngineFileContract(global_leap_binder.mapping_connections,
|
|
357
359
|
global_leap_binder.leap_analysis_configuration))
|
|
358
360
|
|
|
361
|
+
def _check_integration_test_exists(self) -> DatasetTestResultPayload:
|
|
362
|
+
test_result = DatasetTestResultPayload('integration_test')
|
|
363
|
+
# Only enforced on the Tensorleap platform (i.e. during a push / inspection,
|
|
364
|
+
# where IS_TENSORLEAP_PLATFORM=true). Running code-loader locally or in unit
|
|
365
|
+
# tests must not require the decorator, so pre-decorator integrations and
|
|
366
|
+
# local check runs keep working unchanged.
|
|
367
|
+
is_on_platform = os.environ.get('IS_TENSORLEAP_PLATFORM') == 'true'
|
|
368
|
+
if is_on_platform and global_leap_binder.integration_test_func is None:
|
|
369
|
+
test_result.is_passed = False
|
|
370
|
+
test_result.display[TestingSectionEnum.Errors.name] = (
|
|
371
|
+
"No integration test was found in your integration file. A valid Tensorleap "
|
|
372
|
+
"integration file must define an integration test function decorated with "
|
|
373
|
+
"@tensorleap_integration_test. Without it the integration cannot be validated "
|
|
374
|
+
"and the push is aborted. See the mnist leap_integration.py for a valid example."
|
|
375
|
+
)
|
|
376
|
+
return test_result
|
|
377
|
+
|
|
359
378
|
def _check_preprocess(self) -> DatasetTestResultPayload:
|
|
360
379
|
test_result = DatasetTestResultPayload('preprocess')
|
|
361
380
|
try:
|
|
@@ -21,8 +21,8 @@ code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZ
|
|
|
21
21
|
code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
|
|
22
22
|
code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
|
|
23
23
|
code_loader/inner_leap_binder/leapbinder.py,sha256=PAX9cmT1QQV7PWsbY9rMRWktpM7KryfFlwBiSwSskzg,42654
|
|
24
|
-
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=
|
|
25
|
-
code_loader/leaploader.py,sha256=
|
|
24
|
+
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=yMEROthjXugzqJCCjL5m7Erkv33L56fqACDXaFK2M4c,123503
|
|
25
|
+
code_loader/leaploader.py,sha256=9bUl69X5pk6prgFMCnaoA4MhRoacDb9Ddv3CWgG1F0Y,45968
|
|
26
26
|
code_loader/leaploaderbase.py,sha256=l36qDA00GhZEG5NLKpEtAXgWJA-UQQIhNFGxywK7mUA,6530
|
|
27
27
|
code_loader/mixpanel_tracker.py,sha256=rNwRmFifNbdUoqLQvvhhgpKczWpWiEmd8MfyJe27sxw,9131
|
|
28
28
|
code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -31,7 +31,7 @@ code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6Lz
|
|
|
31
31
|
code_loader/utils.py,sha256=YecipkdTA-VcE9F0RQcY9cFnY8P3AksPnHM2Db7xUSk,3972
|
|
32
32
|
code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
33
|
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.
|
|
34
|
+
code_loader-1.0.191.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
35
|
+
code_loader-1.0.191.dist-info/METADATA,sha256=HPzc6iqSgc1a5d-yKe2kUtYbcnqcpVMKfMQxiS9Rb14,1102
|
|
36
|
+
code_loader-1.0.191.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
37
|
+
code_loader-1.0.191.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|