diff --git a/models/tacotron2/vocodes_common.py b/models/tacotron2/vocodes_common.py index be3ca7c16a..13960873e0 100644 --- a/models/tacotron2/vocodes_common.py +++ b/models/tacotron2/vocodes_common.py @@ -160,9 +160,15 @@ class TacotronWaveglowPipeline: print('Loading tacotron model into memory: {}'.format(checkpoint_path), flush=True) model = load_tacotron_model(checkpoint_path) self.tacotron_model_cache[checkpoint_path] = model + print('Now {} synthesizer models in memory'.format(len(self.tacotron_model_cache))) def uncache_tacotron_model(self, checkpoint_path): + print('Currently {} synthesizer models in memory'.format( + len(self.tacotron_model_cache))) + print('Clearing synthesizer from memory: {}'.format(checkpoint_path)) self.tacotron_model_cache.pop(checkpoint_path, None) + print('Now reduced to {} synthesizer models in memory'.format( + len(self.tacotron_model_cache))) def infer(self, args): assert('synthesizer_checkpoint_path' in args) diff --git a/models/tacotron2/vocodes_server.py b/models/tacotron2/vocodes_server.py index bd7ceec03b..ce5c39cb30 100644 --- a/models/tacotron2/vocodes_server.py +++ b/models/tacotron2/vocodes_server.py @@ -229,7 +229,6 @@ class ApiHandler(): maybe_clear_synthesizer_checkpoint_path)) if maybe_clear_synthesizer_checkpoint_path: - print('Clearing synthesizer: {}'.format(maybe_clear_synthesizer_checkpoint_path)) pipeline.uncache_tacotron_model(maybe_clear_synthesizer_checkpoint_path) pipeline.maybe_load_waveglow_model(vocoder_checkpoint_path) diff --git a/src/clients/tts_inference_sidecar_client.rs b/src/clients/tts_inference_sidecar_client.rs index 7f33574a92..a302d081f2 100644 --- a/src/clients/tts_inference_sidecar_client.rs +++ b/src/clients/tts_inference_sidecar_client.rs @@ -20,7 +20,9 @@ struct InferenceRequest { pub output_audio_filename : String, pub output_spectrogram_filename : String, pub output_metadata_filename : String, - pub maybe_unload_model_path: Option, + + /// To instruct the sidecar to unload the model from memory + pub maybe_clear_synthesizer_checkpoint_path: Option, } impl TtsInferenceSidecarClient { @@ -82,7 +84,7 @@ impl TtsInferenceSidecarClient { output_audio_filename, output_spectrogram_filename, output_metadata_filename, - maybe_unload_model_path, + maybe_clear_synthesizer_checkpoint_path: maybe_unload_model_path, }; let url = format!("http://{}/infer", self.hostname); diff --git a/src/tts_inference_job.rs b/src/tts_inference_job.rs index 10b0d71901..884f6d7213 100644 --- a/src/tts_inference_job.rs +++ b/src/tts_inference_job.rs @@ -532,7 +532,7 @@ async fn process_job( info!("Expected output audio filename: {:?}", &output_audio_fs_path); info!("Expected output spectrogram filename: {:?}", &output_spectrogram_fs_path); info!("Expected output metadata filename: {:?}", &output_metadata_fs_path); - info!("Maybe unload model: {:?}", &maybe_unload_model_path); + warn!("Maybe unload model: {:?}", &maybe_unload_model_path); //inferencer.tts_inference_command.execute( // &tts_synthesizer_fs_path,