code: def run(args):
      if args.task == "product_sentiment":
          (
              train_df,
              test_df,
              label_column,
          ) = load_machine_hack_product_sentiment(
              args.train_file, args.test_file
          )
      elif args.task == "mercari_price":
          (
              train_df,
              test_df,
              label_column,
          ) = load_mercari_price_prediction(
              args.train_file, args.test_file
          )
      elif args.task == "price_of_books":
          train_df, test_df, label_column = load_price_of_books(
              args.train_file, args.test_file
          )
      elif args.task == "data_scientist_salary":
          train_df, test_df, label_column = load_data_scientist_salary(
              args.train_file, args.test_file
          )
      else:
          raise NotImplementedError
  
      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=args.eval_metric,
              path=args.exp_dir,
          )
          predictor.fit(
              train_data=train_df,
              hyperparameters=hyperparameters,
              num_bag_folds=5,
              num_stack_levels=1,
          )
      elif args.mode == "weighted":
          predictor = TabularPredictor(
              label=label_column,
              eval_metric=args.eval_metric,
              path=args.exp_dir,
          )
          predictor.fit(
              train_data=train_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=args.eval_metric,
              path=args.exp_dir,
          )
          predictor.fit(
              train_data=train_df, presets=args.preset, seed=args.seed
          )
      else:
          raise NotImplementedError
      if args.task == "product_sentiment":
          test_probabilities = predictor.predict_proba(
              test_df, as_pandas=True, as_multiclass=True
          )
          test_probabilities.to_csv(
              os.path.join(args.exp_dir, "submission.csv"), index=False
          )
      elif args.task == "data_scientist_salary":
          predictions = predictor.predict(test_df, as_pandas=False)
          submission = pd.read_excel(
              args.sample_submission, engine="openpyxl"
          )
          submission.loc[:, label_column] = predictions
          submission.to_excel(
              os.path.join(args.exp_dir, "submission.xlsx")
          )
      elif args.task == "price_of_books":
          predictions = predictor.predict(test_df, as_pandas=False)
          submission = pd.read_excel(
              args.sample_submission, engine="openpyxl"
          )
          submission.loc[:, label_column] = (
              np.power(10, predictions) - 1
          )
          submission.to_excel(
              os.path.join(args.exp_dir, "submission.xlsx")
          )
      elif args.task == "mercari_price":
          test_predictions = predictor.predict(test_df, as_pandas=False)
          submission = pd.read_csv(args.sample_submission)
          submission.loc[:, label_column] = np.exp(test_predictions) - 1
          submission.to_csv(
              os.path.join(args.exp_dir, "submission.csv"), index=False
          )
      else:
          raise NotImplementedError
  
file_path: autogluon/examples/automm/text_prediction/run_competition.py
imports: import os
  import json
  import argparse
  import pandas
  import numpy
  import random
  from autogluon.tabular import TabularPredictor
  from autogluon.multimodal import MultiModalPredictor
  from autogluon.tabular.configs.hyperparameter_configs import get_hyperparameter_config
label_desc: Use image node_id 6 for calling a global function with example usage: run(args) without return types