code: def run_multistage_tests(
      self,
      wordvec_pretrain_file,
      tmpdirname,
      use_lattn,
      extra_args=None,
  ):
      train_treebank_file, eval_treebank_file = self.write_treebanks(
          tmpdirname
      )
      args = ["--multistage", "--pattn_num_layers", "1"]
      if use_lattn:
          args += ["--lattn_d_proj", "16"]
      if extra_args:
          args += extra_args
      args, _ = self.run_train_test(
          wordvec_pretrain_file,
          tmpdirname,
          num_epochs=8,
          extra_args=args,
      )
      each_name = os.path.join(args["save_dir"], "each_%02d.pt")
  
      word_input_sizes = defaultdict(list)
      for i in range(1, 9):
          model_name = each_name % i
          assert os.path.exists(model_name)
          tr = trainer.Trainer.load(model_name, load_optimizer=True)
          assert tr.epochs_trained == i
          word_input_sizes[tr.model.word_input_size].append(i)
      if use_lattn:
          # there should be three stages: no attn, pattn, pattn+lattn
          assert len(word_input_sizes) == 3
          word_input_keys = sorted(word_input_sizes.keys())
          assert word_input_sizes[word_input_keys[0]] == [1, 2, 3]
          assert word_input_sizes[word_input_keys[1]] == [4, 5]
          assert word_input_sizes[word_input_keys[2]] == [6, 7, 8]
      else:
          # with no lattn, there are two stages: no attn, pattn
          assert len(word_input_sizes) == 2
          word_input_keys = sorted(word_input_sizes.keys())
          assert word_input_sizes[word_input_keys[0]] == [1, 2, 3]
          assert word_input_sizes[word_input_keys[1]] == [4, 5, 6, 7, 8]
  
imports: from collections import defaultdict
  import logging
  import pathlib
  import tempfile
  import pytest
  import torch
  from torch import optim
  from stanza import Pipeline
  from stanza.models import constituency_parser
  from stanza.models.common import pretrain
  from stanza.models.common.bert_embedding import load_bert, load_tokenizer
  from stanza.models.common.foundation_cache import FoundationCache
  from stanza.models.common.utils import set_random_seed
  from stanza.models.constituency import lstm_model
  from stanza.models.constituency import trainer
  from stanza.models.constituency import tree_reader
  from stanza.tests import *
label_desc: Use image node_id 13 for calling the TestTrainer obj's underlying member method code with example usage: obj.run_multistage_tests(wordvec_pretrain_file, tmpdirname, use_lattn, extra_args) without return types