Closed ttsking closed 2 years ago
@dathudeptrai can you help to explain whether inference in Tensorflow is thread-safe?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I use gunicorn (gevent mode) + flask to setup a TTS webservice, if two requests come, the following code may raise exception. Should i add threading.Semaphore to look tacotron2.inference as a shared resource? My environment is TensorFlow 2.6.2 with a single GPU card
decoder_output, mel_outputs, stop_token_prediction, alignment_history = tacotron2.inference( input_ids=tf.expand_dims(tf.convert_to_tensor(input_ids, dtype=tf.int32), 0), input_lengths=tf.convert_to_tensor([len(input_ids)], tf.int32), speaker_ids=tf.convert_to_tensor([0], dtype=tf.int32), )