How to load many models (HDF5 files) concurrently?

276 views
Skip to first unread message

male...@gmail.com

unread,
Mar 15, 2018, 6:25:06 AM3/15/18
to Keras-users
I have 90 models saved (keras tf backend) and I want to load them in the fastest way. It takes 20 seconds
for each model to be loaded (load_model) which means it takes more than half an hour to load all. I have tried to
load them using threading in python however I could not manage. Here what I tried:

from multiprocessing.pool import ThreadPool

pool = ThreadPool(processes=5)
pool.map(loadf, (filename for filename in ['model1.h5', 'model2.h5','model3.h5','model4.h5','model5.h5']))
pool.close()

And I get:
...

TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("Placeholder:0", shape=(43, 80), dtype=float32) is not an element of this graph.

How can I remedy this?

Thanks in advance!

b

unread,
Mar 15, 2018, 4:28:39 PM3/15/18
to keras...@googlegroups.com

I ran into this issue (or similar) trying to use dask yesterday. Look at this link (the with graph bit) - specifically my answer - and see if it helps.

https://stackoverflow.com/questions/49287934/dask-dataframe-prediction-of-keras-model/49290185?noredirect=1#comment85587469_49290185

--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/1078e2a3-b659-4fcf-af42-d19a4fe9341b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages