docstr: Initialize a model trainer.
  
  Args:
      model: The model that you want to train. The model should inherit from flair.nn.Model  # noqa: E501
      corpus: The dataset used to train the model, should be of type Corpus
docstr_tok: ["Initialize","a","model","trainer",".","Args",":","model",":","The","model","that","you","want","to","train",".","The","model","should","inherit","from","flair.nn.Model","#","noqa",":","E501","corpus",":","The","dataset","used","to","train","the","model",",","should","be","of","type","Corpus"]
code: def __init__(self, model: flair.nn.Model, corpus: Corpus) -> None:
      """Initialize a model trainer.
  
      Args:
          model: The model that you want to train. The model should inherit from flair.nn.Model  # noqa: E501
          corpus: The dataset used to train the model, should be of type Corpus
      """
      super().__init__()
      self.model: flair.nn.Model = model
      self.corpus: Corpus = corpus
  
      self.reset_training_attributes()
      self.return_values: dict = {}
  
imports: import contextlib
  import inspect
  import logging
  import os
  import random
  import time
  import warnings
  from inspect import signature
  from pathlib import Path
  from typing import List, Optional, Tuple, Type, Union
  import torch
  from torch.optim.sgd import SGD
  from torch.utils.data.dataset import ConcatDataset
  import flair
  import flair.nn
  from flair.data import Corpus, Dictionary, _len_dataset
  from flair.datasets import DataLoader
  from flair.samplers import FlairSampler
  from flair.trainers.plugins import AnnealingPlugin, CheckpointPlugin, LinearSchedulerPlugin, LogFilePlugin, LossFilePlugin, MetricName, MetricRecord, Pluggable, ReduceTransformerVocabPlugin, TrainerPlugin, TrainingInterrupt, WeightExtractorPlugin
  from flair.training_utils import identify_dynamic_embeddings, log_line, store_embeddings
label_desc: Use image node_id 1 to create a new ModelTrainer object from inherited base classes: Pluggable with example: obj = ModelTrainer(model, corpus)