ecal.calculators.training¶
Classes
|
This class is used to estimate the flops of the model training, which is then used to estimate the energy consumption of the model training. |
- class ecal.calculators.training.Training(model_name, batch_size, num_epochs, num_samples, processor_flops_per_second, processor_max_power, input_size, evaluation_strategy, k_folds, split_ratio, calculator=None)[source]¶
Bases:
objectThis class is used to estimate the flops of the model training, which is then used to estimate the energy consumption of the model training.
- Parameters:
- __init__(model_name, batch_size, num_epochs, num_samples, processor_flops_per_second, processor_max_power, input_size, evaluation_strategy, k_folds, split_ratio, calculator=None)[source]¶
Initialize Training class with optional custom FLOP calculator
- Parameters:
calculator (FLOPCalculator | None) – Optional custom FLOPCalculator implementation
input_size (Tuple) – Tuple of input size
batch_size (int) – int of batch size
num_epochs (int) – int of number of epochs
num_samples (int) – int of number of samples
processor_flops_per_second (float) – float of processor flops per second
processor_max_power (int) – int of processor max power in watts
evaluation_strategy (str) – str of evaluation strategy
k_folds (int) – int of number of folds for cross-validation
split_ratio (float) – float of split ratio for train-test split
model_name (str)
- calculate_flops_evaluation()[source]¶
Calculate total FLOPs required for evaluation
Scales a single forward pass’s FLOPs by the number of samples held out for evaluation, based on the configured evaluation strategy (train/test split or k-fold cross-validation).
- Returns:
Total evaluation FLOPs
- Return type:
- calculate_flops_training()[source]¶
Calculate total FLOPs required for training
Approximates one training pass (forward + backward + weight update) as three times the forward-pass FLOPs, then scales by the number of training samples (per the configured evaluation strategy) and the number of epochs.
- Returns:
Total training FLOPs across all epochs
- Return type: