Metadata Function
For each sample, Tensorleap allows extra data to be added for future analysis. Each defined data is wrapped in a metadata function.
from code_loader.contract.datasetclasses import PreprocessResponse
from code_loader.inner_leap_binder.leapbinder_decorators import tensorleap_custom_loss
import numpy as np
...
@tensorleap_metadata(name='metadata_label_description', metadata_type={"label":DatasetMetadataType.int, "is_circle": DatasetMetadataType.bool})
def metadata_label(idx: int, preprocess: PreprocessResponse) -> Dict[str,Union[int, bool]:
return return {
'label': int_metadata_creator(preprocess, idx),
'is_circle': bool_metadata_creator(preprocess, idx),
}
The @tensorleap_metadata decorator registers each metadata function into the Tensorleap integration.
You can add additional custom metadata that will later be available for each sample to help with analysis. This function is called for each evaluated sample.
These functions should return:
an int/bool/float/str properties per sample
A dictionary with multiple attributes that maps str keys to int/bool/float/str properties
When using the dictionary syntax, the supplied dictionary must be flat (i.e. a mapping of a str to bool/float/str/int). None flat dictionaries will result in integration errors.
Usage within the full script can be found at the Integration Script.
Guides
Full examples can be found at the Dataset Integration section of the following guides:
Last updated
Was this helpful?