code: def get_tf_weights_as_numpy(
      path="./ckpt/aeslc/model.ckpt-32000",
  ) -> Dict:
      init_vars = tf.train.list_variables(path)
      tf_weights = {}
      ignore_name = ["Adafactor", "global_step"]
      for name, shape in tqdm(
          init_vars, desc="converting tf checkpoint to dict"
      ):
          skip_key = any([pat in name for pat in ignore_name])
          if skip_key:
              continue
          array = tf.train.load_variable(path, name)
          tf_weights[name] = array
      return tf_weights
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/pegasus/convert_pegasus_tf_to_pytorch.py
imports: import argparse
  import os
  from pathlib import Path
  from typing import Dict
  import tensorflow
  import torch
  from tqdm import tqdm
  from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer
  from transformers.models.pegasus.configuration_pegasus import DEFAULTS, task_specific_params
label_desc: Use image node_id 3 for calling a global function with example usage: get_tf_weights_as_numpy(path) and returns: tf_weights