code: def run_treebank(
      mode,
      paths,
      treebank,
      short_name,
      temp_output_file,
      command_args,
      extra_args,
  ):
      short_language, dataset = short_name.split("_", 1)
  
      pos_dir = paths["POS_DATA_DIR"]
      train_file = f"{pos_dir}/{short_name}.train.in.conllu"
      if short_name == "vi_vlsp22":
          train_file += f";{pos_dir}/vi_vtb.train.in.conllu"
      dev_in_file = f"{pos_dir}/{short_name}.dev.in.conllu"
      dev_pred_file = (
          temp_output_file
          if temp_output_file
          else f"{pos_dir}/{short_name}.dev.pred.conllu"
      )
      test_in_file = f"{pos_dir}/{short_name}.test.in.conllu"
      test_pred_file = (
          temp_output_file
          if temp_output_file
          else f"{pos_dir}/{short_name}.test.pred.conllu"
      )
  
      charlm_args = build_pos_charlm_args(
          short_language, dataset, command_args.charlm
      )
      bert_args = common.choose_transformer(
          short_language, command_args, extra_args
      )
  
      eval_file = None
      if "--eval_file" in extra_args:
          eval_file = extra_args[extra_args.index("--eval_file") + 1]
  
      if mode == Mode.TRAIN:
          for train_piece in train_file.split(";"):
              if not os.path.exists(train_piece):
                  logger.error(
                      "TRAIN FILE NOT FOUND: %s ... skipping"
                      % train_piece
                  )
                  return
  
          train_args = [
              "--wordvec_dir",
              paths["WORDVEC_DIR"],
              "--train_file",
              train_file,
              "--output_file",
              dev_pred_file,
              "--lang",
              short_language,
              "--shorthand",
              short_name,
              "--mode",
              "train",
          ]
          if eval_file is None:
              train_args += ["--eval_file", dev_in_file]
          train_args = (
              train_args
              + wordvec_args(short_language, dataset, extra_args)
              + charlm_args
              + bert_args
          )
          train_args = train_args + extra_args
          logger.info(
              "Running train POS for {} with args {}".format(
                  treebank, train_args
              )
          )
          tagger.main(train_args)
  
      if mode == Mode.SCORE_DEV or mode == Mode.TRAIN:
          dev_args = [
              "--wordvec_dir",
              paths["WORDVEC_DIR"],
              "--output_file",
              dev_pred_file,
              "--lang",
              short_language,
              "--shorthand",
              short_name,
              "--mode",
              "predict",
          ]
          if eval_file is None:
              dev_args += ["--eval_file", dev_in_file]
          dev_args = (
              dev_args
              + wordvec_args(short_language, dataset, extra_args)
              + charlm_args
              + bert_args
          )
          dev_args = dev_args + extra_args
          logger.info(
              "Running dev POS for {} with args {}".format(
                  treebank, dev_args
              )
          )
          tagger.main(dev_args)
  
          results = common.run_eval_script_pos(
              eval_file if eval_file else dev_in_file, dev_pred_file
          )
          logger.info(
              "Finished running dev set on\n{}\n{}".format(
                  treebank, results
              )
          )
  
      if mode == Mode.SCORE_TEST:
          test_args = [
              "--wordvec_dir",
              paths["WORDVEC_DIR"],
              "--output_file",
              test_pred_file,
              "--lang",
              short_language,
              "--shorthand",
              short_name,
              "--mode",
              "predict",
          ]
          if eval_file is None:
              test_args += ["--eval_file", test_in_file]
          test_args = (
              test_args
              + wordvec_args(short_language, dataset, extra_args)
              + charlm_args
              + bert_args
          )
          test_args = test_args + extra_args
          logger.info(
              "Running test POS for {} with args {}".format(
                  treebank, test_args
              )
          )
          tagger.main(test_args)
  
          results = common.run_eval_script_pos(
              eval_file if eval_file else test_in_file, test_pred_file
          )
          logger.info(
              "Finished running test set on\n{}\n{}".format(
                  treebank, results
              )
          )
  
file_path: stanza/stanza/utils/training/run_pos.py
imports: import logging
  import os
  from stanza.models import tagger
  from stanza.resources.default_packages import no_pretrain_languages, pos_pretrains, default_pretrains
  from stanza.utils.training import common
  from stanza.utils.training.common import Mode, add_charlm_args, build_pos_charlm_args, choose_pos_charlm, find_wordvec_pretrain
label_desc: Use image node_id 4 for calling a global function with example usage: run_treebank(mode, paths, treebank, short_name, temp_output_file, command_args, extra_args) without return types