code: def update(self, inputs):
      self.model.train()
      units, labels, features, _ = inputs
  
      device = next(self.model.parameters()).device
      units = units.to(device)
      labels = labels.to(device)
      features = features.to(device)
  
      pred = self.model(units, features)
  
      self.optimizer.zero_grad()
      classes = pred.size(2)
      loss = self.criterion(pred.view(-1, classes), labels.view(-1))
  
      loss.backward()
      nn.utils.clip_grad_norm_(
          self.model.parameters(), self.args["max_grad_norm"]
      )
      self.optimizer.step()
  
      return loss.item()
  
file_path: stanza/stanza/models/tokenization/trainer.py
imports: import sys
  import logging
  import torch
  import torch.nn
  import torch.optim
  from stanza.models.common import utils
  from stanza.models.common.trainer import Trainer
  from stanza.models.tokenization.utils import create_dictionary
  from .model import Tokenizer
  from .vocab import Vocab
label_desc: Use image node_id 2 for calling the Trainer obj's underlying member method code with example usage: obj.update(inputs) and returns: loss