code: def export_pretrained_compression_model(
      pretrained_encodec: str, out_file: tp.Union[Path, str]
  ):
      """Export a compression model (potentially EnCodec) from a pretrained model.
      This is required for packaging the audio tokenizer along a MusicGen or AudioGen model.
      Do not include the //pretrained/ prefix. For instance if you trained a model
      with `facebook/encodec_32khz`, just put that as a name. Same for `dac_44khz`.
  
      In that case, this will not actually include a copy of the model, simply the reference
      to the model used.
      """
      if Path(pretrained_encodec).exists():
          pkg = torch.load(pretrained_encodec)
          assert "best_state" in pkg
          assert "xp.cfg" in pkg
          assert "version" in pkg
          assert "exported" in pkg
      else:
          pkg = {
              "pretrained": pretrained_encodec,
              "exported": True,
              "version": __version__,
          }
      Path(out_file).parent.mkdir(exist_ok=True, parents=True)
      torch.save(pkg, out_file)
  
file_path: audiocraft/audiocraft/utils/export.py
imports: from pathlib import Path
  import typing
  from omegaconf import OmegaConf
  import torch
  from audiocraft import __version__
label_desc: Use image node_id 2 for calling a global function with example usage: export_pretrained_compression_model(pretrained_encodec, out_file) without return types