code-loader 1.0.94.dev10__py3-none-any.whl → 1.0.94.dev12__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.

@@ -40,7 +40,7 @@ class PreprocessResponse:
40
40
  sample_id_type: Optional[Union[Type[str], Type[int]]] = None
41
41
  sample_ids_to_instance_mappings: Optional[Dict[str, List[str]]] = None # in use only for element instance
42
42
  instance_to_sample_ids_mappings: Optional[Dict[str, str]] = None # in use only for element instance
43
- instance_id_to_instance_name: Optional[Dict[str, str]] = None # in use only for element instance
43
+
44
44
 
45
45
  def __post_init__(self) -> None:
46
46
  def is_valid_string(s: str) -> bool:
@@ -48,7 +48,6 @@ class PreprocessResponse:
48
48
 
49
49
  assert self.sample_ids_to_instance_mappings is None, f"Keep sample_ids_to_instance_mappings None when initializing PreprocessResponse"
50
50
  assert self.instance_to_sample_ids_mappings is None, f"Keep instance_to_sample_ids_mappings None when initializing PreprocessResponse"
51
- assert self.instance_id_to_instance_name is None, f"Keep instance_id_to_instance_name None when initializing PreprocessResponse"
52
51
 
53
52
  if self.length is not None and self.sample_ids is None:
54
53
  self.sample_ids = [i for i in range(self.length)]
@@ -270,42 +270,31 @@ def tensorleap_preprocess():
270
270
 
271
271
  return decorating_function
272
272
 
273
- def tensorleap_element_instance_preprocess(instance_mask_encoder: Callable[[int, PreprocessResponse], List[ElementInstance]]):
273
+ def tensorleap_element_instance_preprocess(instance_mask_encoder: Callable[[str, PreprocessResponse], List[ElementInstance]]):
274
274
  def decorating_function(user_function: Callable[[], List[PreprocessResponse]]):
275
275
  def user_function_instance() -> List[PreprocessResponse]:
276
276
  result = user_function()
277
277
  for preprocess_response in result:
278
278
  sample_ids_to_instance_mappings = {}
279
279
  instance_to_sample_ids_mappings = {}
280
- instance_id_to_instance_name = {}
281
280
  all_sample_ids = preprocess_response.sample_ids.copy()
282
281
  for sample_id in preprocess_response.sample_ids:
283
282
  instances_masks = instance_mask_encoder(sample_id, preprocess_response)
284
- instance_names = [instance.name for instance in instances_masks]
285
283
  instances_ids = [f'{sample_id}_{instance_id}' for instance_id in range(len(instances_masks))]
286
284
  sample_ids_to_instance_mappings[sample_id] = instances_ids
287
285
  instance_to_sample_ids_mappings[sample_id] = sample_id
288
- instance_id_to_instance_name[sample_id] = None
289
- for instance_id, instance_name in zip(instances_ids, instance_names):
286
+ for instance_id in instances_ids:
290
287
  instance_to_sample_ids_mappings[instance_id] = sample_id
291
- instance_id_to_instance_name[instance_id] = instance_name
292
288
  all_sample_ids.extend(instances_ids)
293
289
  preprocess_response.sample_ids_to_instance_mappings = sample_ids_to_instance_mappings
294
290
  preprocess_response.instance_to_sample_ids_mappings = instance_to_sample_ids_mappings
295
- preprocess_response.instance_id_to_instance_name = instance_id_to_instance_name
296
291
  preprocess_response.sample_ids = all_sample_ids
297
292
  return result
298
293
 
299
294
  def metadata_is_instance(idx: str, preprocess: PreprocessResponse) -> Dict[str, str]:
300
- # return {'is_instance': '0',
301
- # 'orig_sample_id': preprocess.instance_to_sample_ids_mappings[idx],
302
- # 'instance_name': preprocess.instance_id_to_instance_name[idx]}
303
- # return '0'
304
- return {'is_instance': '0',
305
- 'original_sample_id': idx,
306
- 'instance_name': '0'}
295
+ return '0'
307
296
  leap_binder.set_preprocess(user_function_instance)
308
- leap_binder.set_metadata(metadata_is_instance, "builtin_instance_metadata")
297
+ leap_binder.set_metadata(metadata_is_instance, "metadata_is_instance")
309
298
 
310
299
  def _validate_input_args(*args, **kwargs):
311
300
  assert len(args) == 0 and len(kwargs) == 0, \
code_loader/leaploader.py CHANGED
@@ -533,7 +533,7 @@ class LeapLoader(LeapLoaderBase):
533
533
 
534
534
  return id_type
535
535
 
536
- def get_instances_data(self, state: DataStateEnum) -> Tuple[Dict[str, List[str]], Dict[str, str], Dict[str, str]]:
536
+ def get_instances_data(self, state: DataStateEnum) -> Tuple[Dict[Union[int, str], List[Union[int, str]]], Dict[Union[int, str], Union[int, str]], List[Union[int, str]]]:
537
537
  """
538
538
  This Method get the data state and returns two dictionaries that holds the mapping of the sample ids to their
539
539
  instances and the other way around and the sample ids array.
@@ -546,4 +546,4 @@ class LeapLoader(LeapLoaderBase):
546
546
  """
547
547
  preprocess_result = self._preprocess_result()
548
548
  preprocess_state = preprocess_result[state]
549
- return preprocess_state.sample_ids_to_instance_mappings, preprocess_state.instance_to_sample_ids_mappings, preprocess_state.instance_id_to_instance_name
549
+ return preprocess_state.sample_ids_to_instance_mappings, preprocess_state.instance_to_sample_ids_mappings, preprocess_state.sample_ids
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.94.dev10
3
+ Version: 1.0.94.dev12
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
1
  LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
2
2
  code_loader/__init__.py,sha256=6MMWr0ObOU7hkqQKgOqp4Zp3I28L7joGC9iCbQYtAJg,241
3
3
  code_loader/contract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- code_loader/contract/datasetclasses.py,sha256=PT1dMA0FxpzJ75rpc79d_oxn3zJmrdOihKTC46ZEZvI,9139
4
+ code_loader/contract/datasetclasses.py,sha256=af_AcMYL6KZZ_yfsxSEWFmlkjSPE-Yn1gm1GO0RvnYg,8902
5
5
  code_loader/contract/enums.py,sha256=GEFkvUMXnCNt-GOoz7NJ9ecQZ2PPDettJNOsxsiM0wk,1622
6
6
  code_loader/contract/exceptions.py,sha256=jWqu5i7t-0IG0jGRsKF4DjJdrsdpJjIYpUkN1F4RiyQ,51
7
7
  code_loader/contract/mapping.py,sha256=e11h_sprwOyE32PcqgRq9JvyahQrPzwqgkhmbQLKLQY,1165
@@ -21,13 +21,13 @@ 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=wmCOj_YKbRXqLL1k5Tw_FrcZgfmgnVQcjs2ok6wdlww,32362
24
- code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=qo258jIpYMtPNeab_YlYnfWM1FAvJEQSBocdGXLGJIY,29822
25
- code_loader/leaploader.py,sha256=NTsvvsXdi29qU6TvCyU4BC5ndNFnus878OvDY39je9U,28829
24
+ code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=BwAWV9UN6jDE2dLlLAzIkeA0f7YpmgU3Jm15y7btNI8,29054
25
+ code_loader/leaploader.py,sha256=HPDZb10HPYh18_HjoIYT8ipB5pmVvL5tEI_KFKmHS7g,28866
26
26
  code_loader/leaploaderbase.py,sha256=tpMVEd97675b_var4hvesjN7EgQzoCbPEayNBut6AvI,4551
27
27
  code_loader/utils.py,sha256=_j8b60pimoNAvWMRj7hEkkT6C76qES6cZoBFHpXHMxA,2698
28
28
  code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  code_loader/visualizers/default_visualizers.py,sha256=669lBpLISLO6my5Qcgn1FLDDeZgHumPf252m4KHY4YM,2555
30
- code_loader-1.0.94.dev10.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
31
- code_loader-1.0.94.dev10.dist-info/METADATA,sha256=IkGEuZkgPKr6FbNPVmfwJaCx17QM53-NNNmrHcQSufw,855
32
- code_loader-1.0.94.dev10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
33
- code_loader-1.0.94.dev10.dist-info/RECORD,,
30
+ code_loader-1.0.94.dev12.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
31
+ code_loader-1.0.94.dev12.dist-info/METADATA,sha256=ZS4Tv9xLI_tq27pB406EBDfxG2DjVikCpLBJxMsr1js,855
32
+ code_loader-1.0.94.dev12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
33
+ code_loader-1.0.94.dev12.dist-info/RECORD,,