code-loader 1.0.165.dev3__tar.gz → 1.0.165.dev4__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.dev4}/PKG-INFO +1 -1
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/inner_leap_binder/leapbinder_decorators.py +38 -103
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/pyproject.toml +1 -1
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/LICENSE +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/README.md +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/contract/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/contract/datasetclasses.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/contract/enums.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/contract/exceptions.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/contract/mapping.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/contract/responsedataclasses.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/contract/visualizer_classes.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/default_losses.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/default_metrics.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/api.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/cli_config_utils.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/client.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/epoch.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/experiment.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/experiment_context.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/types.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/utils.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/experiment_api/workingspace_config_utils.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/inner_leap_binder/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/inner_leap_binder/leapbinder.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/leaploader.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/leaploaderbase.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/mixpanel_tracker.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/plot_functions/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/plot_functions/plot_functions.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/plot_functions/visualize.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/utils.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/visualizers/__init__.py +0 -0
- {code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/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:
|
|
@@ -722,88 +699,46 @@ def tensorleap_custom_metric(name: str,
|
|
|
722
699
|
leap_binder.setup_container.metrics[-1].metric_handler_data.direction = effective_direction
|
|
723
700
|
|
|
724
701
|
if defaulted_direction_keys and not _call_from_tl_platform:
|
|
725
|
-
|
|
726
|
-
effective_compute_insights = {}
|
|
727
|
-
elif isinstance(compute_insights, dict):
|
|
728
|
-
effective_compute_insights = compute_insights
|
|
729
|
-
else:
|
|
730
|
-
effective_compute_insights = {}
|
|
702
|
+
effective_compute_insights = compute_insights or {}
|
|
731
703
|
warning_keys = {key for key in defaulted_direction_keys if effective_compute_insights.get(key, True)}
|
|
732
704
|
if warning_keys:
|
|
733
705
|
store_warning_by_param(
|
|
734
|
-
param_name=f"direction[{
|
|
706
|
+
param_name=f"direction[{warning_keys}]",
|
|
735
707
|
user_func_name=user_function.__name__,
|
|
736
708
|
default_value=MetricDirection.Downward,
|
|
737
709
|
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics"
|
|
738
710
|
)
|
|
739
711
|
|
|
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
712
|
else:
|
|
762
713
|
_validate_single_metric(result)
|
|
763
714
|
|
|
764
|
-
if compute_insights is None
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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
|
-
)
|
|
715
|
+
if compute_insights is not None and not isinstance(compute_insights, bool):
|
|
716
|
+
warnings.warn(
|
|
717
|
+
(f'{user_function.__name__}() unclear intention: '
|
|
718
|
+
f'compute_insights should be boolean when using a single result. '
|
|
719
|
+
f'Got {type(compute_insights)}. reverting to default behavior compute_insights={True}'),
|
|
720
|
+
UserWarning
|
|
721
|
+
)
|
|
779
722
|
|
|
780
|
-
if direction is _UNSET:
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
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
|
-
)
|
|
723
|
+
if direction is not _UNSET and not isinstance(direction, MetricDirection):
|
|
724
|
+
warnings.warn(
|
|
725
|
+
(f'{user_function.__name__}() unclear intention: '
|
|
726
|
+
f'direction should be a MetricDirection when using a single result. '
|
|
727
|
+
f'Got {type(direction)}. reverting to default behavior {MetricDirection.Downward}.'),
|
|
728
|
+
UserWarning
|
|
729
|
+
)
|
|
730
|
+
direction=MetricDirection.Downward
|
|
804
731
|
|
|
805
|
-
|
|
806
|
-
|
|
732
|
+
if not _call_from_tl_platform and compute_insights is not False and direction is _UNSET:
|
|
733
|
+
store_warning_by_param(
|
|
734
|
+
param_name="direction",
|
|
735
|
+
user_func_name=user_function.__name__,
|
|
736
|
+
default_value=MetricDirection.Downward,
|
|
737
|
+
link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/custom-metrics"
|
|
738
|
+
)
|
|
739
|
+
direction=MetricDirection.Downward
|
|
740
|
+
|
|
741
|
+
leap_binder.setup_container.metrics[-1].metric_handler_data.direction = direction
|
|
807
742
|
|
|
808
743
|
@functools.wraps(user_function)
|
|
809
744
|
def inner_without_validate(*args, **kwargs):
|
|
@@ -1764,17 +1699,12 @@ def tensorleap_status_table():
|
|
|
1764
1699
|
default_value = data[param_name]["default_value"]
|
|
1765
1700
|
funcs = ", ".join(sorted(data[param_name]["funcs"]))
|
|
1766
1701
|
dv = _format_default_value(default_value)
|
|
1767
|
-
messages = data[param_name].get("messages", [])
|
|
1768
1702
|
|
|
1769
1703
|
docs_link = data[param_name].get("link_to_docs")
|
|
1770
1704
|
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}")
|
|
1705
|
+
print(
|
|
1706
|
+
f" ⚠️ Parameter '{param_name}' defaults to {dv} in the following functions: [{funcs}]. "
|
|
1707
|
+
f"For more information, check {docs_part}")
|
|
1778
1708
|
print("\nIf this isn’t the intended behaviour, set them explicitly.")
|
|
1779
1709
|
|
|
1780
1710
|
def _print_table():
|
|
@@ -1864,3 +1794,8 @@ def tensorleap_status_table():
|
|
|
1864
1794
|
|
|
1865
1795
|
if not _call_from_tl_platform:
|
|
1866
1796
|
set_current, update_env_params_func = tensorleap_status_table()
|
|
1797
|
+
|
|
1798
|
+
|
|
1799
|
+
|
|
1800
|
+
|
|
1801
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/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.dev4}/code_loader/contract/responsedataclasses.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/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.dev4}/code_loader/experiment_api/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/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.dev4}/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.dev4}/code_loader/inner_leap_binder/__init__.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/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.dev4}/code_loader/plot_functions/__init__.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/code_loader/plot_functions/plot_functions.py
RENAMED
|
File without changes
|
{code_loader-1.0.165.dev3 → code_loader-1.0.165.dev4}/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.dev4}/code_loader/visualizers/default_visualizers.py
RENAMED
|
File without changes
|