docstr: Check that the parameters the bert model DO change over a single training step
docstr_tok: ["Check","that","the","parameters","the","bert","model","DO","change","over","a","single","training","step"]
code: def test_bert_finetune_one_epoch(self, wordvec_pretrain_file):
      """
      Check that the parameters the bert model DO change over a single training step
      """
      with tempfile.TemporaryDirectory(
          dir=TEST_WORKING_DIR
      ) as tmpdirname:
          transformer_name = "hf-internal-testing/tiny-bert"
          args = [
              "--bert_model",
              transformer_name,
              "--bert_finetune",
              "--optim",
              "adadelta",
          ]
          args, trained_model = self.run_train_test(
              wordvec_pretrain_file,
              tmpdirname,
              num_epochs=1,
              extra_args=args,
          )
  
          # check that the weights are different
          foundation_cache = FoundationCache()
          bert_model, bert_tokenizer = foundation_cache.load_bert(
              transformer_name
          )
          assert not self.bert_weights_allclose(
              bert_model, trained_model
          )
  
          # double check that a new bert is created instead of using the FoundationCache when the bert has been trained
          model_name = args["save_name"]
          assert os.path.exists(model_name)
          no_finetune_args = self.training_args(
              wordvec_pretrain_file,
              tmpdirname,
              None,
              None,
              "--no_bert_finetune",
              "--no_stage1_bert_finetune",
              "--bert_model",
              transformer_name,
          )
          tr = trainer.Trainer.load(
              model_name,
              args=no_finetune_args,
              foundation_cache=foundation_cache,
          )
          assert tr.model.bert_model is not bert_model
          assert not self.bert_weights_allclose(bert_model, tr)
          assert self.bert_weights_allclose(
              trained_model.model.bert_model, tr
          )
  
          new_save_name = os.path.join(
              tmpdirname, "test_resave_bert.pt"
          )
          assert not os.path.exists(new_save_name)
          tr.save(new_save_name, save_optimizer=False)
          tr2 = trainer.Trainer.load(
              new_save_name,
              args=no_finetune_args,
              foundation_cache=foundation_cache,
          )
          # check that the resaved model included its finetuned bert weights
          assert tr2.model.bert_model is not bert_model
          # the finetuned bert weights should also be scheduled for saving the next time as well
          assert not tr2.model.is_unsaved_module("bert_model")
  
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 24 for calling the TestTrainer obj's underlying member method code with example usage: obj.test_bert_finetune_one_epoch(wordvec_pretrain_file) without return types