code: def build_finetuning_model(state_dict_path: str, is_quant=False):
      model = build_model("bert-base-uncased", task_name)
      if Path(state_dict_path).exists():
          model.load_state_dict(torch.load(state_dict_path))
          print(f"==== load finetune model directly ====")
      else:
          trainer = prepare_traced_trainer(model, True, is_quant)
          trainer.train()
          torch.save(model.state_dict(), state_dict_path)
      return model
  
imports: from pathlib import Path
  import argparse
  import sys
  import numpy
  import torch
  from torch.utils.data import ConcatDataset
  import nni
  from datasets import load_dataset, load_metric
  from transformers import BertTokenizerFast, DataCollatorWithPadding, BertForSequenceClassification, EvalPrediction
  from transformers.trainer import Trainer
  from transformers.training_args import TrainingArguments
  import nni
  from nni.compression.quantization import QATQuantizer, LsqQuantizer, PtqQuantizer
  from nni.compression.utils import TransformersEvaluator
label_desc: Use image node_id 4 for calling a global function with example usage: build_finetuning_model(state_dict_path, is_quant) and returns: model