Running Keras model for prediction in multiple threads

前端 未结 2 1047
逝去的感伤
逝去的感伤 2020-12-15 18:08

similar to this question I was running an asynchronous reinforcement learning algorithm and need to run model prediction in multiple threads to get training data more quickl

相关标签:
2条回答
  • 2020-12-15 18:28

    It's a bad idea to predict data in multiple threads . You can use greater batch_size in model.predict when you predict data offline and use tensorflow serving when you predict data online.

    0 讨论(0)
  • 2020-12-15 18:29

    Keras is not thread safe, for predicting large batch you can use batch_size to set Max limits. If you are deploying to production than the ideal is to convert the model weights tensorflow protobuf and than use tensorflow serving.

    You can follow this blog http://machinelearningmechanic.com/keras/2019/06/26/keras-serving-keras-model-quickly-with-tensorflow-serving-and-docker-md.html

    0 讨论(0)
提交回复
热议问题