code: def trim_dataset_pickle(
      input_dataset_filepath,
      output_dataset_filepath=None,
      delete_token_mappings=False,
  ):
      """
      Remove the dataset and labels from dataset.pickle.
      If delete_token_mappings = True, then also remove token_to_index and index_to_token except for UNK.
      """
      print("Trimming dataset.pickle..")
      if output_dataset_filepath == None:
          output_dataset_filepath = os.path.join(
              os.path.dirname(input_dataset_filepath),
              "dataset_trimmed.pickle",
          )
      dataset = pickle.load(open(input_dataset_filepath, "rb"))
      count = 0
      print("Keys removed:")
      keys_to_remove = [
          "character_indices",
          "character_indices_padded",
          "characters",
          "label_indices",
          "label_vector_indices",
          "labels",
          "token_indices",
          "token_lengths",
          "tokens",
          "infrequent_token_indices",
          "tokens_mapped_to_unk",
      ]
      for key in keys_to_remove:
          if key in dataset.__dict__:
              del dataset.__dict__[key]
              print("\t" + key)
              count += 1
      if delete_token_mappings:
          dataset.__dict__["token_to_index"] = {
              dataset.__dict__["UNK"]: dataset.__dict__[
                  "UNK_TOKEN_INDEX"
              ]
          }
          dataset.__dict__["index_to_token"] = {
              dataset.__dict__["UNK_TOKEN_INDEX"]: dataset.__dict__[
                  "UNK"
              ]
          }
      print("Number of keys removed: {0}".format(count))
      pprint(dataset.__dict__)
      pickle.dump(dataset, open(output_dataset_filepath, "wb"))
      print("Done!")
  
file_path: NeuroNER/neuroner/prepare_pretrained_model.py
imports: import glob
  import os
  import pickle
  from pprint import pprint
  import shutil
  import utils
  from entity_lstm import EntityLSTM
  import tensorflow
  from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file
  from neuroner import utils_tf
  from neuroner import neuromodel
label_desc: Use image node_id 1 for calling a global function with example usage: trim_dataset_pickle(input_dataset_filepath, output_dataset_filepath, delete_token_mappings) without return types