code: def update(self, inputs):
      self.model.train()
      sentences, targets = inputs
      self.optimizer.zero_grad()
      y_hat = self.model.forward(sentences)
      loss = self.model.loss(y_hat, targets)
      loss.backward()
      self.optimizer.step()
  
file_path: stanza/stanza/models/langid/trainer.py
imports: import torch
  import torch.optim
  from stanza.models.langid.model import LangIDBiLSTM
label_desc: Use image node_id 2 for calling the Trainer obj's underlying member method code with example usage: obj.update(inputs) without return types