code-loader 1.0.151a1__tar.gz → 1.0.151.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.
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/PKG-INFO +1 -1
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/contract/datasetclasses.py +0 -1
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/inner_leap_binder/leapbinder.py +12 -17
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/inner_leap_binder/leapbinder_decorators.py +2 -3
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/leaploader.py +5 -2
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/leaploaderbase.py +7 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/pyproject.toml +1 -1
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/LICENSE +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/README.md +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/__init__.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/contract/__init__.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/contract/enums.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/contract/exceptions.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/contract/mapping.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/contract/responsedataclasses.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/contract/visualizer_classes.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/default_losses.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/default_metrics.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/__init__.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/api.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/cli_config_utils.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/client.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/epoch.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/experiment.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/experiment_context.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/types.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/utils.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/workingspace_config_utils.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/inner_leap_binder/__init__.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/mixpanel_tracker.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/plot_functions/__init__.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/plot_functions/plot_functions.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/plot_functions/visualize.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/utils.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/visualizers/__init__.py +0 -0
- {code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/visualizers/default_visualizers.py +0 -0
{code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/inner_leap_binder/leapbinder.py
RENAMED
|
@@ -24,6 +24,7 @@ from code_loader.visualizers.default_visualizers import DefaultVisualizer, \
|
|
|
24
24
|
default_image_visualizer, default_horizontal_bar_visualizer, default_word_visualizer, \
|
|
25
25
|
default_image_mask_visualizer, default_text_mask_visualizer, default_raw_data_visualizer, default_video_visualizer
|
|
26
26
|
|
|
27
|
+
|
|
27
28
|
mapping_runtime_mode_env_var_mame = '__MAPPING_RUNTIME_MODE__'
|
|
28
29
|
|
|
29
30
|
|
|
@@ -238,6 +239,7 @@ class LeapBinder:
|
|
|
238
239
|
|
|
239
240
|
self._encoder_names.append(name)
|
|
240
241
|
|
|
242
|
+
|
|
241
243
|
def set_instance_masks(self, function: InstanceCallableInterface, name: str) -> None:
|
|
242
244
|
"""
|
|
243
245
|
Set the instance mask handler function.
|
|
@@ -252,6 +254,7 @@ class LeapBinder:
|
|
|
252
254
|
function = to_numpy_return_masks_wrapper(function)
|
|
253
255
|
self.setup_container.instance_masks.append(ElementInstanceMasksHandler(name, function))
|
|
254
256
|
|
|
257
|
+
|
|
255
258
|
def add_custom_loss(self, function: CustomCallableInterface, name: str) -> None:
|
|
256
259
|
"""
|
|
257
260
|
Add a custom loss function to the setup.
|
|
@@ -328,8 +331,7 @@ class LeapBinder:
|
|
|
328
331
|
metric_handler_data = MetricHandlerData(name, regular_arg_names, direction, compute_insights)
|
|
329
332
|
self.setup_container.metrics.append(MetricHandler(metric_handler_data, function))
|
|
330
333
|
|
|
331
|
-
def add_prediction(self, name: str, labels: List[str], channel_dim: int = -1,
|
|
332
|
-
prediction_index: Optional[int] = None) -> None:
|
|
334
|
+
def add_prediction(self, name: str, labels: List[str], channel_dim: int = -1, prediction_index: Optional[int]=None) -> None:
|
|
333
335
|
"""
|
|
334
336
|
Add prediction labels to the setup.
|
|
335
337
|
|
|
@@ -346,8 +348,7 @@ class LeapBinder:
|
|
|
346
348
|
self.setup_container.prediction_types.append(PredictionTypeHandler(name, labels, channel_dim))
|
|
347
349
|
if prediction_index is not None:
|
|
348
350
|
node_connection = NodeConnection(NodeMapping(name, NodeMappingType.PredictionLabels),
|
|
349
|
-
{'temp': NodeMapping('',
|
|
350
|
-
NodeMappingType(f'Prediction{prediction_index}'))})
|
|
351
|
+
{'temp': NodeMapping('', NodeMappingType(f'Prediction{prediction_index}'))})
|
|
351
352
|
|
|
352
353
|
self.mapping_connections.append(node_connection)
|
|
353
354
|
|
|
@@ -383,8 +384,7 @@ class LeapBinder:
|
|
|
383
384
|
self._encoder_names.append(name)
|
|
384
385
|
|
|
385
386
|
def set_metadata(self, function: MetadataSectionCallableInterface, name: str,
|
|
386
|
-
metadata_type: Optional[Union[DatasetMetadataType, Dict[str, DatasetMetadataType]]] = None
|
|
387
|
-
use_for_semantic_ls: Optional[bool] = None) -> None:
|
|
387
|
+
metadata_type: Optional[Union[DatasetMetadataType, Dict[str, DatasetMetadataType]]] = None) -> None:
|
|
388
388
|
"""
|
|
389
389
|
Set the metadata handler function. This function is used for measuring and analyzing external variable values per sample, which is recommended for analysis within the Tensorleap platform.
|
|
390
390
|
|
|
@@ -419,7 +419,7 @@ class LeapBinder:
|
|
|
419
419
|
leap_binder.set_metadata(metadata_handler_index, name='metadata_index')
|
|
420
420
|
leap_binder.set_metadata(metadata_handler_image_mean, name='metadata_image_mean')
|
|
421
421
|
"""
|
|
422
|
-
self.setup_container.metadata.append(MetadataHandler(name, function, metadata_type
|
|
422
|
+
self.setup_container.metadata.append(MetadataHandler(name, function, metadata_type))
|
|
423
423
|
|
|
424
424
|
def set_custom_latent_space(self, function: SectionCallableInterface) -> None:
|
|
425
425
|
"""
|
|
@@ -534,8 +534,7 @@ class LeapBinder:
|
|
|
534
534
|
@staticmethod
|
|
535
535
|
def check_handler(
|
|
536
536
|
preprocess_response: PreprocessResponse, test_result: List[DatasetTestResultPayload],
|
|
537
|
-
dataset_base_handler: Union[DatasetBaseHandler, MetadataHandler], state: DataStateEnum) -> List[
|
|
538
|
-
DatasetTestResultPayload]:
|
|
537
|
+
dataset_base_handler: Union[DatasetBaseHandler, MetadataHandler], state: DataStateEnum) -> List[DatasetTestResultPayload]:
|
|
539
538
|
assert preprocess_response.sample_ids is not None
|
|
540
539
|
raw_result = dataset_base_handler.function(preprocess_response.sample_ids[0], preprocess_response)
|
|
541
540
|
handler_type = 'metadata' if isinstance(dataset_base_handler, MetadataHandler) else None
|
|
@@ -555,8 +554,7 @@ class LeapBinder:
|
|
|
555
554
|
|
|
556
555
|
metadata_type = None
|
|
557
556
|
if single_metadata_result is None:
|
|
558
|
-
if state != DataStateEnum.training and test_result[
|
|
559
|
-
i].name == f'{dataset_base_handler.name}_{single_metadata_name}':
|
|
557
|
+
if state != DataStateEnum.training and test_result[i].name == f'{dataset_base_handler.name}_{single_metadata_name}':
|
|
560
558
|
metadata_test_result_payloads[i] = test_result[i]
|
|
561
559
|
continue
|
|
562
560
|
|
|
@@ -564,8 +562,7 @@ class LeapBinder:
|
|
|
564
562
|
raise Exception(f"Metadata {single_metadata_name} is None and no metadata type is provided")
|
|
565
563
|
elif isinstance(dataset_base_handler.metadata_type, dict):
|
|
566
564
|
if single_metadata_name not in dataset_base_handler.metadata_type:
|
|
567
|
-
raise Exception(
|
|
568
|
-
f"Metadata {single_metadata_name} is None and no metadata type is provided")
|
|
565
|
+
raise Exception(f"Metadata {single_metadata_name} is None and no metadata type is provided")
|
|
569
566
|
metadata_type = dataset_base_handler.metadata_type[single_metadata_name]
|
|
570
567
|
else:
|
|
571
568
|
raise Exception(f"Metadata {single_metadata_name} is None and metadata type is not a dict")
|
|
@@ -582,11 +579,9 @@ class LeapBinder:
|
|
|
582
579
|
return test_result
|
|
583
580
|
|
|
584
581
|
if dataset_base_handler.metadata_type is None:
|
|
585
|
-
raise Exception(
|
|
586
|
-
f"Metadata {dataset_base_handler.name} is None and no metadata type is provided")
|
|
582
|
+
raise Exception(f"Metadata {dataset_base_handler.name} is None and no metadata type is provided")
|
|
587
583
|
elif isinstance(dataset_base_handler.metadata_type, dict):
|
|
588
|
-
raise Exception(
|
|
589
|
-
f"Metadata {dataset_base_handler.name} is None and no metadata type is provided")
|
|
584
|
+
raise Exception(f"Metadata {dataset_base_handler.name} is None and no metadata type is provided")
|
|
590
585
|
metadata_type = dataset_base_handler.metadata_type
|
|
591
586
|
|
|
592
587
|
result_shape = get_shape(raw_result)
|
|
@@ -799,8 +799,7 @@ def tensorleap_custom_visualizer(name: str, visualizer_type: LeapDataType,
|
|
|
799
799
|
|
|
800
800
|
|
|
801
801
|
def tensorleap_metadata(
|
|
802
|
-
name: str, metadata_type: Optional[Union[DatasetMetadataType, Dict[str, DatasetMetadataType]]] = None
|
|
803
|
-
use_for_semantic_ls: Optional[bool] = None):
|
|
802
|
+
name: str, metadata_type: Optional[Union[DatasetMetadataType, Dict[str, DatasetMetadataType]]] = None):
|
|
804
803
|
def decorating_function(user_function: MetadataSectionCallableInterface):
|
|
805
804
|
for metadata_handler in leap_binder.setup_container.metadata:
|
|
806
805
|
if metadata_handler.name == name:
|
|
@@ -842,7 +841,7 @@ def tensorleap_metadata(
|
|
|
842
841
|
|
|
843
842
|
return result
|
|
844
843
|
|
|
845
|
-
leap_binder.set_metadata(inner_without_validate, name, metadata_type
|
|
844
|
+
leap_binder.set_metadata(inner_without_validate, name, metadata_type)
|
|
846
845
|
|
|
847
846
|
def inner(*args, **kwargs):
|
|
848
847
|
if os.environ.get(mapping_runtime_mode_env_var_mame):
|
|
@@ -163,7 +163,7 @@ class LeapLoader(LeapLoaderBase):
|
|
|
163
163
|
if state == DataStateEnum.unlabeled and sample_id not in preprocess_result[state].sample_ids:
|
|
164
164
|
self._preprocess_result(update_unlabeled_preprocess=True)
|
|
165
165
|
|
|
166
|
-
metadata, metadata_is_none = self.
|
|
166
|
+
metadata, metadata_is_none = self.get_metadata(state, sample_id)
|
|
167
167
|
|
|
168
168
|
custom_latent_space = None
|
|
169
169
|
if global_leap_binder.setup_container.custom_latent_space is not None:
|
|
@@ -521,13 +521,16 @@ class LeapLoader(LeapLoaderBase):
|
|
|
521
521
|
|
|
522
522
|
return converted_value, is_none
|
|
523
523
|
|
|
524
|
-
def
|
|
524
|
+
def get_metadata(self, state: DataStateEnum, sample_id: Union[int, str], only_handler_names: Optional[List[str]] = None) -> Tuple[
|
|
525
525
|
Dict[str, Union[str, int, bool, float]], Dict[str, bool]]:
|
|
526
526
|
result_agg = {}
|
|
527
527
|
is_none = {}
|
|
528
528
|
preprocess_result = self._preprocess_result()
|
|
529
529
|
preprocess_state = preprocess_result[state]
|
|
530
530
|
for handler in global_leap_binder.setup_container.metadata:
|
|
531
|
+
if only_handler_names:
|
|
532
|
+
if handler.name not in only_handler_names:
|
|
533
|
+
continue
|
|
531
534
|
handler_result = handler.function(sample_id, preprocess_state)
|
|
532
535
|
if isinstance(handler_result, dict):
|
|
533
536
|
for single_metadata_name, single_metadata_result in handler_result.items():
|
|
@@ -87,6 +87,13 @@ class LeapLoaderBase:
|
|
|
87
87
|
input_tensors_by_arg_name: Dict[str, npt.NDArray[np.float32]]):
|
|
88
88
|
pass
|
|
89
89
|
|
|
90
|
+
@abstractmethod
|
|
91
|
+
def get_metadata(
|
|
92
|
+
self, state: DataStateEnum, sample_id: Union[int, str],
|
|
93
|
+
only_handler_names: Optional[List[str]] = None
|
|
94
|
+
) -> Tuple[Dict[str, Union[str, int, bool, float]], Dict[str, bool]]:
|
|
95
|
+
pass
|
|
96
|
+
|
|
90
97
|
@abstractmethod
|
|
91
98
|
def run_heatmap_visualizer(self, visualizer_name: str, sample_ids: np.array, state: DataStateEnum,
|
|
92
99
|
input_tensors_by_arg_name: Dict[str, npt.NDArray[np.float32]]
|
|
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.151a1 → code_loader-1.0.151.dev1}/code_loader/contract/responsedataclasses.py
RENAMED
|
File without changes
|
{code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/contract/visualizer_classes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.151a1 → code_loader-1.0.151.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.151a1 → code_loader-1.0.151.dev1}/code_loader/experiment_api/experiment_context.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.151a1 → code_loader-1.0.151.dev1}/code_loader/inner_leap_binder/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_loader-1.0.151a1 → code_loader-1.0.151.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.151a1 → code_loader-1.0.151.dev1}/code_loader/visualizers/default_visualizers.py
RENAMED
|
File without changes
|