code: def dynamic_distillation(
      student_model: BertForSequenceClassification,
      teacher_model: BertForSequenceClassification,
      max_steps: int | None,
      max_epochs: int | None,
  ):
      student_trainer = prepare_traced_trainer(
          student_model, task_name, True
      )
  
      ori_teacher_device = teacher_model.device
      training = teacher_model.training
      teacher_model.to(student_trainer.args.device).eval()
  
      distiller = dynamic_distiller(
          student_model, teacher_model, student_trainer
      )
      distiller.compress(max_steps, max_epochs)
      distiller.unwrap_model()
  
      teacher_model.to(ori_teacher_device).train(training)
  
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 6 for calling a global function with example usage: dynamic_distillation(student_model, teacher_model, max_steps, max_epochs) without return types