code-loader 1.0.75__tar.gz → 1.0.77.1__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.75 → code_loader-1.0.77.1}/PKG-INFO +1 -1
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/contract/datasetclasses.py +9 -1
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/inner_leap_binder/leapbinder_decorators.py +14 -10
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/leaploader.py +1 -1
- {code_loader-1.0.75 → code_loader-1.0.77.1}/pyproject.toml +1 -1
- {code_loader-1.0.75 → code_loader-1.0.77.1}/LICENSE +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/README.md +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/__init__.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/contract/__init__.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/contract/enums.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/contract/exceptions.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/contract/responsedataclasses.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/contract/visualizer_classes.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/default_losses.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/default_metrics.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/__init__.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/api.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/cli_config_utils.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/client.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/epoch.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/experiment.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/experiment_context.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/types.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/utils.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/workingspace_config_utils.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/inner_leap_binder/__init__.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/inner_leap_binder/leapbinder.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/leaploaderbase.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/utils.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/visualizers/__init__.py +0 -0
- {code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/visualizers/default_visualizers.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
from dataclasses import dataclass, field
|
2
2
|
from typing import Any, Callable, List, Optional, Dict, Union, Type
|
3
|
-
|
3
|
+
import re
|
4
4
|
import numpy as np
|
5
5
|
import numpy.typing as npt
|
6
6
|
|
@@ -39,6 +39,9 @@ class PreprocessResponse:
|
|
39
39
|
sample_id_type: Optional[Union[Type[str], Type[int]]] = None
|
40
40
|
|
41
41
|
def __post_init__(self) -> None:
|
42
|
+
def is_valid_string(s: str) -> bool:
|
43
|
+
return bool(re.match(r'^[A-Za-z0-9_]+$', s))
|
44
|
+
|
42
45
|
if self.length is not None and self.sample_ids is None:
|
43
46
|
self.sample_ids = [i for i in range(self.length)]
|
44
47
|
self.sample_id_type = int
|
@@ -46,6 +49,11 @@ class PreprocessResponse:
|
|
46
49
|
self.length = len(self.sample_ids)
|
47
50
|
if self.sample_id_type is None:
|
48
51
|
self.sample_id_type = str
|
52
|
+
if self.sample_id_type == str:
|
53
|
+
for sample_id in self.sample_ids:
|
54
|
+
assert isinstance(sample_id, str), f"Sample id should be of type str. Got: {type(sample_id)}"
|
55
|
+
if not is_valid_string(sample_id):
|
56
|
+
raise Exception(f"Sample id should contain only letters (A-Z, a-z), numbers or '_'. Got: {sample_id}")
|
49
57
|
else:
|
50
58
|
raise Exception("length is deprecated.")
|
51
59
|
|
{code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/inner_leap_binder/leapbinder_decorators.py
RENAMED
@@ -30,8 +30,9 @@ def tensorleap_custom_metric(name: str,
|
|
30
30
|
|
31
31
|
def _validate_input_args(*args, **kwargs) -> None:
|
32
32
|
for i, arg in enumerate(args):
|
33
|
-
assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
|
34
|
-
|
33
|
+
assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
|
34
|
+
f'tensorleap_custom_metric validation failed: '
|
35
|
+
f'Argument #{i} should be a numpy array. Got {type(arg)}.')
|
35
36
|
if leap_binder.batch_size_to_validate and isinstance(arg, np.ndarray):
|
36
37
|
assert arg.shape[0] == leap_binder.batch_size_to_validate, \
|
37
38
|
(f'tensorleap_custom_metric validation failed: Argument #{i} '
|
@@ -39,8 +40,9 @@ def tensorleap_custom_metric(name: str,
|
|
39
40
|
f'instead of {leap_binder.batch_size_to_validate}')
|
40
41
|
|
41
42
|
for _arg_name, arg in kwargs.items():
|
42
|
-
assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
|
43
|
-
|
43
|
+
assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
|
44
|
+
f'tensorleap_custom_metric validation failed: '
|
45
|
+
f'Argument {_arg_name} should be a numpy array. Got {type(arg)}.')
|
44
46
|
if leap_binder.batch_size_to_validate and isinstance(arg, np.ndarray):
|
45
47
|
assert arg.shape[0] == leap_binder.batch_size_to_validate, \
|
46
48
|
(f'tensorleap_custom_metric validation failed: Argument {_arg_name} '
|
@@ -58,8 +60,8 @@ def tensorleap_custom_metric(name: str,
|
|
58
60
|
assert isinstance(single_metric_result[0][0], ConfusionMatrixElement), \
|
59
61
|
f'{supported_types_message}Got List[List[{type(single_metric_result[0][0])}]].'
|
60
62
|
else:
|
61
|
-
assert isinstance(single_metric_result[0],
|
62
|
-
|
63
|
+
assert isinstance(single_metric_result[0], (
|
64
|
+
float, int, type(None))), f'{supported_types_message}Got List[{type(single_metric_result[0])}].'
|
63
65
|
else:
|
64
66
|
assert isinstance(single_metric_result,
|
65
67
|
np.ndarray), f'{supported_types_message}Got {type(single_metric_result)}.'
|
@@ -115,16 +117,18 @@ def tensorleap_custom_visualizer(name: str, visualizer_type: LeapDataType,
|
|
115
117
|
|
116
118
|
def _validate_input_args(*args, **kwargs):
|
117
119
|
for i, arg in enumerate(args):
|
118
|
-
assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
|
119
|
-
|
120
|
+
assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
|
121
|
+
f'tensorleap_custom_visualizer validation failed: '
|
122
|
+
f'Argument #{i} should be a numpy array. Got {type(arg)}.')
|
120
123
|
if leap_binder.batch_size_to_validate and isinstance(arg, np.ndarray):
|
121
124
|
assert arg.shape[0] != leap_binder.batch_size_to_validate, \
|
122
125
|
(f'tensorleap_custom_visualizer validation failed: '
|
123
126
|
f'Argument #{i} should be without batch dimension. ')
|
124
127
|
|
125
128
|
for _arg_name, arg in kwargs.items():
|
126
|
-
assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
|
127
|
-
|
129
|
+
assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
|
130
|
+
f'tensorleap_custom_visualizer validation failed: '
|
131
|
+
f'Argument {_arg_name} should be a numpy array. Got {type(arg)}.')
|
128
132
|
if leap_binder.batch_size_to_validate and isinstance(arg, np.ndarray):
|
129
133
|
assert arg.shape[0] != leap_binder.batch_size_to_validate, \
|
130
134
|
(f'tensorleap_custom_visualizer validation failed: Argument {_arg_name} '
|
@@ -46,7 +46,7 @@ class LeapLoader(LeapLoaderBase):
|
|
46
46
|
|
47
47
|
def evaluate_module(self) -> None:
|
48
48
|
def append_path_recursively(full_path: str) -> None:
|
49
|
-
if
|
49
|
+
if self.code_path not in full_path or full_path == '/':
|
50
50
|
return
|
51
51
|
|
52
52
|
parent_path = str(Path(full_path).parent)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/experiment_context.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{code_loader-1.0.75 → code_loader-1.0.77.1}/code_loader/experiment_api/workingspace_config_utils.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|