code-loader 1.0.123__py3-none-any.whl → 1.0.124.dev0__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.

code_loader/leaploader.py CHANGED
@@ -157,7 +157,7 @@ class LeapLoader(LeapLoaderBase):
157
157
  for prediction_type in setup.prediction_types
158
158
  }
159
159
 
160
- def get_sample(self, state: DataStateEnum, sample_id: Union[int, str], instance_id: int = None) -> DatasetSample:
160
+ def get_sample(self, state: DataStateEnum, sample_id: Union[int, str]) -> DatasetSample:
161
161
  self.exec_script()
162
162
  preprocess_result = self._preprocess_result()
163
163
  if state == DataStateEnum.unlabeled and sample_id not in preprocess_result[state].sample_ids:
@@ -170,18 +170,30 @@ class LeapLoader(LeapLoaderBase):
170
170
  custom_latent_space = global_leap_binder.setup_container.custom_latent_space.function(sample_id,
171
171
  preprocess_result[
172
172
  state])
173
-
174
- instance_mask = self._get_instances_masks(state, sample_id, instance_id)
175
173
  sample = DatasetSample(inputs=self._get_inputs(state, sample_id),
176
174
  gt=None if state == DataStateEnum.unlabeled else self._get_gt(state, sample_id),
177
175
  metadata=metadata,
178
176
  metadata_is_none=metadata_is_none,
179
177
  index=sample_id,
180
178
  state=state,
181
- custom_latent_space=custom_latent_space,
182
- instance_masks = instance_mask)
179
+ custom_latent_space=custom_latent_space)
183
180
  return sample
184
181
 
182
+ def get_sample_with_masks(self, state: DataStateEnum, sample_id: Union[int, str], instance_id: int) -> DatasetSample:
183
+ self.exec_script()
184
+ preprocess_result = self._preprocess_result()
185
+ if state == DataStateEnum.unlabeled and sample_id not in preprocess_result[state].sample_ids:
186
+ self._preprocess_result(update_unlabeled_preprocess=True)
187
+
188
+ metadata, metadata_is_none = self._get_metadata(state, sample_id)
189
+ sample = DatasetSample(inputs=self._get_inputs(state, sample_id),
190
+ gt=None if state == DataStateEnum.unlabeled else self._get_gt(state, sample_id),
191
+ metadata=metadata,
192
+ metadata_is_none=metadata_is_none,
193
+ index=sample_id,
194
+ state=state,
195
+ instance_masks=self._get_instances_masks(state, sample_id, instance_id))
196
+ return sample
185
197
 
186
198
  def check_dataset(self) -> DatasetIntegParseResult:
187
199
  test_payloads: List[DatasetTestResultPayload] = []
@@ -471,9 +483,7 @@ class LeapLoader(LeapLoaderBase):
471
483
  def _get_inputs(self, state: DataStateEnum, sample_id: Union[int, str]) -> Dict[str, npt.NDArray[np.float32]]:
472
484
  return self._get_dataset_handlers(global_leap_binder.setup_container.inputs, state, sample_id)
473
485
 
474
- def _get_instances_masks(self, state: DataStateEnum, sample_id: Union[int, str], instance_id: int) -> Optional[Dict[str, ElementInstance]]:
475
- if instance_id is None:
476
- return None
486
+ def _get_instances_masks(self, state: DataStateEnum, sample_id: Union[int, str], instance_id: int) -> Dict[str, ElementInstance]:
477
487
  preprocess_result = self._preprocess_result()
478
488
  preprocess_state = preprocess_result[state]
479
489
  result_agg = {}
@@ -61,7 +61,11 @@ class LeapLoaderBase:
61
61
  pass
62
62
 
63
63
  @abstractmethod
64
- def get_sample(self, state: DataStateEnum, sample_id: Union[int, str], instance_id: int = None) -> DatasetSample:
64
+ def get_sample(self, state: DataStateEnum, sample_id: Union[int, str]) -> DatasetSample:
65
+ pass
66
+
67
+ @abstractmethod
68
+ def get_sample_with_masks(self, state: DataStateEnum, sample_id: Union[int, str], instance_id: int) -> DatasetSample:
65
69
  pass
66
70
 
67
71
  @abstractmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.123
3
+ Version: 1.0.124.dev0
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -22,8 +22,8 @@ code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaS
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
24
  code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=39Qv4VZBQ-TP1ToOo_cVcecz5s9Qx3bwj8Y8As9Z3Mw,45723
25
- code_loader/leaploader.py,sha256=e7oaxXuqNUWvon5h32pzzv7iHxpUbsVnQRWu9VgdTUc,29751
26
- code_loader/leaploaderbase.py,sha256=LIFcC6xo6V_iiGN3BjibXETu_l84EWM_WIOKAvkfTiM,4458
25
+ code_loader/leaploader.py,sha256=IIkZltZp83dUMNHI4RgcnqSv8u5jil6wl6QLaJ44FH4,30485
26
+ code_loader/leaploaderbase.py,sha256=4tdRbzBufvOEWqyiMlD0cuw1x7x-W099xbI8JF5QJkI,4589
27
27
  code_loader/mixpanel_tracker.py,sha256=U20vQXH8G7XIVXxcpQcVEZSuIwwGnyH5RMHXWZZG8HI,4639
28
28
  code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  code_loader/plot_functions/plot_functions.py,sha256=xg6Gi4myTN9crq6JtyrhYI38HLXjPVJcbnI7CIy8f7w,14625
@@ -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.123.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
- code_loader-1.0.123.dist-info/METADATA,sha256=xQWMvlruMQ9zO0OVm1Wv26Y3tEXIQq9dEKHa8d6vD-o,1090
36
- code_loader-1.0.123.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
- code_loader-1.0.123.dist-info/RECORD,,
34
+ code_loader-1.0.124.dev0.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
+ code_loader-1.0.124.dev0.dist-info/METADATA,sha256=aCuyyLe3y3HdHLvalN_5a_TC8qMtR-_nJx9X_AkAdxA,1095
36
+ code_loader-1.0.124.dev0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
+ code_loader-1.0.124.dev0.dist-info/RECORD,,