code-loader 1.0.129.dev1__py3-none-any.whl → 1.0.131__py3-none-any.whl

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.

@@ -89,9 +89,42 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
89
89
  ret = self.model(arg)
90
90
  return ret.numpy()
91
91
 
92
+ def _convert_onnx_inputs_to_correct_type(
93
+ self, float_arrays_inputs: Dict[str, np.ndarray]
94
+ ) -> Dict[str, np.ndarray]:
95
+ """
96
+ Cast user-provided NumPy inputs to match the dtypes/shapes
97
+ expected by an ONNX Runtime InferenceSession.
98
+ """
99
+ coerced = {}
100
+ meta = {i.name: i for i in self.model.get_inputs()}
101
+
102
+ for name, arr in float_arrays_inputs.items():
103
+ if name not in meta:
104
+ # Keep as-is unless extra inputs are disallowed
105
+ coerced[name] = arr
106
+ continue
107
+
108
+ info = meta[name]
109
+ want_dtype = np.dtype(info.type) # ONNX Runtime gives NumPy dtype string
110
+
111
+ # Cast dtype if needed
112
+ if arr.dtype != want_dtype:
113
+ arr = arr.astype(want_dtype, copy=False)
114
+
115
+ coerced[name] = arr
116
+
117
+ # Verify required inputs are present
118
+ missing = [n for n in meta if n not in coerced]
119
+ if missing:
120
+ raise KeyError(f"Missing required input(s): {sorted(missing)}")
121
+
122
+ return coerced
123
+
92
124
  # onnx runtime interface
93
125
  def run(self, output_names, input_dict):
94
- return self.model.run(output_names, input_dict)
126
+ corrected_type_inputs = self._convert_onnx_inputs_to_correct_type(input_dict)
127
+ return self.model.run(output_names, corrected_type_inputs)
95
128
 
96
129
  def get_inputs(self):
97
130
  return self.model.get_inputs()
@@ -577,6 +610,7 @@ def tensorleap_element_instance_preprocess(
577
610
  for instance_id in instances_ids:
578
611
  instance_to_sample_ids_mappings[instance_id] = sample_id
579
612
  all_sample_ids.extend(instances_ids)
613
+ preprocess_response.length = len(all_sample_ids)
580
614
  preprocess_response.sample_ids_to_instance_mappings = sample_ids_to_instance_mappings
581
615
  preprocess_response.instance_to_sample_ids_mappings = instance_to_sample_ids_mappings
582
616
  preprocess_response.sample_ids = all_sample_ids
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.129.dev1
3
+ Version: 1.0.131
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -21,7 +21,7 @@ code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZ
21
21
  code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
22
22
  code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
23
23
  code_loader/inner_leap_binder/leapbinder.py,sha256=Q3D9yVM-GNEJfYRFvMV__BoZbcWOgnWKhrZXAv6Tu7o,33232
24
- code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=CkyNRUTgQyez7Rkq8zAUXWWk19MuzpLP7ZNN56AJpVU,47135
24
+ code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=wXZT-wNvixOC3-iKOf1YMWbr0DWQgSA5WsS2UetQ90k,48693
25
25
  code_loader/leaploader.py,sha256=85XUWd7Y8kup76xeqefgd8db7pGaeHMhE7QlmYlNFMw,29747
26
26
  code_loader/leaploaderbase.py,sha256=LIFcC6xo6V_iiGN3BjibXETu_l84EWM_WIOKAvkfTiM,4458
27
27
  code_loader/mixpanel_tracker.py,sha256=mJaJvs8Pc5w3FEmSSObFIMVekcs5pKdM3iZmN4wVFqA,4822
@@ -31,7 +31,7 @@ code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6Lz
31
31
  code_loader/utils.py,sha256=gXENTYpjdidq2dx0gVbXlErPeHoNs-4TYAZbLRe0y2c,2712
32
32
  code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  code_loader/visualizers/default_visualizers.py,sha256=onRnLE_TXfgLN4o52hQIOOhUcFexGlqJ3xSpQDVLuZM,2604
34
- code_loader-1.0.129.dev1.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
- code_loader-1.0.129.dev1.dist-info/METADATA,sha256=rkZBHjE70_Ic98sXHsL7gI-Z7RcsK3yzaa-YuJRvaL0,1095
36
- code_loader-1.0.129.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
- code_loader-1.0.129.dev1.dist-info/RECORD,,
34
+ code_loader-1.0.131.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
+ code_loader-1.0.131.dist-info/METADATA,sha256=J6wQd25HCrreLLrxFsLGpQN-rskZXT2jqeTOhJBcyQM,1090
36
+ code_loader-1.0.131.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
+ code_loader-1.0.131.dist-info/RECORD,,