code-loader 1.0.153.dev4__py3-none-any.whl → 1.0.154.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.
@@ -82,8 +82,6 @@ class PreprocessResponse:
82
82
  class ElementInstance:
83
83
  name: str
84
84
  mask: npt.NDArray[np.float32]
85
- instance_metadata: Dict[str, Union[Optional[str], int, bool, Optional[float]]]
86
-
87
85
 
88
86
  SectionCallableInterface = Callable[[Union[int, str], PreprocessResponse], npt.NDArray[np.float32]]
89
87
  InstanceCallableInterface = Callable[[Union[int, str], PreprocessResponse, int], Optional[ElementInstance]]
@@ -46,7 +46,8 @@ class DataStateType(Enum):
46
46
  training = "training"
47
47
  validation = "validation"
48
48
  test = "test"
49
- unlabeled = "unlabeled"
49
+ unlabeled = "unlabeled",
50
+ additional_labeled = "additional_labeled"
50
51
 
51
52
 
52
53
  class DataStateEnum(IntEnum):
@@ -54,6 +55,7 @@ class DataStateEnum(IntEnum):
54
55
  validation = 1
55
56
  test = 2
56
57
  unlabeled = 3
58
+ additional_labeled = 4
57
59
 
58
60
 
59
61
  class ConfusionMatrixValue(Enum):
@@ -11,6 +11,7 @@ class DatasetPreprocess:
11
11
  validation_length: int
12
12
  test_length: Optional[int] = None
13
13
  unlabeled_length: Optional[int] = None
14
+ additional_labeled_length: Optional[int] = None
14
15
 
15
16
 
16
17
  @dataclass
@@ -1063,7 +1063,7 @@ def tensorleap_preprocess():
1063
1063
 
1064
1064
 
1065
1065
  def tensorleap_element_instance_preprocess(
1066
- instance_length_encoder: InstanceLengthCallableInterface, instance_mask_encoder: InstanceCallableInterface):
1066
+ instance_length_encoder: InstanceLengthCallableInterface):
1067
1067
  def decorating_function(user_function: Callable[[], List[PreprocessResponse]]):
1068
1068
  def user_function_instance() -> List[PreprocessResponse]:
1069
1069
  result = user_function()
@@ -1085,33 +1085,11 @@ def tensorleap_element_instance_preprocess(
1085
1085
  preprocess_response.sample_ids = all_sample_ids
1086
1086
  return result
1087
1087
 
1088
- def extract_extra_instance_metadata():
1089
- result = user_function()
1090
- for preprocess_response in result:
1091
- for sample_id in preprocess_response.sample_ids:
1092
- instances_length = instance_length_encoder(sample_id, preprocess_response)
1093
- if instances_length > 0:
1094
- element_instance = instance_mask_encoder(sample_id, preprocess_response, 0)
1095
- instance_metadata = element_instance.instance_metadata
1096
- if instance_metadata is None:
1097
- return {}
1098
- return instance_metadata
1099
- return {}
1100
-
1101
-
1102
1088
  def builtin_instance_metadata(idx: str, preprocess: PreprocessResponse) -> Dict[str, str]:
1103
1089
  return {'is_instance': '0', 'original_sample_id': idx, 'instance_name': 'none'}
1104
1090
 
1105
- def builtin_instance_extra_metadata(idx: str, preprocess: PreprocessResponse) -> Dict[str, str]:
1106
- instance_metadata = extract_extra_instance_metadata()
1107
- for key, value in instance_metadata.items():
1108
- instance_metadata[key] = 'unset'
1109
- return instance_metadata
1110
-
1111
1091
  leap_binder.set_preprocess(user_function_instance)
1112
1092
  leap_binder.set_metadata(builtin_instance_metadata, "builtin_instance_metadata")
1113
- leap_binder.set_metadata(builtin_instance_extra_metadata, "builtin_instance_extra_metadata")
1114
-
1115
1093
 
1116
1094
  def _validate_input_args(*args, **kwargs):
1117
1095
  assert len(args) == 0 and len(kwargs) == 0, \
@@ -1226,7 +1204,7 @@ def tensorleap_instances_masks_encoder(name: str):
1226
1204
  def tensorleap_instances_length_encoder(name: str):
1227
1205
  def decorating_function(user_function: InstanceLengthCallableInterface):
1228
1206
  def _validate_input_args(sample_id: str, preprocess_response: PreprocessResponse):
1229
- assert isinstance(sample_id, (str, int)), \
1207
+ assert isinstance(sample_id, str), \
1230
1208
  (f'tensorleap_instances_length_encoder validation failed: '
1231
1209
  f'Argument sample_id should be str. Got {type(sample_id)}.')
1232
1210
  assert isinstance(preprocess_response, PreprocessResponse), \
code_loader/leaploader.py CHANGED
@@ -357,7 +357,8 @@ class LeapLoader(LeapLoaderBase):
357
357
  training_length=setup.preprocess.data_length.get(DataStateType.training, 0),
358
358
  validation_length=setup.preprocess.data_length.get(DataStateType.validation, 0),
359
359
  test_length=setup.preprocess.data_length.get(DataStateType.test),
360
- unlabeled_length=unlabeled_length
360
+ unlabeled_length=unlabeled_length,
361
+ additional_labeled_length=setup.preprocess.data_length.get(DataStateType.additional_labeled),
361
362
  )
362
363
 
363
364
  inputs = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.153.dev4
3
+ Version: 1.0.154.dev0
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -1,11 +1,11 @@
1
1
  LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
2
2
  code_loader/__init__.py,sha256=outxRQ0M-zMfV0QGVJmAed5qWfRmyD0TV6-goEGAzBw,406
3
3
  code_loader/contract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- code_loader/contract/datasetclasses.py,sha256=IyUwwvu1c53KfUeTiVOYN20ak7aCo-26HYhm5seO6v8,9799
5
- code_loader/contract/enums.py,sha256=GEFkvUMXnCNt-GOoz7NJ9ecQZ2PPDettJNOsxsiM0wk,1622
4
+ code_loader/contract/datasetclasses.py,sha256=bo1EwOYfSs-mEOIsNawlUGbt5xWPWKeiEBWazCTC5FY,9715
5
+ code_loader/contract/enums.py,sha256=W5N2oydZNf0ZKdV3JNwKpkNk9j3dyS2efQN21smZnpA,1696
6
6
  code_loader/contract/exceptions.py,sha256=jWqu5i7t-0IG0jGRsKF4DjJdrsdpJjIYpUkN1F4RiyQ,51
7
7
  code_loader/contract/mapping.py,sha256=sWJhpng-IkOzQnWQdMT5w2ZZ3X1Z_OOzSwCLXIS7oxE,1446
8
- code_loader/contract/responsedataclasses.py,sha256=6-5DJkYBdXb3UB1eNidTTPPBIYxMjEoMdYDkp9VhH8o,4223
8
+ code_loader/contract/responsedataclasses.py,sha256=X-igBPOjUOG14-7FfvGyerRXaBIa_RjRC4_bYSN4XRc,4275
9
9
  code_loader/contract/visualizer_classes.py,sha256=Wz9eItmoRaKEHa3p0aW0Ypxx4_xUmaZyLBznnTuxwi0,15425
10
10
  code_loader/default_losses.py,sha256=NoOQym1106bDN5dcIk56Elr7ZG5quUHArqfP5-Nyxyo,1139
11
11
  code_loader/default_metrics.py,sha256=v16Mrt2Ze1tXPgfKywGVdRSrkaK4CKLNQztN1UdVqIY,5010
@@ -21,8 +21,8 @@ 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=aVMVjZjRmJy8-3_qyQ42RAcVfvajUZ-SupwcmNwhdaI,82000
25
- code_loader/leaploader.py,sha256=oxtlf7NhWuiUPeIwAO699JaD-mK_7fGM55okKLyKaJg,30582
24
+ code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=1N_3Rdj-ICoj28RGYGGaFEoHPGg8xo4wlkIh2zkQg18,80846
25
+ code_loader/leaploader.py,sha256=ZnZ6PxvUcTHAEIS89jFD8Bh1ME3OaURZNrPRqXwmss4,30689
26
26
  code_loader/leaploaderbase.py,sha256=NXCDIIF7-ziGJccKIE9NszMSYKEE-3bn4Z4Xa3oYYOc,5909
27
27
  code_loader/mixpanel_tracker.py,sha256=eKvymkw7X2Ht6iw-a0V9VQm6OnB9kW7hYy35YtwRAvU,8457
28
28
  code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.153.dev4.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
- code_loader-1.0.153.dev4.dist-info/METADATA,sha256=B4nPV_w3AFdba4SVtC-d03HSfaw_-MobZquctbpytbM,1095
36
- code_loader-1.0.153.dev4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
- code_loader-1.0.153.dev4.dist-info/RECORD,,
34
+ code_loader-1.0.154.dev0.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
+ code_loader-1.0.154.dev0.dist-info/METADATA,sha256=YEhD5TdWlWQIzz32A-UJC3AjDeeSQdjC7I4P5FCz7z8,1095
36
+ code_loader-1.0.154.dev0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
+ code_loader-1.0.154.dev0.dist-info/RECORD,,