Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

load a .h5 trained model directly from GCS ?

Hello, it's the fist time I actually try to put in a production environment a locally trained .h5 model. I have a website hosted on a cloud run container and I'm trying to run an Image processing pipeline every-time a file is uploaded to GCS via the website (that's why I want to use a cloud function that triggers when a new file is created).

my issue:

I have found a way to load my .h5 model from GCS but It's taking way too mush time and I'm sure there's surely a better way to do what i'm trying to do:

YorelNation_1-1645444535756.png

almost 1 minute to load on my local machine. Do you have any recommendation on how to trigger the prediction of my trained model + (pre/post processing) easily upon file upload from my website (in a serverless context) ?

0 4 1,337
4 REPLIES 4

Hello,

Can you kindly advise of your complete workflow. Additionally, how big are these h5 files?

Regards

I am using a could run docker container. And instead of packaging the model inside the container I would prefer to tell the code to load it directly from GCS (in python). Model .h5 size is 22.4Mo

Hello,

GCS does offer low latency which applies to all storage classes. If your app and GCS buckets are in the same region, I suggest to file an official support [1] so we can take a look at it in details using our internal tooling.

Regards,

[1] https://cloud.google.com/support-hub

Additionally, 

Have you tried comparing the results when fetching the same file directly through gsutil?