code: def build_model(pretrained_model_name_or_path: str, task_name: str):
      is_regression = task_name == "stsb"
      num_labels = (
          1 if is_regression else (3 if task_name == "mnli" else 2)
      )
      model = BertForSequenceClassification.from_pretrained(
          pretrained_model_name_or_path, num_labels=num_labels
      )
      return model
  
imports: from __future__ import annotations
  from pathlib import Path
  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
  from nni.compression.distillation import DynamicLayerwiseDistiller, Adaptive1dLayerwiseDistiller
  from nni.compression.utils import TransformersEvaluator
  from nni.compression.pruning import MovementPruner
  from nni.compression.speedup import ModelSpeedup
  from nni.compression.utils.external.external_replacer import TransformersAttentionReplacer
  from nni.compression.pruning import TaylorPruner, AGPPruner
  from transformers.models.bert.modeling_bert import BertLayer
  from nni.compression.base.setting import PruningSetting
label_desc: Use image node_id 1 for calling a global function with example usage: build_model(pretrained_model_name_or_path, task_name) and returns: model