title: How to load pretrained Tensorflow model from Google Cloud Storage into Datalab
body: <p>I have trained a model in Tensorflow (v2.0) Keras locally.
  I now need to upload this pretrained model into Google Datalab to make predictions on a large batch of data. Tenserflow version available on Datalab is 1.8 but I assume backward compatibility.</p>
  
  <p>I have uploaded the saved model (model.h5) onto Google Cloud Storage. I tried to load it into a Jupyter Notebook in Datalab like so:</p>
  
  <pre><code>%%gcs read --object gs://project-xxx/data/saved_model.h5 --variable ldmodel
  model = keras.models.load_model(ldmodel)
  </code></pre>
  
  <p>This throws up the error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  UnicodeDecodeError                        Traceback (most recent call last)
  &lt;ipython-input-18-07c40785a14b&gt; in &lt;module&gt;()
  ----&gt; 1 model = keras.models.load_model(ldmodel)
  
  /usr/local/envs/py3env/lib/python3.5/site- 
     packages/tensorflow/python/keras/_impl/keras/engine/saving.py in load_model(filepath, 
  custom_objects, 
  compile)
      233     return obj
      234 
  --&gt; 235   with h5py.File(filepath, mode='r') as f:
      236     # instantiate model
      237     model_config = f.attrs.get('model_config')
  
  /usr/local/envs/py3env/lib/python3.5/site-packages/h5py/_hl/files.py in __init__(self, name, mode, 
  driver, libver, userblock_size, swmr, **kwds)
      267             with phil:
      268                 fapl = make_fapl(driver, libver, **kwds)
  --&gt; 269                 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
      270 
      271                 if swmr_support:
  
      /usr/local/envs/py3env/lib/python3.5/site-packages/h5py/_hl/files.py in make_fid(name, mode, 
     userblock_size, fapl, fcpl, swmr)
       97         if swmr and swmr_support:
       98             flags |= h5f.ACC_SWMR_READ
  ---&gt; 99         fid = h5f.open(name, flags, fapl=fapl)
      100     elif mode == 'r+':
      101         fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
  
  h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
  
  h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
  
  h5py/h5f.pyx in h5py.h5f.open()
  
  h5py/defs.pyx in h5py.defs.H5Fopen()
  
  h5py/_errors.pyx in h5py._errors.set_exception()
  
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 29: invalid start byte
  </code></pre>
  
  <p>Any help will be appreciated!</p>