code-loader 1.0.178__py3-none-any.whl → 1.0.179.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.
- code_loader/inner_leap_binder/leapbinder_decorators.py +30 -6
- {code_loader-1.0.178.dist-info → code_loader-1.0.179.dev2.dist-info}/METADATA +1 -1
- {code_loader-1.0.178.dist-info → code_loader-1.0.179.dev2.dist-info}/RECORD +5 -5
- {code_loader-1.0.178.dist-info → code_loader-1.0.179.dev2.dist-info}/LICENSE +0 -0
- {code_loader-1.0.178.dist-info → code_loader-1.0.179.dev2.dist-info}/WHEEL +0 -0
|
@@ -77,6 +77,13 @@ def store_warning_by_param(
|
|
|
77
77
|
_PARAM_DEFAULT_DOCS[param_name] = link_to_docs
|
|
78
78
|
|
|
79
79
|
|
|
80
|
+
def store_general_warning(*, key: tuple, message: str, link_to_docs: Optional[str] = None) -> None:
|
|
81
|
+
if key in _STORED_WARNING_KEYS:
|
|
82
|
+
return
|
|
83
|
+
_STORED_WARNING_KEYS.add(key)
|
|
84
|
+
_STORED_WARNINGS.append({"message": message, "link_to_docs": link_to_docs})
|
|
85
|
+
|
|
86
|
+
|
|
80
87
|
def _get_param_default_warnings() -> Dict[str, Dict[str, Any]]:
|
|
81
88
|
out: Dict[str, Dict[str, Any]] = {}
|
|
82
89
|
for p, funcs in _PARAM_DEFAULT_FUNCS.items():
|
|
@@ -1226,9 +1233,8 @@ def tensorleap_metadata(
|
|
|
1226
1233
|
def _validate_result(result):
|
|
1227
1234
|
supported_result_types = (type(None), int, str, bool, float, dict, np.floating,
|
|
1228
1235
|
np.bool_, np.unsignedinteger, np.signedinteger, np.integer)
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
expected_type_name=supported_result_types)
|
|
1236
|
+
validate_output_structure(result, func_name=user_function.__name__,
|
|
1237
|
+
expected_type_name=supported_result_types)
|
|
1232
1238
|
assert isinstance(result, supported_result_types), \
|
|
1233
1239
|
(f'{user_function.__name__}() validation failed: '
|
|
1234
1240
|
f'Unsupported return type. Got {type(result)}. should be any of {str(supported_result_types)}')
|
|
@@ -1293,8 +1299,20 @@ def tensorleap_custom_latent_space():
|
|
|
1293
1299
|
|
|
1294
1300
|
def _validate_result(result):
|
|
1295
1301
|
assert isinstance(result, np.ndarray), \
|
|
1296
|
-
(f'
|
|
1302
|
+
(f'tensorleap_custom_latent_space validation failed: '
|
|
1297
1303
|
f'The return type should be a numpy array. Got {type(result)}.')
|
|
1304
|
+
if result.ndim > 1:
|
|
1305
|
+
flat_dim = int(np.prod(result.shape))
|
|
1306
|
+
store_general_warning(
|
|
1307
|
+
key=("tensorleap_custom_latent_space_flatten", tuple(result.shape)),
|
|
1308
|
+
message=(
|
|
1309
|
+
f"tensorleap_custom_latent_space returned per-sample shape {tuple(result.shape)} "
|
|
1310
|
+
f"(ndim={result.ndim}). Tensorleap assumes per-sample shape (d, ...) and will "
|
|
1311
|
+
f"flatten to ({flat_dim},) before downstream visualization and clustering. "
|
|
1312
|
+
f"If you want a different aggregation (e.g. global average pooling), do it "
|
|
1313
|
+
f"inside your function."
|
|
1314
|
+
),
|
|
1315
|
+
)
|
|
1298
1316
|
|
|
1299
1317
|
def inner_without_validate(sample_id, preprocess_response):
|
|
1300
1318
|
global _called_from_inside_tl_decorator
|
|
@@ -1978,7 +1996,8 @@ def tensorleap_status_table():
|
|
|
1978
1996
|
|
|
1979
1997
|
def _print_param_default_warnings():
|
|
1980
1998
|
data = _get_param_default_warnings()
|
|
1981
|
-
|
|
1999
|
+
stored = _get_stored_warnings()
|
|
2000
|
+
if not data and not stored:
|
|
1982
2001
|
return
|
|
1983
2002
|
|
|
1984
2003
|
print("\nWarnings (Default use. It is recommended to set values explicitly):")
|
|
@@ -1992,7 +2011,12 @@ def tensorleap_status_table():
|
|
|
1992
2011
|
print(
|
|
1993
2012
|
f" ⚠️ Parameter '{param_name}' defaults to {dv} in the following functions: [{funcs}]. "
|
|
1994
2013
|
f"For more information, check {docs_part}")
|
|
1995
|
-
|
|
2014
|
+
for w in stored:
|
|
2015
|
+
docs_link = w.get("link_to_docs")
|
|
2016
|
+
docs_part = f" {_link(docs_link)}" if docs_link else ""
|
|
2017
|
+
print(f" ⚠️ {w['message']}{docs_part}")
|
|
2018
|
+
if data:
|
|
2019
|
+
print("\nIf this isn’t the intended behaviour, set them explicitly.")
|
|
1996
2020
|
|
|
1997
2021
|
def _print_table():
|
|
1998
2022
|
_print_param_default_warnings()
|
|
@@ -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=Xrwx0Kptcz2dmoHoZQ7kyyNmitsvAKoTBngIMBvh--I,37859
|
|
24
|
-
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=
|
|
24
|
+
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=M4DQKAI3PnxzxdjYkssOtbfqMvIT08CJS7LpKbzl4Uw,100896
|
|
25
25
|
code_loader/leaploader.py,sha256=VSSxsU2KxHPo5SzN1bJtRXaz29IE0XNFxgrnAJyG3io,32162
|
|
26
26
|
code_loader/leaploaderbase.py,sha256=NJGaas8S6JeHYSsKkMSutyfcSKdK9jXTic7BcjC5uNc,6303
|
|
27
27
|
code_loader/mixpanel_tracker.py,sha256=U7eUGrPjc-2rgFG7isqosf65tKZkotQ0XKuAML_lIjA,9067
|
|
@@ -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.179.dev2.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
35
|
+
code_loader-1.0.179.dev2.dist-info/METADATA,sha256=SwqY8uUIwvKGedEGMdZZMUkMrZiVnrTn09nPGHy4D0c,1095
|
|
36
|
+
code_loader-1.0.179.dev2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
37
|
+
code_loader-1.0.179.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|