docstr: Test the whole thing for a few iterations, then restart
  
  This tests that the 5th iteration save file is not rewritten
  and that the iterations continue to 10
  
  TODO: could make it more robust by verifying that only 5 more
  epochs are trained.  Perhaps a "most recent epochs" could be
  saved in the trainer
docstr_tok: ["Test","the","whole","thing","for","a","few","iterations",",","then","restart","This","tests","that","the","5th","iteration","save","file","is","not","rewritten","and","that","the","iterations","continue","to","10","TODO",":","could","make","it","more","robust","by","verifying","that","only","5","more","epochs","are","trained",".","Perhaps","a","``","most","recent","epochs","''","could","be","saved","in","the","trainer"]
code: def test_train_checkpoint(self, wordvec_pretrain_file):
      """
      Test the whole thing for a few iterations, then restart
  
      This tests that the 5th iteration save file is not rewritten
      and that the iterations continue to 10
  
      TODO: could make it more robust by verifying that only 5 more
      epochs are trained.  Perhaps a "most recent epochs" could be
      saved in the trainer
      """
      with tempfile.TemporaryDirectory(
          dir=TEST_WORKING_DIR
      ) as tmpdirname:
          args, _ = self.run_train_test(
              wordvec_pretrain_file, tmpdirname, use_silver=False
          )
          save_5 = args["save_each_name"] % 5
          save_10 = args["save_each_name"] % 10
          assert os.path.exists(save_5)
          assert not os.path.exists(save_10)
  
          save_5_stat = pathlib.Path(save_5).stat()
  
          self.run_train_test(
              wordvec_pretrain_file,
              tmpdirname,
              num_epochs=10,
              use_silver=False,
              exists_ok=True,
          )
          assert os.path.exists(save_5)
          assert os.path.exists(save_10)
  
          assert (
              pathlib.Path(save_5).stat().st_mtime
              == save_5_stat.st_mtime
          )
  
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 12 for calling the TestTrainer obj's underlying member method code with example usage: obj.test_train_checkpoint(wordvec_pretrain_file) without return types