code: def train(args):
      if args.task is not None:
          (
              feature_columns,
              label_column,
              eval_metric,
              all_metrics,
          ) = TASKS[args.task]
      else:
          raise NotImplementedError
      if args.exp_dir is None:
          args.exp_dir = "autogluon_text_{}".format(args.task)
      train_df = load_pd.load(args.train_file)
      dev_df = load_pd.load(args.dev_file)
      test_df = load_pd.load(args.test_file)
      train_df = train_df[feature_columns + [label_column]]
      dev_df = dev_df[feature_columns + [label_column]]
      test_df = test_df[feature_columns]
      if args.task == "mrpc" or args.task == "sts":
          # Augmenting the un-ordered set manually.
          train_df_other_part = pd.DataFrame(
              {
                  feature_columns[0]: train_df[feature_columns[1]],
                  feature_columns[1]: train_df[feature_columns[0]],
                  label_column: train_df[label_column],
              }
          )
          real_train_df = pd.concat([train_df, train_df_other_part])
          real_dev_df = dev_df
      else:
          real_train_df = train_df
          real_dev_df = dev_df
  
      hyperparameters = get_hyperparameter_config("multimodal")
      if args.preset is not None and args.mode in [
          "stacking",
          "weighted",
      ]:
          hyperparameters["AG_TEXT_NN"]["presets"] = args.preset
  
      if args.mode == "stacking":
          predictor = TabularPredictor(
              label=label_column,
              eval_metric=eval_metric,
              path=args.exp_dir,
          )
          predictor.fit(
              train_data=real_train_df,
              tuning_data=real_dev_df,
              hyperparameters=hyperparameters,
              num_bag_folds=5,
              num_stack_levels=1,
          )
      elif args.mode == "weighted":
          predictor = TabularPredictor(
              label=label_column,
              eval_metric=eval_metric,
              path=args.exp_dir,
          )
          predictor.fit(
              train_data=real_train_df,
              tuning_data=real_dev_df,
              hyperparameters=hyperparameters,
          )
      elif args.mode == "single":
          # When no embedding is used,
          # we will just use MultiModalPredictor that will train a single model internally.
          predictor = MultiModalPredictor(
              label=label_column,
              eval_metric=eval_metric,
              path=args.exp_dir,
          )
          predictor.fit(
              train_data=real_train_df,
              tuning_data=real_dev_df,
              presets=args.preset,
              seed=args.seed,
          )
      else:
          raise NotImplementedError
      dev_metric_score = predictor.evaluate(dev_df)
      dev_predictions = predictor.predict(dev_df, as_pandas=True)
      test_predictions = predictor.predict(test_df, as_pandas=True)
      dev_predictions.to_csv(
          os.path.join(args.exp_dir, "dev_prediction.csv")
      )
      test_predictions.to_csv(
          os.path.join(args.exp_dir, "test_prediction.csv")
      )
      with open(
          os.path.join(args.exp_dir, "final_model_scores.json"), "w"
      ) as of:
          json.dump({f"valid_{eval_metric}": dev_metric_score}, of)
  
file_path: autogluon/examples/automm/text_prediction/run_text_prediction.py
imports: import os
  import json
  import argparse
  import numpy
  import random
  import pandas
  import copy
  from autogluon.multimodal import MultiModalPredictor
  from autogluon.tabular import TabularPredictor
  from autogluon.core.utils.loaders import load_pd
  from autogluon.tabular.configs.hyperparameter_configs import get_hyperparameter_config
label_desc: Use image node_id 2 for calling a global function with example usage: train(args) without return types