title: PyTorch - RuntimeError: [enforce fail at inline_container.cc:209] . file not found: archive/data.pkl
body: <p><strong>Problem</strong></p>
  <p>I'm trying to load a file using PyTorch, but the error states <code>archive/data.pkl</code> does not exist.</p>
  <p><strong>Code</strong></p>
  <pre><code>import torch
  cachefile = 'cacheddata.pth'
  torch.load(cachefile)
  </code></pre>
  <p><strong>Output</strong></p>
  <pre><code>---------------------------------------------------------------------------
  RuntimeError                              Traceback (most recent call last)
  &lt;ipython-input-4-8edf1f27a4bd&gt; in &lt;module&gt;
        1 import torch
        2 cachefile = 'cacheddata.pth'
  ----&gt; 3 torch.load(cachefile)
  
  ~/opt/anaconda3/envs/matching/lib/python3.8/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
      582                     opened_file.seek(orig_position)
      583                     return torch.jit.load(opened_file)
  --&gt; 584                 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
      585         return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
      586 
  
  ~/opt/anaconda3/envs/matching/lib/python3.8/site-packages/torch/serialization.py in _load(zip_file, map_location, pickle_module, **pickle_load_args)
      837 
      838     # Load the data (which may in turn use `persistent_load` to load tensors)
  --&gt; 839     data_file = io.BytesIO(zip_file.get_record('data.pkl'))
      840     unpickler = pickle_module.Unpickler(data_file, **pickle_load_args)
      841     unpickler.persistent_load = persistent_load
  
  RuntimeError: [enforce fail at inline_container.cc:209] . file not found: archive/data.pkl
  </code></pre>
  <p><strong>Hypothesis</strong></p>
  <p>I'm guessing this has something to do with pickle, from the <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html" rel="noreferrer">docs</a>:</p>
  <blockquote>
  <p>This save/load process uses the most intuitive syntax and involves the
  least amount of code. Saving a model in this way will save the entire
  module using Python’s pickle module. The disadvantage of this approach
  is that the serialized data is bound to the specific classes and the
  exact directory structure used when the model is saved. The reason for
  this is because pickle does not save the model class itself. Rather,
  it saves a path to the file containing the class, which is used during
  load time. Because of this, your code can break in various ways when
  used in other projects or after refactors.</p>
  </blockquote>
  <p><strong>Versions</strong></p>
  <ul>
  <li>PyTorch version: 1.6.0</li>
  <li>Python version: 3.8.0</li>
  </ul>