mattertune.finetune.loss
Functions
|
Compute the loss value given the model output, |
|
Classes
|
|
|
|
|
|
|
- class mattertune.finetune.loss.MAELossConfig(*, name='mae', reduction='mean')[source]
- Parameters:
name (Literal['mae'])
reduction (Literal['mean', 'sum'])
- name: Literal['mae']
- reduction: Literal['mean', 'sum']
How to reduce the loss values across the batch.
"mean"
: The mean of the loss values."sum"
: The sum of the loss values.
- class mattertune.finetune.loss.MSELossConfig(*, name='mse', reduction='mean')[source]
- Parameters:
name (Literal['mse'])
reduction (Literal['mean', 'sum'])
- name: Literal['mse']
- reduction: Literal['mean', 'sum']
How to reduce the loss values across the batch.
"mean"
: The mean of the loss values."sum"
: The sum of the loss values.
- class mattertune.finetune.loss.HuberLossConfig(*, name='huber', delta=1.0, reduction='mean')[source]
- Parameters:
name (Literal['huber'])
delta (float)
reduction (Literal['mean', 'sum'])
- name: Literal['huber']
- delta: float
The threshold value for the Huber loss function.
- reduction: Literal['mean', 'sum']
How to reduce the loss values across the batch.
"mean"
: The mean of the loss values."sum"
: The sum of the loss values.
- class mattertune.finetune.loss.L2MAELossConfig(*, name='l2_mae', reduction='mean')[source]
- Parameters:
name (Literal['l2_mae'])
reduction (Literal['mean', 'sum'])
- name: Literal['l2_mae']
- reduction: Literal['mean', 'sum']
How to reduce the loss values across the batch.
"mean"
: The mean of the loss values."sum"
: The sum of the loss values.
- mattertune.finetune.loss.l2_mae_loss(output, target, reduction='mean')[source]
- Parameters:
output (Tensor)
target (Tensor)
reduction (Literal['mean', 'sum', 'none'])
- Return type:
Tensor
- mattertune.finetune.loss.compute_loss(config, prediction, label)[source]
Compute the loss value given the model output,
prediction
, and the target label,label
.The loss value should be a scalar tensor.
- Parameters:
config (LossConfig) – The loss configuration.
prediction (Tensor) – The model output.
label (Tensor) – The target label.
- Returns:
The computed loss value.
- Return type:
Tensor