System Metrics

The prov4ml.log_system_metrics function logs critical system performance metrics during machine learning experiments. The information logged is related to the time between the last call to the function and the current call.

prov4ml.log_system_metrics(
    context: Context,
    step: Optional[int] = None,
)
ParameterTypeDescription
contextprov4ml.ContextRequired. Context of the metric
stepintOptional. Step of the metric
synchronousboolOptional. Whether to log the metric synchronously
timestampintOptional. Timestamp of the metric

This function logs the following system metrics:

ParameterDescriptionUnit
Memory usageMemory usage of the system%
Disk usageDisk usage of the system%
Gpu memory usageMemory usage of the GPU%
Gpu usageUsage of the GPU%

FLOPs per Epoch

The log_flops_per_epoch function logs the number of floating-point operations (FLOPs) performed per epoch for a given model and dataset.

prov4ml.log_flops_per_epoch(
    label: str, 
    model: Union[torch.nn.Module, Any],
    dataset: Union[torch.utils.data.Dataset, torch.utils.data.DataLoader, torch.utils.data.Subset], 
    context: Context, 
    step: Optional[int] = None
):
ParameterTypeDescription
labelstringRequired. Label of the FLOPs
modelUnion[torch.nn.Module, Any]Required. Model used for the FLOPs calculation
datasetstringRequired. Dataset used for the FLOPs calculation
contextprov4ml.ContextRequired. Context of the metric
stepintOptional. Step of the metric

FLOPs per Batch

The log_flops_per_batch function logs the number of floating-point operations (FLOPs) performed per batch for a given model and batch of data.

prov4ml.log_flops_per_batch(
    label: str, 
    model: Union[torch.nn.Module, Any],
    batch: Any, 
    context: Context, 
    step: Optional[int] = None, 
):
ParameterTypeDescription
labelstringRequired. Label of the FLOPs
modelUnion[torch.nn.Module, Any]Required. Model used for the FLOPs calculation
batchAnyRequired. Batch of data used for the FLOPs calculation
contextprov4ml.ContextRequired. Context of the metric
stepintOptional. Step of the metric

Home | Prev | Next