How can I make multiple sessions share a graph? Not found: Container localhost does not exist #51568
Labels
comp:ops
OPs related issues
stale
This label marks the issue/pr stale - to be closed automatically if no activity
stat:awaiting response
Status - Awaiting response from author
TF 2.3
Issues related to TF 2.3
type:bug
Bug
How can I make multiple sessions share a graph by c_api?
My usage is as follows:
The first session is created using TF_LoadSessionFromSavedModel.
The second session is created using TF_NewSession.
It is normal to call the TF_SessionRun of the first session. However, when calling the TF_SessionRun of the second session from another thread, the following error is reported:
2021-08-19 14:56:00.772594: W tensorflow/core/framework/op_kernel.cc:1767] OP_REQUIRES failed at resource_variable_ops.cc:633 : Not found: Container localhost does not exist. (Could not find resource: localhost/embeddings/charactor_embeddings/weight)
{{function_node __inference__inference_5828_specialized_for_StatefulPartitionedCall_StatefulPartitionedCall_at_tf_graph}} {{function_node _inference__inference_5828_specialized_for_StatefulPartitionedCall_StatefulPartitionedCall_at_tf_graph}} Error while reading resource variable encoder/layer.0/attention/self/key/bias from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/encoder/layer.0/attention/self/key/bias)
[[{{node encoder/layer._0/attention/self/key/BiasAdd/ReadVariableOp}}]]
terminate called after throwing an instance of 'std::runtime_error'
what(): {{function_node __inference__inference_5828_specialized_for_StatefulPartitionedCall_StatefulPartitionedCall_at_tf_graph}} {{function_node _inference__inference_5828_specialized_for_StatefulPartitionedCall_StatefulPartitionedCall_at_tf_graph}} Error while reading resource variable encoder/layer.0/attention/self/key/bias from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/encoder/layer.0/attention/self/key/bias)
[[{{node encoder/layer._0/attention/self/key/BiasAdd/ReadVariableOp}}]]
[[StatefulPartitionedCall/StatefulPartitionedCall]]
[[StatefulPartitionedCall/StatefulPartitionedCall]]Aborted (core dumped)
Why? Usage problem or bug? We look forward to your reply.
System information
tensorflow version(2.3.0)
Linux Ubuntu 16.04
code snippet:
static pthread_mutex_t sSpeakerClassToGraphMutex = PTHREAD_MUTEX_INITIALIZER;
static std::map<const void*, const void*> sSpeakerClassToGraph;
Model::Model(const void* classID, const std::string& model_filename, const std::vector<uint8_t>& config_options) {
}
The text was updated successfully, but these errors were encountered: