code-loader 1.0.165.dev2__tar.gz → 1.0.165.dev3__tar.gz
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-1.0.165.dev2 → code_loader-1.0.165.dev3}/PKG-INFO +1 -1
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/inner_leap_binder/leapbinder_decorators.py +103 -39
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/pyproject.toml +1 -1
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/LICENSE +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/README.md +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/__init__.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/__init__.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/datasetclasses.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/enums.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/exceptions.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/mapping.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/responsedataclasses.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/visualizer_classes.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/default_losses.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/default_metrics.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/__init__.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/api.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/cli_config_utils.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/client.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/epoch.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/experiment.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/experiment_context.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/types.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/utils.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/workingspace_config_utils.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/inner_leap_binder/__init__.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/inner_leap_binder/leapbinder.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/leaploader.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/leaploaderbase.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/mixpanel_tracker.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/plot_functions/__init__.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/plot_functions/plot_functions.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/plot_functions/visualize.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/utils.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/visualizers/__init__.py +0 -0
- {code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/visualizers/default_visualizers.py +0 -0
|
@@ -45,6 +45,7 @@ _PARAM_DEFAULT_FUNCS: DefaultDict[str, Set[str]] = defaultdict(set)
|
|
|
45
45
|
# param_name -> default_value used (repr-able)
|
|
46
46
|
_PARAM_DEFAULT_VALUE: Dict[str, Any] = {}
|
|
47
47
|
_PARAM_DEFAULT_DOCS: Dict[str, str] = {}
|
|
48
|
+
_PARAM_DEFAULT_MESSAGES: DefaultDict[str, Set[str]] = defaultdict(set)
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
def get_entry_script_path() -> str:
|
|
@@ -67,6 +68,7 @@ def store_warning_by_param(
|
|
|
67
68
|
user_func_name: str,
|
|
68
69
|
default_value: Any,
|
|
69
70
|
link_to_docs: str = None,
|
|
71
|
+
custom_message: Optional[str] = None,
|
|
70
72
|
) -> None:
|
|
71
73
|
_PARAM_DEFAULT_FUNCS[param_name].add(user_func_name)
|
|
72
74
|
|
|
@@ -76,6 +78,9 @@ def store_warning_by_param(
|
|
|
76
78
|
if link_to_docs and param_name not in _PARAM_DEFAULT_DOCS:
|
|
77
79
|
_PARAM_DEFAULT_DOCS[param_name] = link_to_docs
|
|
78
80
|
|
|
81
|
+
if custom_message:
|
|
82
|
+
_PARAM_DEFAULT_MESSAGES[param_name].add(custom_message)
|
|
83
|
+
|
|
79
84
|
|
|
80
85
|
def _get_param_default_warnings() -> Dict[str, Dict[str, Any]]:
|
|
81
86
|
out: Dict[str, Dict[str, Any]] = {}
|
|
@@ -84,6 +89,7 @@ def _get_param_default_warnings() -> Dict[str, Dict[str, Any]]:
|
|
|
84
89
|
"default_value": _PARAM_DEFAULT_VALUE.get(p, None),
|
|
85
90
|
"funcs": set(funcs),
|
|
86
91
|
"link_to_docs": _PARAM_DEFAULT_DOCS.get(p),
|
|
92
|
+
"messages": sorted(_PARAM_DEFAULT_MESSAGES.get(p, set())),
|
|
87
93
|
}
|
|
88
94
|
return out
|
|
89
95
|
|
|
@@ -530,8 +536,6 @@ def tensorleap_custom_metric(name: str,
|
|
|
530
536
|
ConfusionMatrixCallableInterfaceMultiArgs]):
|
|
531
537
|
nonlocal direction
|
|
532
538
|
|
|
533
|
-
direction_was_provided = direction is not _UNSET
|
|
534
|
-
|
|
535
539
|
def _validate_decorators_signature():
|
|
536
540
|
err_message = f"{user_function.__name__} validation failed.\n"
|
|
537
541
|
if not isinstance(name, str):
|
|
@@ -678,28 +682,38 @@ def tensorleap_custom_metric(name: str,
|
|
|
678
682
|
(f'{user_function.__name__}() validation failed: '
|
|
679
683
|
f'Keys in the return dict should be of type str. Got {type(key)}.')
|
|
680
684
|
|
|
681
|
-
assert direction is _UNSET or isinstance(direction, dict), \
|
|
682
|
-
(f'{user_function.__name__}() validation failed: '
|
|
683
|
-
f'direction should be a dict when using dict results. Got {type(direction)}.') #TODO - remove this assertion so a single value would controll all directions
|
|
684
|
-
|
|
685
685
|
if isinstance(direction, dict):
|
|
686
686
|
for direction_key in direction:
|
|
687
687
|
assert direction_key in result, \
|
|
688
688
|
(f'{user_function.__name__}() validation failed: '
|
|
689
689
|
f'Keys in the direction mapping should be part of result keys. Got key {direction_key}.')
|
|
690
690
|
|
|
691
|
-
if compute_insights
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
691
|
+
if isinstance(compute_insights, dict):
|
|
692
|
+
for ci_key in compute_insights:
|
|
693
|
+
assert ci_key in result, \
|
|
694
|
+
(f'{user_function.__name__}() validation failed: '
|
|
695
|
+
f'Keys in the compute_insights mapping should be part of result keys. Got key {ci_key}.')
|
|
695
696
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
697
|
+
if direction is _UNSET:
|
|
698
|
+
effective_direction = {}
|
|
699
|
+
elif isinstance(direction, dict):
|
|
700
|
+
effective_direction = direction
|
|
701
|
+
else:
|
|
702
|
+
effective_direction = {}
|
|
703
|
+
if not _call_from_tl_platform:
|
|
704
|
+
# TODO- remove this warning when engine supports high level direction setting for all submetrics
|
|
705
|
+
store_warning_by_param(
|
|
706
|
+
param_name="direction",
|
|
707
|
+
user_func_name=user_function.__name__,
|
|
708
|
+
default_value=MetricDirection.Downward,
|
|
709
|
+
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics",
|
|
710
|
+
custom_message=(
|
|
711
|
+
f"'direction': expected Dict[str, MetricDirection] for dict output, "
|
|
712
|
+
f"got {type(direction).__name__}; reverted to default per sub-metric "
|
|
713
|
+
f"({MetricDirection.Downward.name})."
|
|
714
|
+
)
|
|
715
|
+
)
|
|
701
716
|
|
|
702
|
-
effective_direction = {} if direction is _UNSET else direction
|
|
703
717
|
defaulted_direction_keys = result_keys.difference(effective_direction.keys())
|
|
704
718
|
|
|
705
719
|
if defaulted_direction_keys:
|
|
@@ -708,38 +722,88 @@ def tensorleap_custom_metric(name: str,
|
|
|
708
722
|
leap_binder.setup_container.metrics[-1].metric_handler_data.direction = effective_direction
|
|
709
723
|
|
|
710
724
|
if defaulted_direction_keys and not _call_from_tl_platform:
|
|
711
|
-
|
|
725
|
+
if compute_insights is None:
|
|
726
|
+
effective_compute_insights = {}
|
|
727
|
+
elif isinstance(compute_insights, dict):
|
|
728
|
+
effective_compute_insights = compute_insights
|
|
729
|
+
else:
|
|
730
|
+
effective_compute_insights = {}
|
|
712
731
|
warning_keys = {key for key in defaulted_direction_keys if effective_compute_insights.get(key, True)}
|
|
713
732
|
if warning_keys:
|
|
714
733
|
store_warning_by_param(
|
|
715
|
-
param_name=f"direction[{warning_keys}]",
|
|
734
|
+
param_name=f"direction[{sorted(warning_keys)}]",
|
|
716
735
|
user_func_name=user_function.__name__,
|
|
717
736
|
default_value=MetricDirection.Downward,
|
|
718
737
|
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics"
|
|
719
738
|
)
|
|
720
739
|
|
|
740
|
+
if compute_insights is not None and not isinstance(compute_insights, dict) and not _call_from_tl_platform:
|
|
741
|
+
# TODO- remove this warning when engine supports high level compute_insights setting for all submetrics
|
|
742
|
+
store_warning_by_param(
|
|
743
|
+
param_name="compute_insights",
|
|
744
|
+
user_func_name=user_function.__name__,
|
|
745
|
+
default_value=None,
|
|
746
|
+
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics",
|
|
747
|
+
custom_message=(
|
|
748
|
+
f"'compute_insights': expected Dict[str, bool] for dict output, "
|
|
749
|
+
f"got {type(compute_insights).__name__}; reverted to default (None)."
|
|
750
|
+
)
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
if compute_insights is None:
|
|
754
|
+
effective_compute_insights_for_handler = None
|
|
755
|
+
elif isinstance(compute_insights, dict):
|
|
756
|
+
effective_compute_insights_for_handler = compute_insights
|
|
757
|
+
else:
|
|
758
|
+
effective_compute_insights_for_handler = None
|
|
759
|
+
leap_binder.setup_container.metrics[-1].metric_handler_data.compute_insights = effective_compute_insights_for_handler
|
|
760
|
+
|
|
721
761
|
else:
|
|
722
762
|
_validate_single_metric(result)
|
|
723
763
|
|
|
724
|
-
if compute_insights is
|
|
725
|
-
|
|
726
|
-
(f'{user_function.__name__}() validation failed: '
|
|
727
|
-
f'compute_insights should be boolean. Got {type(compute_insights)}.')
|
|
728
|
-
if direction is not _UNSET:
|
|
729
|
-
assert isinstance(direction, MetricDirection), \
|
|
730
|
-
(f'{user_function.__name__}() validation failed: '
|
|
731
|
-
f'direction should be a MetricDirection when using a single result. Got {type(direction)}.')
|
|
732
|
-
|
|
764
|
+
if compute_insights is None or isinstance(compute_insights, bool):
|
|
765
|
+
effective_single_compute_insights = compute_insights
|
|
733
766
|
else:
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
767
|
+
effective_single_compute_insights = None
|
|
768
|
+
if not _call_from_tl_platform:
|
|
769
|
+
store_warning_by_param(
|
|
770
|
+
param_name="compute_insights",
|
|
771
|
+
user_func_name=user_function.__name__,
|
|
772
|
+
default_value=None,
|
|
773
|
+
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics",
|
|
774
|
+
custom_message=(
|
|
775
|
+
f"'compute_insights': expected bool for single-valued output, "
|
|
776
|
+
f"got {type(compute_insights).__name__}; reverted to default (None)."
|
|
777
|
+
)
|
|
778
|
+
)
|
|
779
|
+
|
|
780
|
+
if direction is _UNSET:
|
|
781
|
+
effective_single_direction = MetricDirection.Downward
|
|
782
|
+
if not _call_from_tl_platform and effective_single_compute_insights is not False:
|
|
737
783
|
store_warning_by_param(
|
|
738
784
|
param_name="direction",
|
|
739
785
|
user_func_name=user_function.__name__,
|
|
740
|
-
default_value=
|
|
786
|
+
default_value=effective_single_direction,
|
|
741
787
|
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics"
|
|
742
788
|
)
|
|
789
|
+
elif isinstance(direction, MetricDirection):
|
|
790
|
+
effective_single_direction = direction
|
|
791
|
+
else:
|
|
792
|
+
effective_single_direction = MetricDirection.Downward
|
|
793
|
+
if not _call_from_tl_platform and effective_single_compute_insights is not False:
|
|
794
|
+
store_warning_by_param(
|
|
795
|
+
param_name="direction",
|
|
796
|
+
user_func_name=user_function.__name__,
|
|
797
|
+
default_value=effective_single_direction,
|
|
798
|
+
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics",
|
|
799
|
+
custom_message=(
|
|
800
|
+
f"'direction': expected MetricDirection for single-valued output, "
|
|
801
|
+
f"got {type(direction).__name__}; reverted to default ({MetricDirection.Downward.name})."
|
|
802
|
+
)
|
|
803
|
+
)
|
|
804
|
+
|
|
805
|
+
leap_binder.setup_container.metrics[-1].metric_handler_data.direction = effective_single_direction
|
|
806
|
+
leap_binder.setup_container.metrics[-1].metric_handler_data.compute_insights = effective_single_compute_insights
|
|
743
807
|
|
|
744
808
|
@functools.wraps(user_function)
|
|
745
809
|
def inner_without_validate(*args, **kwargs):
|
|
@@ -1700,12 +1764,17 @@ def tensorleap_status_table():
|
|
|
1700
1764
|
default_value = data[param_name]["default_value"]
|
|
1701
1765
|
funcs = ", ".join(sorted(data[param_name]["funcs"]))
|
|
1702
1766
|
dv = _format_default_value(default_value)
|
|
1767
|
+
messages = data[param_name].get("messages", [])
|
|
1703
1768
|
|
|
1704
1769
|
docs_link = data[param_name].get("link_to_docs")
|
|
1705
1770
|
docs_part = f" {_link(docs_link)}" if docs_link else ""
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1771
|
+
if messages:
|
|
1772
|
+
for msg in messages:
|
|
1773
|
+
print(f" ⚠️ {msg} (functions: [{funcs}]).")
|
|
1774
|
+
else:
|
|
1775
|
+
print(
|
|
1776
|
+
f" ⚠️ Parameter '{param_name}' defaults to {dv} in the following functions: [{funcs}]. "
|
|
1777
|
+
f"For more information, check {docs_part}")
|
|
1709
1778
|
print("\nIf this isn’t the intended behaviour, set them explicitly.")
|
|
1710
1779
|
|
|
1711
1780
|
def _print_table():
|
|
@@ -1795,8 +1864,3 @@ def tensorleap_status_table():
|
|
|
1795
1864
|
|
|
1796
1865
|
if not _call_from_tl_platform:
|
|
1797
1866
|
set_current, update_env_params_func = tensorleap_status_table()
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/datasetclasses.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/responsedataclasses.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/contract/visualizer_classes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/cli_config_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/experiment_api/experiment.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/inner_leap_binder/__init__.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/inner_leap_binder/leapbinder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/plot_functions/__init__.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/plot_functions/plot_functions.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/plot_functions/visualize.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev2 → code_loader-1.0.165.dev3}/code_loader/visualizers/default_visualizers.py
RENAMED
|
File without changes
|