espnet2.hubert.hubert_loss.HubertPretrainLoss
Less than 1 minute
espnet2.hubert.hubert_loss.HubertPretrainLoss
class espnet2.hubert.hubert_loss.HubertPretrainLoss(pred_masked_weight: float = 1.0, pred_nomask_weight: float = 0.0, loss_weights: float = 10.0)
Bases: Module
Hubert criterion module.
- Parameters:
- pred_masked_weight – weight for predictive loss for masked frames
- pred_nomask_weight – weight for predictive loss for unmasked frames
- loss_weights – weights for additional loss terms (not first one)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
forward(model, enc_outputs, reduce=True)
Defines the computation performed at every call.
Should be overridden by all subclasses.
NOTE
Although the recipe for forward pass needs to be defined within this function, one should call the Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.