modelzoo.common.pytorch.model_utils.DPOLoss.DPOLoss#

class modelzoo.common.pytorch.model_utils.DPOLoss.DPOLoss[source]#

Bases: torch.nn.Module

DPO Loss :param beta: Temperature parameter for the DPO loss, typically something in the range of 0.1 to 0.5.

We ignore the reference model as beta -> 0.

Parameters

reference_free – If True, we ignore the _provided_ reference model and implicitly use a reference model that assigns equal probability to all responses.

Methods

forward

__call__(*args: Any, **kwargs: Any) Any#

Call self as a function.

__init__(beta=0.1, loss_type='sigmoid', reference_free=False)[source]#
static __new__(cls, *args: Any, **kwargs: Any) Any#