mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 08:57:54 +00:00
fix tts download job from breaking
This commit is contained in:
1 parent
5c8731eba9
commit
0d691ded80
3 files changed
+43
-24
No files matched your search
@@ -42,10 +42,12 @@ W2L_DOWNLOAD_SCRIPT_NAME=vocodes_process_upload.py
|
||||
TTS_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-web/models/tts
|
||||
TTS_INFERENCE_SCRIPT_NAME=vocodes_inference.py
|
||||
|
||||
# TODO: Remove generic "check script"
|
||||
TTS_MODEL_CHECK_SCRIPT_NAME=vocodes_model_check.py
|
||||
TTS_TACOTRON_CHECK_SCRIPT_NAME=vocodes_model_check_tacotron.py
|
||||
TTS_TALKNET_CHECK_SCRIPT_NAME=vocodes_model_check_talknet.py
|
||||
TACOTRON_ROOT_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-web/models/tts
|
||||
TACOTRON_VIRTUAL_ENV_ACTIVATION_COMMAND="source python-tacotron/bin/activate"
|
||||
TACOTRON_MODEL_CHECK_SCRIPT_NAME="vocodes_model_check_tacotron.py"
|
||||
|
||||
TALKNET_ROOT_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-web/models/tts
|
||||
TALKNET_MODEL_CHECK_SCRIPT_NAME="vocodes_model_check_talknet.py"
|
||||
|
||||
TTS_INFERENCE_SIDECAR_HOSTNAME=localhost:8000
|
||||
SIDECAR_MAX_SYNTHESIZER_MODELS=2
|
||||
|
||||
@@ -8,18 +8,25 @@ use std::path::Path;
|
||||
/// This command is used to check tacotron for being a real model
|
||||
#[derive(Clone)]
|
||||
pub struct TacotronModelCheckCommand {
|
||||
tacotron_directory: String,
|
||||
check_model_script_name: String,
|
||||
/// Where the Tacotron code lives
|
||||
tacotron_root_code_directory: String,
|
||||
|
||||
/// eg. `source python/bin/activate`
|
||||
virtual_env_activation_command: String,
|
||||
|
||||
tacotron_model_check_script_name: String,
|
||||
}
|
||||
|
||||
impl TacotronModelCheckCommand {
|
||||
pub fn new(
|
||||
tacotron_directory: &str,
|
||||
check_model_script_name: &str,
|
||||
tacotron_root_code_directory: &str,
|
||||
virtual_env_activation_command: &str,
|
||||
tacotron_model_check_script_name: &str,
|
||||
) -> Self {
|
||||
Self {
|
||||
tacotron_directory: tacotron_directory.to_string(),
|
||||
check_model_script_name: check_model_script_name.to_string(),
|
||||
tacotron_root_code_directory: tacotron_root_code_directory.to_string(),
|
||||
virtual_env_activation_command: virtual_env_activation_command.to_string(),
|
||||
tacotron_model_check_script_name: tacotron_model_check_script_name.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +40,12 @@ impl TacotronModelCheckCommand {
|
||||
|
||||
command.push_str("echo 'test'");
|
||||
command.push_str(" && ");
|
||||
command.push_str(&format!("cd {}", self.tacotron_directory));
|
||||
command.push_str(&format!("cd {}", self.tacotron_root_code_directory));
|
||||
command.push_str(" && ");
|
||||
command.push_str("source python/bin/activate");
|
||||
command.push_str(&self.virtual_env_activation_command);
|
||||
command.push_str(" && ");
|
||||
command.push_str("python ");
|
||||
command.push_str(&self.check_model_script_name);
|
||||
command.push_str(&self.tacotron_model_check_script_name);
|
||||
command.push_str(" --synthesizer_checkpoint_path ");
|
||||
command.push_str(&synthesizer_checkpoint_path.as_ref().display().to_string());
|
||||
command.push_str(" --output_metadata_filename ");
|
||||
|
||||
+21
-11
@@ -67,11 +67,6 @@ const ENV_BUCKET_ROOT : &'static str = "TTS_DOWNLOAD_BUCKET_ROOT";
|
||||
|
||||
const DEFAULT_TEMP_DIR: &'static str = "/tmp";
|
||||
|
||||
// Python code
|
||||
const ENV_CODE_DIRECTORY : &'static str = "TTS_CODE_DIRECTORY";
|
||||
const ENV_TACOTRON_CHECK_SCRIPT_NAME : &'static str = "TTS_TACOTRON_CHECK_SCRIPT_NAME";
|
||||
const ENV_TALKNET_CHECK_SCRIPT_NAME : &'static str = "TTS_TALKNET_CHECK_SCRIPT_NAME";
|
||||
|
||||
struct Downloader {
|
||||
pub download_temp_directory: PathBuf,
|
||||
pub mysql_pool: MySqlPool,
|
||||
@@ -179,17 +174,26 @@ async fn main() -> AnyhowResult<()> {
|
||||
firehose_publisher: firehose_publisher.clone(), // NB: Also safe
|
||||
};
|
||||
|
||||
let py_code_directory = easyenv::get_env_string_required(ENV_CODE_DIRECTORY)?;
|
||||
let tacotron_check_script_name = easyenv::get_env_string_required(ENV_TACOTRON_CHECK_SCRIPT_NAME)?;
|
||||
let talknet_check_script_name = easyenv::get_env_string_required(ENV_TALKNET_CHECK_SCRIPT_NAME)?;
|
||||
let tacotron_root_code_directory = easyenv::get_env_string_required("TACOTRON_ROOT_CODE_DIRECTORY")?;
|
||||
let tacotron_virtual_env_activation_command = easyenv::get_env_string_or_default(
|
||||
"TACOTRON_VIRTUAL_ENV_ACTIVATION_COMMAND",
|
||||
"source python-tacotron/bin/activate");
|
||||
|
||||
let tacotron_model_check_script_name = easyenv::get_env_string_or_default(
|
||||
"TACOTRON_MODEL_CHECK_SCRIPT_NAME",
|
||||
"vocodes_model_check_tacotron.py");
|
||||
|
||||
let tacotron_check_command= TacotronModelCheckCommand::new(
|
||||
&py_code_directory,
|
||||
&tacotron_check_script_name,
|
||||
&tacotron_root_code_directory,
|
||||
&tacotron_virtual_env_activation_command,
|
||||
&tacotron_model_check_script_name,
|
||||
);
|
||||
|
||||
let talknet_root_code_directory = easyenv::get_env_string_required("TALKNET_ROOT_CODE_DIRECTORY")?;
|
||||
let talknet_check_script_name = easyenv::get_env_string_required("TALKNET_MODEL_CHECK_SCRIPT_NAME")?;
|
||||
|
||||
let talknet_check_command= TalknetModelCheckCommand::new(
|
||||
&py_code_directory,
|
||||
&talknet_root_code_directory,
|
||||
&talknet_check_script_name,
|
||||
);
|
||||
|
||||
@@ -343,6 +347,12 @@ async fn process_job(downloader: &Downloader, job: &TtsUploadJobRecord) -> Anyho
|
||||
|
||||
info!("Uploaded model type: {:?}", model_type);
|
||||
|
||||
if model_type == TtsModelType::Talknet {
|
||||
// TODO: Finish supporting TalkNet
|
||||
warn!("Unsupported model type");
|
||||
return Err(anyhow!("unsupported model type"));
|
||||
}
|
||||
|
||||
// ==================== RUN MODEL CHECK ==================== //
|
||||
|
||||
info!("Checking that model is valid...");
|
||||
|
||||
Reference in new issue
Block a user