code: def main():
      """
      For each of the models specified, load and resave the model
  
      The resaved model will have the optimizer removed
      """
      args = parse_args()
      os.makedirs(args.save_dir, exist_ok=True)
  
      for treebank in args.treebanks:
          logger.info("PROCESSING %s", treebank)
          short_name = treebank_to_short_name(treebank)
          language, dataset = short_name.split("_", maxsplit=1)
          logger.info("%s: %s %s", short_name, language, dataset)
  
          if not args.wordvec_pretrain_file:
              # will throw an error if the pretrain can't be found
              wordvec_pretrain = common.find_wordvec_pretrain(
                  language, default_pretrains
              )
              wordvec_args = [
                  "--wordvec_pretrain_file",
                  wordvec_pretrain,
              ]
          else:
              wordvec_args = []
  
          charlm = common.choose_charlm(
              language, dataset, args.charlm, default_charlms, {}
          )
          charlm_args = common.build_charlm_args(
              language, charlm, base_args=False
          )
  
          base_name = "{}_constituency.pt".format(short_name)
          load_name = os.path.join(args.load_dir, base_name)
          save_name = os.path.join(args.save_dir, base_name)
          resave_args = [
              "--mode",
              "remove_optimizer",
              "--load_name",
              load_name,
              "--save_name",
              save_name,
              "--save_dir",
              ".",
              "--shorthand",
              short_name,
          ]
          resave_args = resave_args + wordvec_args + charlm_args
          constituency_parser.main(resave_args)
  
file_path: stanza/stanza/utils/training/remove_constituency_optimizer.py
imports: import argparse
  import logging
  import os
  from stanza.models import constituency_parser
  from stanza.models.common.constant import treebank_to_short_name
  from stanza.resources.default_packages import default_charlms, default_pretrains
  from stanza.utils.training import common
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types