title: How to load numpy npz files in google-cloud-ml jobs or from Google Cloud Storage?
body: <p>I have a google-cloud-ml job that requires loading numpy .npz files from gs bucket. I followed <a href="https://stackoverflow.com/questions/41633748/load-numpy-array-in-google-cloud-ml-job">this example</a> on how to load .npy files from gs, but it didn't work for me since .npz files are compressed.  </p>
  
  <p>Here's my code:</p>
  
  <pre><code>from StringIO import StringIO
  import tensorflow as tf
  import numpy as np
  from tensorflow.python.lib.io import file_io
  
  f = StringIO(file_io.read_file_to_string('gs://my-bucket/data.npz'))
  data = np.load(f)
  </code></pre>
  
  <p>And here's the error message:</p>
  
  <p><code>UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa2 in position 10: invalid start byte</code></p>
  
  <p>Apparently, encoding the data to <code>str</code> is not correct, but I'm not sure how to address this.  </p>
  
  <p>Can some one help? Thanks!</p>