docstr: Test that using train files with missing columns works
  
  In this test, we create three separate files, each with a single training entry.
  We then train on an amalgam of those three files with a batch size of 1, saving after each batch.
  This will ensure that only one item is used for each training loop and we can inspect the models which were saved.
  
  Since each of the three files have exactly one column missing
  from the training data, we expect to see the output maps for
  each column stay unchanged in one iteration and change in the
  other two.
docstr_tok: ["Test","that","using","train","files","with","missing","columns","works","In","this","test",",","we","create","three","separate","files",",","each","with","a","single","training","entry",".","We","then","train","on","an","amalgam","of","those","three","files","with","a","batch","size","of","1",",","saving","after","each","batch",".","This","will","ensure","that","only","one","item","is","used","for","each","training","loop","and","we","can","inspect","the","models","which","were","saved",".","Since","each","of","the","three","files","have","exactly","one","column","missing","from","the","training","data",",","we","expect","to","see","the","output","maps","for","each","column","stay","unchanged","in","one","iteration","and","change","in","the","other","two","."]
code: def test_missing_column(self, tmp_path, wordvec_pretrain_file):
      """
      Test that using train files with missing columns works
  
      In this test, we create three separate files, each with a single training entry.
      We then train on an amalgam of those three files with a batch size of 1, saving after each batch.
      This will ensure that only one item is used for each training loop and we can inspect the models which were saved.
  
      Since each of the three files have exactly one column missing
      from the training data, we expect to see the output maps for
      each column stay unchanged in one iteration and change in the
      other two.
      """
      # use SGD because some old versions of pytorch with Adam keep
      # learning a value even if the loss is 0 in subsequent steps
      # (perhaps it had a momentum by default?)
      extra_args = [
          "--save_each",
          "--eval_interval",
          "1",
          "--max_steps",
          "3",
          "--batch_size",
          "1",
          "--optim",
          "sgd",
      ]
      trainer = self.run_training(
          tmp_path,
          wordvec_pretrain_file,
          [TRAIN_DATA_NO_UPOS, TRAIN_DATA_NO_XPOS, TRAIN_DATA_NO_FEATS],
          DEV_DATA,
          extra_args=extra_args,
      )
      save_each_name = tagger.save_each_file_name(trainer.args)
      model_files = [save_each_name % i for i in range(4)]
      assert all(os.path.exists(x) for x in model_files)
      pt = pretrain.Pretrain(wordvec_pretrain_file)
      saved_trainers = [
          Trainer(pretrain=pt, model_file=model_file)
          for model_file in model_files
      ]
  
      upos_unchanged = 0
      xpos_unchanged = 0
      ufeats_unchanged = 0
      for t1, t2 in zip(saved_trainers[:-1], saved_trainers[1:]):
          upos_unchanged += torch.allclose(
              t1.model.upos_clf.weight, t2.model.upos_clf.weight
          )
          xpos_unchanged += torch.allclose(
              t1.model.xpos_clf.W_bilin.weight,
              t2.model.xpos_clf.W_bilin.weight,
          )
          ufeats_unchanged += all(
              torch.allclose(f1.W_bilin.weight, f2.W_bilin.weight)
              for f1, f2 in zip(
                  t1.model.ufeats_clf, t2.model.ufeats_clf
              )
          )
      upos_norms = [
          torch.linalg.norm(t.model.upos_clf.weight)
          for t in saved_trainers
      ]
      assert upos_unchanged == 1, "Unchanged: {} {} {} {}".format(
          upos_unchanged, xpos_unchanged, ufeats_unchanged, upos_norms
      )
      assert xpos_unchanged == 1, "Unchanged: %d %d %d" % (
          upos_unchanged,
          xpos_unchanged,
          ufeats_unchanged,
      )
      assert ufeats_unchanged == 1, "Unchanged: %d %d %d" % (
          upos_unchanged,
          xpos_unchanged,
          ufeats_unchanged,
      )
  
imports: import os
  import pytest
  import torch
  from stanza.models import tagger
  from stanza.models.common import pretrain
  from stanza.models.pos.trainer import Trainer
  from stanza.tests import TEST_WORKING_DIR, TEST_MODELS_DIR
  from stanza.utils.training.common import choose_pos_charlm, build_charlm_args
label_desc: Use image node_id 11 for calling the TestTagger obj's underlying member method code with example usage: obj.test_missing_column(tmp_path, wordvec_pretrain_file) without return types