code-loader 1.0.139.dev1__py3-none-any.whl → 1.0.139.dev2__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 code-loader might be problematic. Click here for more details.
- code_loader/inner_leap_binder/leapbinder_decorators.py +98 -3
- {code_loader-1.0.139.dev1.dist-info → code_loader-1.0.139.dev2.dist-info}/METADATA +1 -1
- {code_loader-1.0.139.dev1.dist-info → code_loader-1.0.139.dev2.dist-info}/RECORD +5 -5
- {code_loader-1.0.139.dev1.dist-info → code_loader-1.0.139.dev2.dist-info}/LICENSE +0 -0
- {code_loader-1.0.139.dev1.dist-info → code_loader-1.0.139.dev2.dist-info}/WHEEL +0 -0
|
@@ -26,6 +26,7 @@ import functools
|
|
|
26
26
|
|
|
27
27
|
_called_from_inside_tl_decorator = 0
|
|
28
28
|
_called_from_inside_tl_integration_test_decorator = False
|
|
29
|
+
_update_env_status = None
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
|
|
@@ -173,7 +174,9 @@ def tensorleap_integration_test():
|
|
|
173
174
|
global _called_from_inside_tl_integration_test_decorator
|
|
174
175
|
try:
|
|
175
176
|
_called_from_inside_tl_integration_test_decorator = True
|
|
177
|
+
_update_env_status("tensorleap_integration_test", "v")#put here because otherwise it will become v only if it finishes all the script
|
|
176
178
|
ret = integration_test_function(*args, **kwargs)
|
|
179
|
+
|
|
177
180
|
try:
|
|
178
181
|
os.environ[mapping_runtime_mode_env_var_mame] = 'True'
|
|
179
182
|
integration_test_function(None, PreprocessResponse(state=DataStateType.training, length=0))
|
|
@@ -316,8 +319,9 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
316
319
|
|
|
317
320
|
def get_inputs(self):
|
|
318
321
|
return self.model.get_inputs()
|
|
319
|
-
|
|
320
|
-
|
|
322
|
+
model_placeholder=ModelPlaceholder()
|
|
323
|
+
_update_env_status("tensorleap_load_model", "v")
|
|
324
|
+
return model_placeholder
|
|
321
325
|
|
|
322
326
|
def mapping_inner():
|
|
323
327
|
class ModelOutputPlaceholder:
|
|
@@ -385,7 +389,6 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
385
389
|
return mapping_inner()
|
|
386
390
|
else:
|
|
387
391
|
return inner(*args, **kwargs)
|
|
388
|
-
|
|
389
392
|
return final_inner
|
|
390
393
|
|
|
391
394
|
return decorating_function
|
|
@@ -597,6 +600,7 @@ def tensorleap_custom_metric(name: str,
|
|
|
597
600
|
result = inner_without_validate(*args, **kwargs)
|
|
598
601
|
|
|
599
602
|
_validate_result(result)
|
|
603
|
+
_update_env_status("tensorleap_custom_metric","v")
|
|
600
604
|
return result
|
|
601
605
|
|
|
602
606
|
def mapping_inner(*args, **kwargs):
|
|
@@ -717,6 +721,7 @@ def tensorleap_custom_visualizer(name: str, visualizer_type: LeapDataType,
|
|
|
717
721
|
result = inner_without_validate(*args, **kwargs)
|
|
718
722
|
|
|
719
723
|
_validate_result(result)
|
|
724
|
+
_update_env_status("tensorleap_custom_visualizer","v")
|
|
720
725
|
return result
|
|
721
726
|
|
|
722
727
|
def mapping_inner(*args, **kwargs):
|
|
@@ -805,6 +810,7 @@ def tensorleap_metadata(
|
|
|
805
810
|
result = inner_without_validate(sample_id, preprocess_response)
|
|
806
811
|
|
|
807
812
|
_validate_result(result)
|
|
813
|
+
_update_env_status("tensorleap_metadata","v")
|
|
808
814
|
return result
|
|
809
815
|
|
|
810
816
|
return inner
|
|
@@ -893,6 +899,7 @@ def tensorleap_preprocess():
|
|
|
893
899
|
_validate_input_args(*args, **kwargs)
|
|
894
900
|
result = user_function()
|
|
895
901
|
_validate_result(result)
|
|
902
|
+
_update_env_status("tensorleap_preprocess", "v")
|
|
896
903
|
return result
|
|
897
904
|
|
|
898
905
|
return inner
|
|
@@ -1134,6 +1141,7 @@ def tensorleap_input_encoder(name: str, channel_dim=-1, model_input_index=None):
|
|
|
1134
1141
|
if _called_from_inside_tl_decorator == 0 and _called_from_inside_tl_integration_test_decorator:
|
|
1135
1142
|
batch_warning(result,user_function.__name__)
|
|
1136
1143
|
result = np.expand_dims(result, axis=0)
|
|
1144
|
+
_update_env_status("tensorleap_input_encoder", "v")
|
|
1137
1145
|
|
|
1138
1146
|
return result
|
|
1139
1147
|
|
|
@@ -1217,6 +1225,7 @@ def tensorleap_gt_encoder(name: str):
|
|
|
1217
1225
|
if _called_from_inside_tl_decorator == 0 and _called_from_inside_tl_integration_test_decorator:
|
|
1218
1226
|
batch_warning(result, user_function.__name__)
|
|
1219
1227
|
result = np.expand_dims(result, axis=0)
|
|
1228
|
+
_update_env_status("tensorleap_gt_encoder", "v")
|
|
1220
1229
|
|
|
1221
1230
|
return result
|
|
1222
1231
|
|
|
@@ -1319,6 +1328,8 @@ def tensorleap_custom_loss(name: str, connects_to=None):
|
|
|
1319
1328
|
result = inner_without_validate(*args, **kwargs)
|
|
1320
1329
|
|
|
1321
1330
|
_validate_result(result)
|
|
1331
|
+
_update_env_status("tensorleap_custom_loss", "v")
|
|
1332
|
+
|
|
1322
1333
|
return result
|
|
1323
1334
|
|
|
1324
1335
|
def mapping_inner(*args, **kwargs):
|
|
@@ -1375,3 +1386,87 @@ def tensorleap_custom_layer(name: str):
|
|
|
1375
1386
|
return custom_layer
|
|
1376
1387
|
|
|
1377
1388
|
return decorating_function
|
|
1389
|
+
|
|
1390
|
+
|
|
1391
|
+
def tensorleap_status_table():
|
|
1392
|
+
'''
|
|
1393
|
+
Usage example:
|
|
1394
|
+
###################
|
|
1395
|
+
leap_integration.py
|
|
1396
|
+
###################
|
|
1397
|
+
from code_loader.inner_leap_binder.leapbinder_decorators import tensorleap_status_table
|
|
1398
|
+
...
|
|
1399
|
+
...
|
|
1400
|
+
...
|
|
1401
|
+
if __name__ == '__main__':
|
|
1402
|
+
tensorleap_status_table()
|
|
1403
|
+
...
|
|
1404
|
+
'''
|
|
1405
|
+
import atexit
|
|
1406
|
+
import sys
|
|
1407
|
+
import traceback
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
table = [
|
|
1411
|
+
{"name": "tensorleap_preprocess", "status": "x"},
|
|
1412
|
+
{"name": "tensorleap_integration_test", "status": "x"},
|
|
1413
|
+
{"name": "tensorleap_input_encoder", "status": "x"},
|
|
1414
|
+
{"name": "tensorleap_gt_encoder", "status": "x"},
|
|
1415
|
+
{"name": "tensorleap_load_model", "status": "x"},
|
|
1416
|
+
{"name": "tensorleap_custom_loss", "status": "x"},
|
|
1417
|
+
{"name": "tensorleap_custom_metric (optional)", "status": "x"},
|
|
1418
|
+
{"name": "tensorleap_metadata (optional)", "status": "x"},
|
|
1419
|
+
{"name": "tensorleap_custom_visualizer (optional)", "status": "x"},
|
|
1420
|
+
|
|
1421
|
+
]
|
|
1422
|
+
|
|
1423
|
+
_finalizer_called = {"done": False}
|
|
1424
|
+
|
|
1425
|
+
def _print_table():
|
|
1426
|
+
ready_mess = "\nAll parts have been successfully set. If no errors accured, you can now push the project to the Tensorleap system."
|
|
1427
|
+
not_ready_mess = "\nSome mandatory components have not been set yet. Recommended next implementation step: "
|
|
1428
|
+
mandatory_ready_mess = "\nAll mandatory parts have been successfully set. If no errors accured, you can now push the project to the Tensorleap system or continue to the next optional implementation step: "
|
|
1429
|
+
|
|
1430
|
+
name_width = max(len(row["name"]) for row in table)
|
|
1431
|
+
status_width = max(len(row["status"]) for row in table)
|
|
1432
|
+
header = f"{'Function Name'.ljust(name_width)} | {'Status'.ljust(status_width)}"
|
|
1433
|
+
sep = "-" * len(header)
|
|
1434
|
+
print("\n" + header)
|
|
1435
|
+
print(sep)
|
|
1436
|
+
ready=True
|
|
1437
|
+
for row in table:
|
|
1438
|
+
print(f"{row['name'].ljust(name_width)} | {row['status'].ljust(status_width)}")
|
|
1439
|
+
if row['status']=='x' and ready:
|
|
1440
|
+
ready=False
|
|
1441
|
+
next_step=row['name']
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
print(ready_mess) if ready else print(mandatory_ready_mess+next_step) if "optional" in next_step else print(not_ready_mess+next_step)
|
|
1445
|
+
def update_env_params(name: str, status: str = "✓"):
|
|
1446
|
+
for row in table:
|
|
1447
|
+
if row["name"].removesuffix(" (optional)") == name:
|
|
1448
|
+
row["status"] = status
|
|
1449
|
+
break
|
|
1450
|
+
def run_on_exit():
|
|
1451
|
+
if _finalizer_called["done"]:
|
|
1452
|
+
return
|
|
1453
|
+
_finalizer_called["done"] = True
|
|
1454
|
+
_print_table()
|
|
1455
|
+
def handle_exception(exc_type, exc_value, exc_traceback):
|
|
1456
|
+
traceback.print_exception(exc_type, exc_value, exc_traceback)
|
|
1457
|
+
run_on_exit()
|
|
1458
|
+
atexit.register(run_on_exit)
|
|
1459
|
+
sys.excepthook = handle_exception
|
|
1460
|
+
global _update_env_status
|
|
1461
|
+
_update_env_status = update_env_params
|
|
1462
|
+
return update_env_params
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
@@ -21,7 +21,7 @@ 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=Q3D9yVM-GNEJfYRFvMV__BoZbcWOgnWKhrZXAv6Tu7o,33232
|
|
24
|
-
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=
|
|
24
|
+
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=NlH8W1q8kVAik81EJ9ZNjWkAm8XPSW-XrKh9wBgd5BA,69593
|
|
25
25
|
code_loader/leaploader.py,sha256=6D6xZzMI6qSNIb3tuKLB3BbK5H8QS1_r7iQjIXO3OkM,29795
|
|
26
26
|
code_loader/leaploaderbase.py,sha256=LIFcC6xo6V_iiGN3BjibXETu_l84EWM_WIOKAvkfTiM,4458
|
|
27
27
|
code_loader/mixpanel_tracker.py,sha256=l9z_szKKQ7apEbdNZpGH1TKAiT_TsBHb9AQnePaWTyo,4942
|
|
@@ -31,7 +31,7 @@ code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6Lz
|
|
|
31
31
|
code_loader/utils.py,sha256=gXENTYpjdidq2dx0gVbXlErPeHoNs-4TYAZbLRe0y2c,2712
|
|
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.139.
|
|
35
|
-
code_loader-1.0.139.
|
|
36
|
-
code_loader-1.0.139.
|
|
37
|
-
code_loader-1.0.139.
|
|
34
|
+
code_loader-1.0.139.dev2.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
35
|
+
code_loader-1.0.139.dev2.dist-info/METADATA,sha256=bZ4R5F5wQdWZEg666Lxiw1LxHcqUCmRXsgKvxFUGof4,1095
|
|
36
|
+
code_loader-1.0.139.dev2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
37
|
+
code_loader-1.0.139.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|