code: def main():
      config, args = get_config()
      # exit()
      # init logger, create log dir and set log level, etc.
      if args.resume and args.test:
          raise Exception(
              "cannot use flag --resume and --test together"
          )
      if args.resume or args.test:
          config.logging.path = EXP_PATH = args.resume or args.test
      else:
          EXP_PATH = config_experiment_dir(config)
          init_logger(
              os.path.join(EXP_PATH, "log.txt"),
              config.logging.file_level,
              config.logging.console_level,
          )
          # save config to the logger directory
          save_config_to_yaml(config)
  
      # load dataset. The valid_dataset can be None
      (
          train_dataset,
          valid_dataset,
          test_dataset,
          Processor,
      ) = load_dataset(
          config,
          test=args.test is not None
          or config.learning_setting == "zero_shot",
      )
  
      # main
      if config.learning_setting == "full":
          res = trainer(
              EXP_PATH,
              config,
              Processor,
              resume=args.resume,
              test=args.test,
              train_dataset=train_dataset,
              valid_dataset=valid_dataset,
              test_dataset=test_dataset,
          )
      elif config.learning_setting == "few_shot":
          if config.few_shot.few_shot_sampling is None:
              raise ValueError(
                  "use few_shot setting but config.few_shot.few_shot_sampling is not specified"
              )
          seeds = config.sampling_from_train.seed
          res = 0
          for seed in seeds:
              if not args.test:
                  sampler = FewShotSampler(
                      num_examples_per_label=config.sampling_from_train.num_examples_per_label,
                      also_sample_dev=config.sampling_from_train.also_sample_dev,
                      num_examples_per_label_dev=config.sampling_from_train.num_examples_per_label_dev,
                  )
                  (
                      train_sampled_dataset,
                      valid_sampled_dataset,
                  ) = sampler(
                      train_dataset=train_dataset,
                      valid_dataset=valid_dataset,
                      seed=seed,
                  )
                  result = trainer(
                      os.path.join(EXP_PATH, f"seed-{seed}"),
                      config,
                      Processor,
                      resume=args.resume,
                      test=args.test,
                      train_dataset=train_sampled_dataset,
                      valid_dataset=valid_sampled_dataset,
                      test_dataset=test_dataset,
                  )
              else:
                  result = trainer(
                      os.path.join(EXP_PATH, f"seed-{seed}"),
                      config,
                      Processor,
                      test=args.test,
                      test_dataset=test_dataset,
                  )
              res += result
          res /= len(seeds)
      elif config.learning_setting == "zero_shot":
          res = trainer(
              EXP_PATH,
              config,
              Processor,
              zero=True,
              train_dataset=train_dataset,
              valid_dataset=valid_dataset,
              test_dataset=test_dataset,
          )
  
file_path: OpenPrompt/experiments/cli.py
imports: import os
  import sys
  import argparse
  from openprompt.trainer import ClassificationRunner, GenerationRunner
  from openprompt.lm_bff_trainer import LMBFFClassificationRunner
  from openprompt.protoverb_trainer import ProtoVerbClassificationRunner
  from re import template
  from openprompt.pipeline_base import PromptForClassification, PromptForGeneration
  from openprompt.utils.reproduciblity import set_seed
  from openprompt import PromptDataLoader
  from openprompt.prompts import load_template, load_verbalizer, load_template_generator, load_verbalizer_generator
  from openprompt.data_utils import FewShotSampler
  from openprompt.utils.logging import config_experiment_dir, init_logger, logger
  from openprompt.config import get_config, save_config_to_yaml
  from openprompt.plms import load_plm_from_config
  from openprompt.data_utils import load_dataset
  from openprompt.utils.cuda import model_to_device
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types