class_docstr: Stores a constituency model and its optimizer
class_docstr_tok: ["Stores","a","constituency","model","and","its","optimizer"]
code: def __init__(
      self,
      model,
      optimizer=None,
      epochs_trained=0,
      global_step=0,
      best_score=None,
  ):
      self.model = model
      self.optimizer = optimizer
      # we keep track of position in the learning so that we can
      # checkpoint & restart if needed without restarting the epoch count
      self.epochs_trained = epochs_trained
      self.global_step = global_step
      # save the best dev score so that when reloading a checkpoint
      # of a model, we know how far we got
      self.best_score = best_score
  
file_path: stanza/stanza/models/classifiers/trainer.py
imports: import logging
  import os
  import torch
  import torch.optim
  import stanza.models.classifiers.data
  import stanza.models.classifiers.cnn_classifier
  import stanza.models.classifiers.constituency_classifier
  from stanza.models.classifiers.utils import ModelType
  from stanza.models.common.foundation_cache import load_bert, load_charlm, load_pretrain
  from stanza.models.common.pretrain import Pretrain
  from stanza.models.constituency.tree_embedding import TreeEmbedding
label_desc: Use image node_id 1 to create a new Trainer object  with example: obj = Trainer(model, optimizer, epochs_trained, global_step, best_score)