class_docstr: A loader and saver for pretrained embeddings. 
code: def save(self, filename):
      directory, _ = os.path.split(filename)
      if directory:
          os.makedirs(directory, exist_ok=True)
      # should not infinite loop since the load function sets _vocab and _emb before trying to save
      data = {"vocab": self.vocab.state_dict(), "emb": self.emb}
      try:
          torch.save(
              data,
              filename,
              _use_new_zipfile_serialization=False,
              pickle_protocol=3,
          )
          logger.info(
              "Saved pretrained vocab and vectors to {}".format(
                  filename
              )
          )
      except (KeyboardInterrupt, SystemExit):
          raise
      except BaseException as e:
          logger.warning(
              "Saving pretrained data failed due to the following exception... continuing anyway.\n\t{}".format(
                  e
              )
          )
  
imports: import csv
  import os
  import re
  import lzma
  import logging
  import numpy
  import torch
  from .vocab import BaseVocab, VOCAB_PREFIX, UNK_ID
  from stanza.models.common.utils import open_read_binary, open_read_text
  from stanza.resources.common import DEFAULT_MODEL_DIR
label_desc: Use image node_id 5 for calling the Pretrain obj's underlying member method code with example usage: obj.save(filename) without return types