mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-10 20:11:49 +00:00
model loading/unloading works
This commit is contained in:
1 parent
4da28003f2
commit
b476485cd7
4 files changed
+11
-4
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user