title: Loading Keras model from google cloud ml bucket
body: <p>Using Keras on Google cloud ml:</p>
  
  <p>Saving model from training:</p>
  
  <p>model.save('model.h5')</p>
  
  <pre><code>if cfg.cloud:
      # Copy model.h5 over to Google Cloud Storage
      with file_io.FileIO('model.h5', mode='rb') as input_f:
          with file_io.FileIO(data_folder + 'model.h5', mode='wb+') as output_f:
              output_f.write(input_f.read())
  </code></pre>
  
  <p>Note: not saving to job_folder, I need to read this later, not wanting to keep track of the latest job (even if that's a good way to keep models apart).</p>
  
  <p>Now I want to read from my next run:</p>
  
  <pre><code>f = file_io.FileIO(model_file, mode='rb')
  model = load_model(f)
  model.load_weights(f)
  </code></pre>
  
  <p>Where 'model_file' is given as input in my submission, pointing at </p>
  
  <pre><code>--model-file gs://$BUCKET_NAME/resources/model.h5
  </code></pre>
  
  <p>Complains from google cloud ml jobs:</p>
  
  <pre><code>TypeError: expected str, bytes or os.PathLike object, not FileIO
  </code></pre>
  
  <p>I tried a number of things, but my basic question is: what's the best practice writing <em>and especially</em> reading in models from gcp buckets?</p>