title: FastAI load_learner() | ModuleNotFoundError: No module named '__builtin__'
body: <p>To minimise code, I want to use <a href="https://docs.fast.ai/learner.html#load_model" rel="nofollow noreferrer">load_learner()</a>, instead of creating a new <code>learner</code> every time.</p>
  <p><code>with open()</code> works, but leaves me with setting up the large amount of learner code.</p>
  <hr />
  <p>I get thrown this error on <code>load_learner()</code></p>
  <pre><code>ModuleNotFoundError: No module named '__builtin__'
  </code></pre>
  <p>Supposedly, <code>__builtins__</code> was renamed to <code>builtins</code> in Python 3.
  <a href="https://github.com/catboost/catboost/issues/953#issuecomment-521557773" rel="nofollow noreferrer">Source 1</a>
  <a href="https://stackoverflow.com/questions/52935624/pandas-library-modulenotfounderror-no-module-named-builtin">Source 2</a></p>
  <h4>Versions</h4>
  <pre><code>torch==1.7.1
  fastai==2.7.7
  fastcore==1.5.6
  torch==1.7.1
  torchvision==0.8.2
  </code></pre>
  <hr />
  <p><code>predict.py</code></p>
  <pre class="lang-py prettyprint-override"><code>if __name__ == '__main__':
      file_path = project_params.file_path
      learner = project_params.learner
      model = load_learner(file_path.model, cpu=learner.cpu)  # !
  </code></pre>
  <pre><code>(venv) me@ubuntu-pcs:~/PycharmProjects/project$ python project_model/predict.py
  'pdl1_lung_model/data/histology_tiles.dvc' didn't change, skipping    
  Running stage 'predict':
  &gt; python pdl1_lung_model/predict.py
  /home/me/miniconda3/envs/venv/lib/python3.9/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at  /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
    return torch._C._cuda_getDeviceCount() &gt; 0
  Traceback (most recent call last):
    File &quot;/home/me/PycharmProjects/project/pdl1_lung_model/predict.py&quot;, line 35, in &lt;module&gt;
      model = load_learner(file_path.model, cpu=learner.cpu)
    File &quot;/home/me/miniconda3/envs/venv/lib/python3.9/site-packages/fastai/learner.py&quot;, line 414, in load_learner
      try: res = torch.load(fname, map_location=map_loc, pickle_module=pickle_module)
    File &quot;/home/me/miniconda3/envs/venv/lib/python3.9/site-packages/torch/serialization.py&quot;, line 595, in load
      return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
    File &quot;/home/me/miniconda3/envs/venv/lib/python3.9/site-packages/torch/serialization.py&quot;, line 764, in _legacy_load
      magic_number = pickle_module.load(f, **pickle_load_args)
  ModuleNotFoundError: No module named '__builtin__'
  ERROR: failed to reproduce 'predict': failed to run: python pdl1_lung_model/predict.py, exited with 1
  </code></pre>
  <hr />
  <p><code>params.yaml</code></p>
  <pre><code>learner:
    cpu: False
  # ...
  file_path:
    model: ./project_model/data/learner.pkl
  </code></pre>