code: def trainIters(
      encoder,
      decoder,
      input_lang,
      output_lang,
      input_rows,
      output_rows,
      n_iters,
      print_every=1000,
      plot_every=100,
      learning_rate=0.01,
      loss_breakpoint=0.0001,
      max_length=MAX_LENGTH,
      device=default_device,
  ):
      start = time.time()
      plot_losses = []
      print_loss_total = 0  # Reset every print_every
      plot_loss_total = 0  # Reset every plot_every
  
      encoder_optimizer = optim.SGD(
          encoder.parameters(), lr=learning_rate
      )
      decoder_optimizer = optim.SGD(
          decoder.parameters(), lr=learning_rate
      )
  
      random_index = random.randint(0, len(input_rows))
  
      training_pairs = [
          [
              tensorFromSentence(
                  input_lang, input_rows[random_index], device=device
              ),
              tensorFromSentence(
                  output_lang, output_rows[random_index], device=device
              ),
          ]
          for i in range(n_iters)
      ]
      criterion = nn.NLLLoss()
  
      for iter in range(1, n_iters + 1):
          training_pair = training_pairs[iter - 1]
          input_tensor = training_pair[0]
          target_tensor = training_pair[1]
  
          loss = train(
              input_tensor,
              target_tensor,
              encoder,
              decoder,
              encoder_optimizer,
              decoder_optimizer,
              criterion,
              max_length,
              device=device,
          )
          print_loss_total += loss
          plot_loss_total += loss
  
          print_loss_avg = print_loss_total / print_every
  
          if print_loss_avg < loss_breakpoint:
              log.debug(
                  "%s (%d %d%%) %.4f"
                  % (
                      timeSince(start, iter / n_iters),
                      iter,
                      iter / n_iters * 100,
                      print_loss_avg,
                  )
              )
  
              break
  
          if iter % print_every == 0:
              print_loss_avg = print_loss_total / print_every
              print_loss_total = 0
              log.debug(
                  "%s (%d %d%%) %.4f"
                  % (
                      timeSince(start, iter / n_iters),
                      iter,
                      iter / n_iters * 100,
                      print_loss_avg,
                  )
              )
  
          if iter % plot_every == 0:
              plot_loss_avg = plot_loss_total / plot_every
              plot_losses.append(plot_loss_avg)
              plot_loss_total = 0
  
imports: from __future__ import unicode_literals, print_function, division
  import math
  import time
  from io import open
  import unicodedata
  import string
  import re
  import random
  import operator
  import torch
  import torch.nn
  from torch import optim
  import torch.nn.functional
  from lightwood.helpers.torch import LightwoodAutocast
  from lightwood.helpers.log import log
label_desc: Use image node_id 10 for calling a global function with example usage: trainIters(encoder, decoder, input_lang, output_lang, input_rows, output_rows, n_iters, print_every, plot_every, learning_rate, loss_breakpoint, max_length, device) without return types