code-loader 1.0.174.dev3__py3-none-any.whl → 1.0.174.dev4__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.
@@ -879,7 +879,8 @@ def tensorleap_custom_metric(name: str,
879
879
 
880
880
  def tensorleap_custom_instances_metric(name: str,
881
881
  direction: Union[MetricDirection, Dict[str, MetricDirection]] = _UNSET,
882
- compute_insights: Optional[Union[bool, Dict[str, bool]]] = None):
882
+ compute_insights: Optional[Union[bool, Dict[str, bool]]] = None,
883
+ connects_to=None):
883
884
  name_to_unique_name = defaultdict(set)
884
885
 
885
886
  def decorating_function(
@@ -942,21 +943,21 @@ def tensorleap_custom_instances_metric(name: str,
942
943
  err_message +
943
944
  f"Invalid type for compute_insights['{k}']: expected bool, got type {type(v).__name__}."
944
945
  )
945
- # if connects_to is not None:
946
- # valid_types = (str, list, tuple, set)
947
- # if not isinstance(connects_to, valid_types):
948
- # raise TypeError(
949
- # err_message +
950
- # f"`connects_to` must be one of {valid_types}, got type {type(connects_to).__name__}."
951
- # )
952
- # if isinstance(connects_to, (list, tuple, set)):
953
- # invalid_elems = [f"{type(e).__name__}" for e in connects_to if not isinstance(e, str)]
954
- # if invalid_elems:
955
- # raise TypeError(
956
- # err_message +
957
- # f"All elements in `connects_to` must be strings, "
958
- # f"but found element types: {invalid_elems}."
959
- # )
946
+ if connects_to is not None:
947
+ valid_types = (str, list, tuple, set)
948
+ if not isinstance(connects_to, valid_types):
949
+ raise TypeError(
950
+ err_message +
951
+ f"`connects_to` must be one of {valid_types}, got type {type(connects_to).__name__}."
952
+ )
953
+ if isinstance(connects_to, (list, tuple, set)):
954
+ invalid_elems = [f"{type(e).__name__}" for e in connects_to if not isinstance(e, str)]
955
+ if invalid_elems:
956
+ raise TypeError(
957
+ err_message +
958
+ f"All elements in `connects_to` must be strings, "
959
+ f"but found element types: {invalid_elems}."
960
+ )
960
961
 
961
962
  _validate_decorators_signature()
962
963
 
@@ -1038,9 +1039,9 @@ def tensorleap_custom_instances_metric(name: str,
1038
1039
 
1039
1040
  leap_binder.add_custom_instance_metric(inner_without_validate, name, direction, compute_insights)
1040
1041
 
1041
- # if connects_to is not None:
1042
- # arg_names = leap_binder.setup_container.metrics[-1].metric_handler_data.arg_names
1043
- # _add_mapping_connections(connects_to, arg_names, NodeMappingType.Metric, name)
1042
+ if connects_to is not None:
1043
+ arg_names = leap_binder.setup_container.metrics[-1].metric_handler_data.arg_names
1044
+ _add_mapping_connections(connects_to, arg_names, NodeMappingType.Metric, name)
1044
1045
 
1045
1046
  def inner(*args, **kwargs):
1046
1047
  if not _call_from_tl_platform:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.174.dev3
3
+ Version: 1.0.174.dev4
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=31H-poFoC16QmBtwLIncLD7SeyiSIrr2MKNCo2YomWw,35944
24
- code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=6GiiP1uHnSE_0vjd0vhkPq24emGAfy5qnPeeKEMNwJ4,99574
24
+ code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=lRgfWBZ7yHrybeaii0mNUnL37mFR3DmezPhUZaxXHHo,99585
25
25
  code_loader/leaploader.py,sha256=TW82exQGqEk36XOLonjOfx4zU4P0BoOQLbft687uU_0,30707
26
26
  code_loader/leaploaderbase.py,sha256=NXCDIIF7-ziGJccKIE9NszMSYKEE-3bn4Z4Xa3oYYOc,5909
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.174.dev3.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
- code_loader-1.0.174.dev3.dist-info/METADATA,sha256=GGMVEl4xJINLriZeIjBCUK_HBNm_WCKBoVLggyX1Ilk,1095
36
- code_loader-1.0.174.dev3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
- code_loader-1.0.174.dev3.dist-info/RECORD,,
34
+ code_loader-1.0.174.dev4.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
+ code_loader-1.0.174.dev4.dist-info/METADATA,sha256=cmh1wefhdQLdpgo2-ETdjJ_fQ4VCguAd2Wyn44xSXhg,1095
36
+ code_loader-1.0.174.dev4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
+ code_loader-1.0.174.dev4.dist-info/RECORD,,