code-loader 1.0.131__tar.gz → 1.0.132.dev1__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.
Potentially problematic release.
This version of code-loader might be problematic. Click here for more details.
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/PKG-INFO +1 -1
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/contract/mapping.py +11 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/inner_leap_binder/leapbinder_decorators.py +33 -5
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/mixpanel_tracker.py +5 -1
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/pyproject.toml +1 -1
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/LICENSE +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/README.md +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/__init__.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/contract/__init__.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/contract/datasetclasses.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/contract/enums.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/contract/exceptions.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/contract/responsedataclasses.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/contract/visualizer_classes.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/default_losses.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/default_metrics.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/__init__.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/api.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/cli_config_utils.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/client.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/epoch.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/experiment.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/experiment_context.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/types.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/utils.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/workingspace_config_utils.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/inner_leap_binder/__init__.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/inner_leap_binder/leapbinder.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/leaploader.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/leaploaderbase.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/plot_functions/__init__.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/plot_functions/plot_functions.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/plot_functions/visualize.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/utils.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/visualizers/__init__.py +0 -0
- {code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/visualizers/default_visualizers.py +0 -0
|
@@ -21,12 +21,22 @@ class NodeMappingType(Enum):
|
|
|
21
21
|
Prediction1 = 'Prediction1'
|
|
22
22
|
Prediction2 = 'Prediction2'
|
|
23
23
|
Prediction3 = 'Prediction3'
|
|
24
|
+
Prediction4 = 'Prediction4'
|
|
25
|
+
Prediction5 = 'Prediction5'
|
|
26
|
+
Prediction6 = 'Prediction6'
|
|
27
|
+
Prediction7 = 'Prediction7'
|
|
28
|
+
Prediction8 = 'Prediction8'
|
|
29
|
+
Prediction9 = 'Prediction9'
|
|
24
30
|
Input0 = 'Input0'
|
|
25
31
|
Input1 = 'Input1'
|
|
26
32
|
Input2 = 'Input2'
|
|
27
33
|
Input3 = 'Input3'
|
|
28
34
|
Input4 = 'Input4'
|
|
29
35
|
Input5 = 'Input5'
|
|
36
|
+
Input6 = 'Input6'
|
|
37
|
+
Input7 = 'Input7'
|
|
38
|
+
Input8 = 'Input8'
|
|
39
|
+
Input9 = 'Input9'
|
|
30
40
|
PredictionLabels = 'PredictionLabels'
|
|
31
41
|
|
|
32
42
|
|
|
@@ -39,6 +49,7 @@ class NodeMapping:
|
|
|
39
49
|
arg_names: Optional[List[str]] = None
|
|
40
50
|
|
|
41
51
|
|
|
52
|
+
|
|
42
53
|
@dataclass
|
|
43
54
|
class NodeConnection:
|
|
44
55
|
node: NodeMapping
|
|
@@ -69,6 +69,11 @@ def integration_test():
|
|
|
69
69
|
|
|
70
70
|
return decorating_function
|
|
71
71
|
|
|
72
|
+
def _safe_get_item(key):
|
|
73
|
+
try:
|
|
74
|
+
return NodeMappingType[f'Input{str(key)}']
|
|
75
|
+
except ValueError:
|
|
76
|
+
raise Exception(f'Tensorleap currently supports models with no more then 10 inputs')
|
|
72
77
|
|
|
73
78
|
def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]] = None):
|
|
74
79
|
for i, prediction_type in enumerate(prediction_types):
|
|
@@ -92,6 +97,20 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
92
97
|
def _convert_onnx_inputs_to_correct_type(
|
|
93
98
|
self, float_arrays_inputs: Dict[str, np.ndarray]
|
|
94
99
|
) -> Dict[str, np.ndarray]:
|
|
100
|
+
ONNX_TYPE_TO_NP = {
|
|
101
|
+
"tensor(float)": np.float32,
|
|
102
|
+
"tensor(double)": np.float64,
|
|
103
|
+
"tensor(int64)": np.int64,
|
|
104
|
+
"tensor(int32)": np.int32,
|
|
105
|
+
"tensor(int16)": np.int16,
|
|
106
|
+
"tensor(int8)": np.int8,
|
|
107
|
+
"tensor(uint64)": np.uint64,
|
|
108
|
+
"tensor(uint32)": np.uint32,
|
|
109
|
+
"tensor(uint16)": np.uint16,
|
|
110
|
+
"tensor(uint8)": np.uint8,
|
|
111
|
+
"tensor(bool)": np.bool_,
|
|
112
|
+
}
|
|
113
|
+
|
|
95
114
|
"""
|
|
96
115
|
Cast user-provided NumPy inputs to match the dtypes/shapes
|
|
97
116
|
expected by an ONNX Runtime InferenceSession.
|
|
@@ -106,7 +125,11 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
106
125
|
continue
|
|
107
126
|
|
|
108
127
|
info = meta[name]
|
|
109
|
-
|
|
128
|
+
onnx_type = info.type
|
|
129
|
+
want_dtype = ONNX_TYPE_TO_NP.get(onnx_type)
|
|
130
|
+
|
|
131
|
+
if want_dtype is None:
|
|
132
|
+
raise TypeError(f"Unsupported ONNX input type: {onnx_type}")
|
|
110
133
|
|
|
111
134
|
# Cast dtype if needed
|
|
112
135
|
if arr.dtype != want_dtype:
|
|
@@ -141,15 +164,20 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
141
164
|
f'Expected key to be an int, got {type(key)} instead.'
|
|
142
165
|
|
|
143
166
|
ret = TempMapping()
|
|
144
|
-
|
|
167
|
+
try:
|
|
168
|
+
ret.node_mapping = NodeMapping('', NodeMappingType(f'Prediction{str(key)}'))
|
|
169
|
+
except ValueError as e:
|
|
170
|
+
raise Exception(f'Tensorleap currently supports models with no more then 10 active predictions,'
|
|
171
|
+
f' {key} not supported.')
|
|
145
172
|
return ret
|
|
146
173
|
|
|
147
174
|
class ModelPlaceholder:
|
|
175
|
+
|
|
148
176
|
# keras interface
|
|
149
177
|
def __call__(self, arg):
|
|
150
178
|
if isinstance(arg, list):
|
|
151
179
|
for i, elem in enumerate(arg):
|
|
152
|
-
elem.node_mapping.type =
|
|
180
|
+
elem.node_mapping.type = _safe_get_item(i)
|
|
153
181
|
else:
|
|
154
182
|
arg.node_mapping.type = NodeMappingType.Input0
|
|
155
183
|
|
|
@@ -164,14 +192,14 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
164
192
|
if isinstance(input_key, NodeMappingType):
|
|
165
193
|
elem.node_mapping.type = input_key
|
|
166
194
|
else:
|
|
167
|
-
elem.node_mapping.type =
|
|
195
|
+
elem.node_mapping.type = _safe_get_item(i)
|
|
168
196
|
|
|
169
197
|
return ModelOutputPlaceholder()
|
|
170
198
|
|
|
171
199
|
def get_inputs(self):
|
|
172
200
|
class FollowIndex:
|
|
173
201
|
def __init__(self, index):
|
|
174
|
-
self.name =
|
|
202
|
+
self.name = _safe_get_item(index)
|
|
175
203
|
|
|
176
204
|
class FollowInputIndex:
|
|
177
205
|
def __init__(self):
|
|
@@ -8,11 +8,13 @@ import uuid
|
|
|
8
8
|
from typing import Optional, Dict, Any
|
|
9
9
|
import mixpanel # type: ignore[import]
|
|
10
10
|
|
|
11
|
+
TRACKING_VERSION = '1'
|
|
12
|
+
|
|
11
13
|
|
|
12
14
|
class MixpanelTracker:
|
|
13
15
|
"""Handles Mixpanel event tracking for code-loader."""
|
|
14
16
|
|
|
15
|
-
def __init__(self, token: str = "
|
|
17
|
+
def __init__(self, token: str = "0c1710c9656bbfb1056bb46093e23ca1"):
|
|
16
18
|
self.token = token
|
|
17
19
|
self.mp = mixpanel.Mixpanel(token)
|
|
18
20
|
self._user_id: Optional[str] = None
|
|
@@ -106,6 +108,8 @@ class MixpanelTracker:
|
|
|
106
108
|
device_id = self._get_or_create_device_id()
|
|
107
109
|
|
|
108
110
|
properties = {
|
|
111
|
+
'tracking_version': TRACKING_VERSION,
|
|
112
|
+
'service': 'code-loader',
|
|
109
113
|
'whoami': whoami,
|
|
110
114
|
'$device_id': device_id, # Always use device_id for $device_id
|
|
111
115
|
'python_version': f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
|
|
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.131 → code_loader-1.0.132.dev1}/code_loader/contract/responsedataclasses.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/cli_config_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/experiment_api/experiment_context.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/inner_leap_binder/leapbinder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/plot_functions/plot_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.131 → code_loader-1.0.132.dev1}/code_loader/visualizers/default_visualizers.py
RENAMED
|
File without changes
|