title: Pytorch UnpicklingError: A load persistent id instruction was encountered
body: <p>My dataloader raises this error when loading its files:</p>
  <pre><code>UnpicklingError                           Traceback (most recent call last)
  &lt;ipython-input-14-cb081a68afbe&gt; in &lt;module&gt;
  ----&gt; 1 torch.load(&quot;/network/tmp1/ccai/data/labelbox_2020/imgs/AB_304.png&quot;)
  
  ~/.conda/envs/omnienv/lib/python3.8/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
      593                     return torch.jit.load(opened_file)
      594                 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  --&gt; 595         return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
      596 
      597 
  
  ~/.conda/envs/omnienv/lib/python3.8/site-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
      762             &quot;functionality.&quot;)
      763 
  --&gt; 764     magic_number = pickle_module.load(f, **pickle_load_args)
      765     if magic_number != MAGIC_NUMBER:
      766         raise RuntimeError(&quot;Invalid magic number; corrupt file?&quot;)
  
  UnpicklingError: A load persistent id instruction was encountered,
  but no persistent_load function was specified.
  
  </code></pre>
  <p>What's bugging me is that I'm not doing multiple loads from the same process as pointed out <a href="https://github.com/pytorch/pytorch/issues/45136" rel="nofollow noreferrer">here</a>.</p>
  <p>Could it be that this error is triggered by multiple python processes reading the same file?</p>
  <p>pytorch 1.7 on ubuntu 18 with python 3.8</p>