def METHOD_NAME():
    training_args, model_args = PdArgumentParser([TrainingArguments, ModelArguments]).parse_args_into_dataclasses()
    training_args: TrainingArguments = training_args
    model_args: ModelArguments = model_args
    training_args.print_config(model_args, "Model")
    training_args.print_config(training_args, "Training")
    model_args.task_name = model_args.task_name.lower()
    sentence1_key, sentence2_key = task_to_keys[model_args.task_name]
    train_ds = load_dataset("glue", model_args.task_name, split="train")
    columns = train_ds.column_names
    is_regression = model_args.task_name == "stsb"
    label_list = None
    if not is_regression:
        label_list = train_ds.features["label"].names
        num_labels = len(label_list)
    else:
        num_labels = 1
    tokenizer = AutoTokenizer.from_pretrained(model_args.model_name_or_path)
    def preprocess_function(examples):
        # Tokenize the texts
        texts = (
            (examples[sentence1_key],) if sentence2_key is None else (examples[sentence1_key], examples[sentence2_key])
        )
        result = tokenizer(*texts, max_length=model_args.max_seq_length, truncation=True)
        if "label" in examples:
            # In all cases, rename the column to labels because the model will expect that.
            result["labels"] = examples["label"]
        return result
    train_ds = train_ds.map(preprocess_function, batched=True, remove_columns=columns)
    data_collator = DataCollatorWithPadding(tokenizer)
    if model_args.task_name == "mnli":
        dev_ds_matched, dev_ds_mismatched = load_dataset(
            "glue", model_args.task_name, split=["validation_matched", "validation_mismatched"]
        )
        dev_ds_matched = dev_ds_matched.map(preprocess_function, batched=True, remove_columns=columns)
        dev_ds_mismatched = dev_ds_mismatched.map(preprocess_function, batched=True, remove_columns=columns)
        dev_ds = {"matched": dev_ds_matched, "mismatched": dev_ds_mismatched}
    else:
        dev_ds = load_dataset("glue", model_args.task_name, split="validation")
        dev_ds = dev_ds.map(preprocess_function, batched=True, remove_columns=columns)
    model = AutoModelForSequenceClassification.from_pretrained(model_args.model_name_or_path, num_labels=num_labels)
    def compute_metrics(p):
        preds = p.predictions[0] if isinstance(p.predictions, tuple) else p.predictions
        if is_regression:
            preds = np.squeeze(preds)
        preds = paddle.to_tensor(preds)
        label = paddle.to_tensor(p.label_ids)
        metric = METRIC_CLASSES[model_args.task_name]()
        result = metric.compute(preds, label)
        metric.update(result)
        if isinstance(metric, AccuracyAndF1):
            acc, precision, recall, f1, _ = metric.accumulate()
            return {"accuracy": acc, "precision": precision, "recall": recall, "f1": f1}
        elif isinstance(metric, Mcc):
            mcc = metric.accumulate()
            return {"mcc": mcc[0]}
        elif isinstance(metric, PearsonAndSpearman):
            pearson, spearman, _ = metric.accumulate()
            return {"pearson": pearson, "spearman": spearman}
        elif isinstance(metric, Accuracy):
            acc = metric.accumulate()
            return {"accuracy": acc}
    trainer = Trainer(
        model=model,
        args=training_args,
        data_collator=data_collator,
        train_dataset=train_ds if training_args.METHOD_NAME else None,
        eval_dataset=dev_ds,
        tokenizer=tokenizer,
        compute_metrics=compute_metrics,
    )
    # training
    if training_args.METHOD_NAME:
        train_result = trainer.train()
        metrics = train_result.metrics
        trainer.save_model()
        trainer.log_metrics("train", metrics)
        trainer.save_metrics("train", metrics)
        trainer.save_state()
    if training_args.do_eval:
        if model_args.task_name == "mnli":
            for _, eval_dataset in dev_ds.items():
                eval_metrics = trainer.evaluate(eval_dataset)
                trainer.log_metrics("eval", eval_metrics)
                trainer.save_metrics("eval", eval_metrics)
        else:
            eval_metrics = trainer.evaluate(dev_ds)
            trainer.log_metrics("eval", eval_metrics)
            trainer.save_metrics("eval", eval_metrics)