code-loader 1.0.165.dev3__tar.gz → 1.0.165.dev5__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.dev3 → code_loader-1.0.165.dev5}/PKG-INFO +1 -1
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/inner_leap_binder/leapbinder_decorators.py +32 -92
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/pyproject.toml +1 -1
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/LICENSE +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/README.md +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/datasetclasses.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/enums.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/exceptions.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/mapping.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/responsedataclasses.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/visualizer_classes.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/default_losses.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/default_metrics.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/api.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/cli_config_utils.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/client.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/epoch.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/experiment.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/experiment_context.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/types.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/utils.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/workingspace_config_utils.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/inner_leap_binder/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/inner_leap_binder/leapbinder.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/leaploader.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/leaploaderbase.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/mixpanel_tracker.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/plot_functions/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/plot_functions/plot_functions.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/plot_functions/visualize.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/utils.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/visualizers/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/visualizers/default_visualizers.py +0 -0
|
@@ -45,7 +45,6 @@ _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)
|
|
49
48
|
|
|
50
49
|
|
|
51
50
|
def get_entry_script_path() -> str:
|
|
@@ -68,7 +67,6 @@ def store_warning_by_param(
|
|
|
68
67
|
user_func_name: str,
|
|
69
68
|
default_value: Any,
|
|
70
69
|
link_to_docs: str = None,
|
|
71
|
-
custom_message: Optional[str] = None,
|
|
72
70
|
) -> None:
|
|
73
71
|
_PARAM_DEFAULT_FUNCS[param_name].add(user_func_name)
|
|
74
72
|
|
|
@@ -78,9 +76,6 @@ def store_warning_by_param(
|
|
|
78
76
|
if link_to_docs and param_name not in _PARAM_DEFAULT_DOCS:
|
|
79
77
|
_PARAM_DEFAULT_DOCS[param_name] = link_to_docs
|
|
80
78
|
|
|
81
|
-
if custom_message:
|
|
82
|
-
_PARAM_DEFAULT_MESSAGES[param_name].add(custom_message)
|
|
83
|
-
|
|
84
79
|
|
|
85
80
|
def _get_param_default_warnings() -> Dict[str, Dict[str, Any]]:
|
|
86
81
|
out: Dict[str, Dict[str, Any]] = {}
|
|
@@ -89,7 +84,6 @@ def _get_param_default_warnings() -> Dict[str, Dict[str, Any]]:
|
|
|
89
84
|
"default_value": _PARAM_DEFAULT_VALUE.get(p, None),
|
|
90
85
|
"funcs": set(funcs),
|
|
91
86
|
"link_to_docs": _PARAM_DEFAULT_DOCS.get(p),
|
|
92
|
-
"messages": sorted(_PARAM_DEFAULT_MESSAGES.get(p, set())),
|
|
93
87
|
}
|
|
94
88
|
return out
|
|
95
89
|
|
|
@@ -536,6 +530,8 @@ def tensorleap_custom_metric(name: str,
|
|
|
536
530
|
ConfusionMatrixCallableInterfaceMultiArgs]):
|
|
537
531
|
nonlocal direction
|
|
538
532
|
|
|
533
|
+
direction_was_provided = direction is not _UNSET
|
|
534
|
+
|
|
539
535
|
def _validate_decorators_signature():
|
|
540
536
|
err_message = f"{user_function.__name__} validation failed.\n"
|
|
541
537
|
if not isinstance(name, str):
|
|
@@ -694,26 +690,7 @@ def tensorleap_custom_metric(name: str,
|
|
|
694
690
|
(f'{user_function.__name__}() validation failed: '
|
|
695
691
|
f'Keys in the compute_insights mapping should be part of result keys. Got key {ci_key}.')
|
|
696
692
|
|
|
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
|
-
)
|
|
716
|
-
|
|
693
|
+
effective_direction = {} if direction is _UNSET else direction if isinstance(direction, dict) else {k:direction for k in result_keys}
|
|
717
694
|
defaulted_direction_keys = result_keys.difference(effective_direction.keys())
|
|
718
695
|
|
|
719
696
|
if defaulted_direction_keys:
|
|
@@ -727,83 +704,47 @@ def tensorleap_custom_metric(name: str,
|
|
|
727
704
|
elif isinstance(compute_insights, dict):
|
|
728
705
|
effective_compute_insights = compute_insights
|
|
729
706
|
else:
|
|
730
|
-
effective_compute_insights = {}
|
|
707
|
+
effective_compute_insights = {k: compute_insights for k in result_keys}
|
|
731
708
|
warning_keys = {key for key in defaulted_direction_keys if effective_compute_insights.get(key, True)}
|
|
732
709
|
if warning_keys:
|
|
733
710
|
store_warning_by_param(
|
|
734
|
-
param_name=f"direction[{
|
|
711
|
+
param_name=f"direction[{warning_keys}]",
|
|
735
712
|
user_func_name=user_function.__name__,
|
|
736
713
|
default_value=MetricDirection.Downward,
|
|
737
714
|
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics"
|
|
738
715
|
)
|
|
739
716
|
|
|
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
|
-
|
|
761
717
|
else:
|
|
762
718
|
_validate_single_metric(result)
|
|
763
719
|
|
|
764
|
-
if compute_insights is None
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
720
|
+
if compute_insights is not None and not isinstance(compute_insights, bool):
|
|
721
|
+
warnings.warn(
|
|
722
|
+
(f'{user_function.__name__}() unclear intention: '
|
|
723
|
+
f'compute_insights should be boolean when using a single result. '
|
|
724
|
+
f'Got {type(compute_insights)}. reverting to default behavior compute_insights={True}'),
|
|
725
|
+
UserWarning
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
if direction is not _UNSET and not isinstance(direction, MetricDirection):
|
|
729
|
+
warnings.warn(
|
|
730
|
+
(f'{user_function.__name__}() unclear intention: '
|
|
731
|
+
f'direction should be a MetricDirection when using a single result. '
|
|
732
|
+
f'Got {type(direction)}. reverting to default behavior {MetricDirection.Downward}.'),
|
|
733
|
+
UserWarning
|
|
734
|
+
)
|
|
735
|
+
direction=MetricDirection.Downward
|
|
779
736
|
|
|
780
737
|
if direction is _UNSET:
|
|
781
|
-
|
|
782
|
-
if not _call_from_tl_platform and
|
|
738
|
+
direction = MetricDirection.Downward
|
|
739
|
+
if not _call_from_tl_platform and compute_insights is not False:
|
|
783
740
|
store_warning_by_param(
|
|
784
741
|
param_name="direction",
|
|
785
742
|
user_func_name=user_function.__name__,
|
|
786
|
-
default_value=
|
|
743
|
+
default_value=MetricDirection.Downward,
|
|
787
744
|
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics"
|
|
788
745
|
)
|
|
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
746
|
|
|
805
|
-
leap_binder.setup_container.metrics[-1].metric_handler_data.direction =
|
|
806
|
-
leap_binder.setup_container.metrics[-1].metric_handler_data.compute_insights = effective_single_compute_insights
|
|
747
|
+
leap_binder.setup_container.metrics[-1].metric_handler_data.direction = direction
|
|
807
748
|
|
|
808
749
|
@functools.wraps(user_function)
|
|
809
750
|
def inner_without_validate(*args, **kwargs):
|
|
@@ -1764,17 +1705,12 @@ def tensorleap_status_table():
|
|
|
1764
1705
|
default_value = data[param_name]["default_value"]
|
|
1765
1706
|
funcs = ", ".join(sorted(data[param_name]["funcs"]))
|
|
1766
1707
|
dv = _format_default_value(default_value)
|
|
1767
|
-
messages = data[param_name].get("messages", [])
|
|
1768
1708
|
|
|
1769
1709
|
docs_link = data[param_name].get("link_to_docs")
|
|
1770
1710
|
docs_part = f" {_link(docs_link)}" if docs_link else ""
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
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}")
|
|
1711
|
+
print(
|
|
1712
|
+
f" ⚠️ Parameter '{param_name}' defaults to {dv} in the following functions: [{funcs}]. "
|
|
1713
|
+
f"For more information, check {docs_part}")
|
|
1778
1714
|
print("\nIf this isn’t the intended behaviour, set them explicitly.")
|
|
1779
1715
|
|
|
1780
1716
|
def _print_table():
|
|
@@ -1864,3 +1800,7 @@ def tensorleap_status_table():
|
|
|
1864
1800
|
|
|
1865
1801
|
if not _call_from_tl_platform:
|
|
1866
1802
|
set_current, update_env_params_func = tensorleap_status_table()
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
|
|
1806
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/datasetclasses.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/responsedataclasses.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/contract/visualizer_classes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/experiment_api/cli_config_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/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.dev3 → code_loader-1.0.165.dev5}/code_loader/inner_leap_binder/__init__.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/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.dev3 → code_loader-1.0.165.dev5}/code_loader/plot_functions/__init__.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/plot_functions/plot_functions.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/plot_functions/visualize.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev5}/code_loader/visualizers/default_visualizers.py
RENAMED
|
File without changes
|