code: def __init__(
      self,
      args=None,
      vocab=None,
      lexicon=None,
      dictionary=None,
      model_file=None,
      device=None,
  ):
      if model_file is not None:
          # load everything from file
          self.load(model_file)
      else:
          # build model from scratch
          self.args = args
          self.vocab = vocab
          self.lexicon = lexicon
          self.dictionary = dictionary
          self.model = Tokenizer(
              self.args,
              self.args["vocab_size"],
              self.args["emb_dim"],
              self.args["hidden_dim"],
              dropout=self.args["dropout"],
              feat_dropout=self.args["feat_dropout"],
          )
      self.model = self.model.to(device)
      self.criterion = nn.CrossEntropyLoss(ignore_index=-1).to(device)
      self.optimizer = utils.get_optimizer(
          "adam",
          self.model,
          lr=self.args["lr0"],
          betas=(0.9, 0.9),
          weight_decay=self.args["weight_decay"],
      )
      self.feat_funcs = self.args.get("feat_funcs", None)
      self.lang = self.args["lang"]
  
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 1 to create a new Trainer object from inherited base classes: BaseTrainer with example: obj = Trainer(args, vocab, lexicon, dictionary, model_file, device)