code-loader 1.0.179.dev1__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.
@@ -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():
@@ -1295,17 +1302,17 @@ def tensorleap_custom_latent_space():
1295
1302
  (f'tensorleap_custom_latent_space validation failed: '
1296
1303
  f'The return type should be a numpy array. Got {type(result)}.')
1297
1304
  if result.ndim > 1:
1298
- warning_key = ("tensorleap_custom_latent_space_flatten", tuple(result.shape))
1299
- if warning_key not in _STORED_WARNING_KEYS:
1300
- _STORED_WARNING_KEYS.add(warning_key)
1301
- flat_dim = int(np.prod(result.shape))
1302
- warnings.warn(
1305
+ flat_dim = int(np.prod(result.shape))
1306
+ store_general_warning(
1307
+ key=("tensorleap_custom_latent_space_flatten", tuple(result.shape)),
1308
+ message=(
1303
1309
  f"tensorleap_custom_latent_space returned per-sample shape {tuple(result.shape)} "
1304
1310
  f"(ndim={result.ndim}). Tensorleap assumes per-sample shape (d, ...) and will "
1305
1311
  f"flatten to ({flat_dim},) before downstream visualization and clustering. "
1306
1312
  f"If you want a different aggregation (e.g. global average pooling), do it "
1307
1313
  f"inside your function."
1308
- )
1314
+ ),
1315
+ )
1309
1316
 
1310
1317
  def inner_without_validate(sample_id, preprocess_response):
1311
1318
  global _called_from_inside_tl_decorator
@@ -1989,7 +1996,8 @@ def tensorleap_status_table():
1989
1996
 
1990
1997
  def _print_param_default_warnings():
1991
1998
  data = _get_param_default_warnings()
1992
- if not data:
1999
+ stored = _get_stored_warnings()
2000
+ if not data and not stored:
1993
2001
  return
1994
2002
 
1995
2003
  print("\nWarnings (Default use. It is recommended to set values explicitly):")
@@ -2003,7 +2011,12 @@ def tensorleap_status_table():
2003
2011
  print(
2004
2012
  f" ⚠️ Parameter '{param_name}' defaults to {dv} in the following functions: [{funcs}]. "
2005
2013
  f"For more information, check {docs_part}")
2006
- print("\nIf this isn’t the intended behaviour, set them explicitly.")
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.")
2007
2020
 
2008
2021
  def _print_table():
2009
2022
  _print_param_default_warnings()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.179.dev1
3
+ Version: 1.0.179.dev2
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -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=bRdVdpknmm0f4THPePfB687BYD9hSZs0uvTqHc4CZ3s,100432
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.179.dev1.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
- code_loader-1.0.179.dev1.dist-info/METADATA,sha256=l7B8gBp1M55-e3F9ncUd322fVZlVzMbxp9NMHMlT4DY,1095
36
- code_loader-1.0.179.dev1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
37
- code_loader-1.0.179.dev1.dist-info/RECORD,,
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,,