How to use the nemo.backends.pytorch.nm.LossNM.__init__ function in NEMO

To help you get started, we’ve selected a few NEMO examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NVIDIA / NeMo / collections / nemo_nlp / nemo_nlp / transformer_nm.py View on Github external
def __init__(self, **kwargs):
        LossNM.__init__(self, **kwargs)

        loss_params = {
            "label_smoothing": self.local_parameters.get("label_smoothing", 0),
            "predict_last_k": self.local_parameters.get("predict_last_k", 0)
        }
        self._loss_fn = SmoothedCrossEntropyLoss(**loss_params)
        self._pad_id = self.local_parameters['pad_id']
github NVIDIA / NeMo / nemo / nemo / backends / pytorch / common / losses.py View on Github external
def __init__(self, **kwargs):
        LossNM.__init__(self, **kwargs)
        self._criterion = nn.MSELoss()
github NVIDIA / NeMo / collections / nemo_nlp / nemo_nlp / modules / losses.py View on Github external
def __init__(self, label_smoothing=0.0, **kwargs):
        LossNM.__init__(self, **kwargs)
        self._criterion = SmoothedCrossEntropyLoss(label_smoothing)
github NVIDIA / NeMo / collections / nemo_asr / nemo_asr / losses.py View on Github external
def __init__(self, *, num_classes, **kwargs):
        LossNM.__init__(self, **kwargs)

        # self._blank = self.local_parameters.get('blank', 0)
        self._blank = num_classes
        self._criterion = nn.CTCLoss(blank=self._blank,
                                     reduction='none')
github NVIDIA / NeMo / collections / nemo_nlp / nemo_nlp / modules / losses.py View on Github external
def __init__(self, **kwargs):
        LossNM.__init__(self, **kwargs)

        loss_params = {
            "label_smoothing": self.local_parameters.get("label_smoothing", 0),
            "predict_last_k": self.local_parameters.get("predict_last_k", 0)
        }
        self._loss_fn = SmoothedCrossEntropyLoss(**loss_params)
        self._pad_id = self.local_parameters['pad_id']
github NVIDIA / NeMo / collections / nemo_nlp / nemo_nlp / modules / losses.py View on Github external
def __init__(self, num_classes, **kwargs):
        LossNM.__init__(self, **kwargs)
        self._criterion = nn.CrossEntropyLoss()
        self.num_classes = num_classes
github NVIDIA / NeMo / collections / nemo_nlp / nemo_nlp / bert.py View on Github external
def __init__(self, *, num_inputs, **kwargs):
        kwargs["create_port_args"] = {"num_losses": num_inputs}
        LossNM.__init__(self, **kwargs)
github NVIDIA / NeMo / collections / nemo_nlp / nemo_nlp / modules / losses.py View on Github external
def __init__(self, num_slots, **kwargs):
        LossNM.__init__(self, **kwargs)
        self.num_slots = num_slots
        self._criterion = nn.CrossEntropyLoss()
github NVIDIA / NeMo / examples / image / mnist_lenet5.py View on Github external
def __init__(self, **kwargs):
        # Neural Module API specific
        LossNM.__init__(self, **kwargs)
        # End of Neural Module API specific
        self._criterion = torch.nn.NLLLoss()