docstr: Run the training for a few iterations, load & return the model
docstr_tok: ["Run","the","training","for","a","few","iterations",",","load","&","return","the","model"]
code: def run_training(
      self,
      tmp_path,
      wordvec_pretrain_file,
      train_text,
      dev_text,
      augment_nopunct=False,
      extra_args=None,
  ):
      """
      Run the training for a few iterations, load & return the model
      """
      train_file = str(tmp_path / "train.conllu")
      dev_file = str(tmp_path / "dev.conllu")
      pred_file = str(tmp_path / "pred.conllu")
  
      save_name = "test_parser.pt"
      save_file = str(tmp_path / save_name)
  
      with open(train_file, "w", encoding="utf-8") as fout:
          fout.write(train_text)
  
      with open(dev_file, "w", encoding="utf-8") as fout:
          fout.write(dev_text)
  
      args = [
          "--wordvec_pretrain_file",
          wordvec_pretrain_file,
          "--train_file",
          train_file,
          "--eval_file",
          dev_file,
          "--gold_file",
          dev_file,
          "--output_file",
          pred_file,
          "--log_step",
          "10",
          "--eval_interval",
          "20",
          "--max_steps",
          "100",
          "--shorthand",
          "en_test",
          "--save_dir",
          str(tmp_path),
          "--save_name",
          save_name,
          "--lang",
          "en",
      ]
      if not augment_nopunct:
          args.extend(["--augment_nopunct", "0.0"])
      if extra_args is not None:
          args = args + extra_args
      parser.main(args)
  
      assert os.path.exists(save_file)
      pt = pretrain.Pretrain(wordvec_pretrain_file)
      saved_model = Trainer(pretrain=pt, model_file=save_file)
      return saved_model
  
file_path: stanza/stanza/tests/depparse/test_parser.py
imports: import os
  import pytest
  from stanza.models import parser
  from stanza.models.common import pretrain
  from stanza.models.depparse.trainer import Trainer
  from stanza.tests import TEST_WORKING_DIR
label_desc: Use image node_id 2 for calling the TestParser obj's underlying member method code with example usage: obj.run_training(tmp_path, wordvec_pretrain_file, train_text, dev_text, augment_nopunct, extra_args) and returns: saved_model