Running two tensor flow graphs at a time

I prepared 2 models for slightly different OCR tasks, and I would like to run them simultaneously in a production system.

I have a class that starts a session and loads a saved model. The problem I am facing is that the two models have variables stored with the same name, so they conflict when I try to load them.

Is there any way to run them each in my session or on my own schedule?

+2
source share
1 answer

The easiest option is to collect two models on different graphs and start separate sessions for each graph. However, each session has its own devices (processor and, possibly, a graphics processor), so you will have separate thread pools for each model, and this can lead to suboptimal planning. Good performance will require careful use of configuration parameters tf.Session.

Alternatively, you can combine two models in one chart and use one session. As you noticed, the variables for the two models will necessarily have different names. Therefore, to complete this work, you will need to specify an explicit name-to-matching Variablewhen it buildstf.Saver to load in the model.

+2

Source: https://habr.com/ru/post/1656468/


All Articles