model loading/unloading works

This commit is contained in:
Brandon Thomas committed 2021-07-05 10:33:48 -04:00
1 parent 4da28003f2
commit b476485cd7
4 files changed
+11 -4

No files matched your search

+6
View File
@@ -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)
-1
View File
@@ -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)
+4 -2
View File
@@ -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<String>,
/// To instruct the sidecar to unload the model from memory
pub maybe_clear_synthesizer_checkpoint_path: Option<String>,
}
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);
+1 -1
View File
@@ -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,