code: def pruning_embedding():
      model: BertForSequenceClassification = torch.load(
          "./output/pruning/ffn_pruned_model.pth"
      )
      teacher_model: BertForSequenceClassification = (
          build_finetuning_model(
              "mnli", f"./output/bert_finetuned/{task_name}.bin"
          )
      )
  
      sparse_ratio = 0.5
      config_list = [
          {
              "op_types": ["Embedding"],
              "op_names_re": ["bert\.embeddings.*"],
              "sparse_ratio": sparse_ratio,
              "dependency_group_id": 1,
              "granularity": [-1, 1],
          },
          {
              "op_names_re": [
                  "bert\.encoder\.layer\.[0-9]*\.attention$",
                  "bert\.encoder\.layer\.[0-9]*\.output$",
              ],
              "target_names": ["_output_"],
              "target_settings": {
                  "_output_": {
                      "align": {
                          "module_name": "bert.embeddings.word_embeddings",
                          "target_name": "weight",
                          "dims": [1],
                      }
                  }
              },
          },
          {
              "op_names_re": [
                  "bert\.encoder\.layer\.[0-9]*\.attention.output.dense",
                  "bert\.encoder\.layer\.[0-9]*\.output.dense",
              ],
              "target_names": ["weight"],
              "target_settings": {
                  "weight": {
                      "granularity": "out_channel",
                      "align": {
                          "module_name": "bert.embeddings.word_embeddings",
                          "target_name": "weight",
                          "dims": [1],
                      },
                  }
              },
          },
      ]
  
      trainer = prepare_traced_trainer(model, task_name)
      teacher_model.eval().to(trainer.args.device)
      distiller = dynamic_distiller(model, teacher_model, trainer)
      taylor_pruner = TaylorPruner.from_compressor(
          distiller, config_list, 1000
      )
      agp_pruner = AGPPruner(taylor_pruner, 1000, 36)
      agp_pruner.compress(None, 3)
      agp_pruner.unwrap_model()
      distiller.unwrap_teacher_model()
  
      masks = agp_pruner.get_masks()
      Path("./output/pruning/").mkdir(parents=True, exist_ok=True)
      torch.save(masks, "./output/pruning/embedding_masks.pth")
      torch.save(model, "./output/pruning/embedding_masked_model.pth")
  
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 13 for calling a global function with example usage: pruning_embedding() without return types