code: def __init__(self, config, load_model=False, device=None):
      self.model_path = config["model_path"]
      self.batch_size = config.get(
          "batch_size", Trainer.DEFAULT_BATCH_SIZE
      )
      if load_model:
          self.load(config["load_name"], device)
      else:
          self.model = LangIDBiLSTM(
              config["char_to_idx"],
              config["tag_to_idx"],
              Trainer.DEFAULT_LAYERS,
              Trainer.DEFAULT_EMBEDDING_DIM,
              Trainer.DEFAULT_HIDDEN_DIM,
              batch_size=self.batch_size,
              weights=config["lang_weights"],
          ).to(device)
      self.optimizer = optim.AdamW(self.model.parameters())
  
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 1 to create a new Trainer object  with example: obj = Trainer(config, load_model, device)