code: def load_data(dataset):
      # download and process dataset if it does not exist
      process_data(base_path, dataset)
      file_loc = os.path.join(base_path, dataset.filename)
      with open(file_loc, "rb") as f:
          dset = pickle.load(f)
          for k, v in dset.items():
              sequences = v["sequences"]
              dset[k]["sequences"] = pad_sequence(
                  sequences, batch_first=True
              ).type(torch.Tensor)
              dset[k]["sequence_lengths"] = v["sequence_lengths"].to(
                  device=torch.Tensor().device
              )
      return dset
  
file_path: pyro/pyro/contrib/examples/polyphonic_data_loader.py
imports: import os
  import pickle
  from collections import namedtuple
  from urllib.request import urlopen
  import torch
  import torch.nn
  from torch.nn.utils.rnn import pad_sequence
  from pyro.contrib.examples.util import get_data_directory
label_desc: Use image node_id 2 for calling a global function with example usage: load_data(dataset) and returns: dset