mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 08:57:54 +00:00
fix lint/test failures
This commit is contained in:
1 parent
2d4d2c667f
commit
1771e1dffe
7 files changed
+70
-9
No files matched your search
@@ -139,7 +139,7 @@ mod tests {
|
||||
fn all_variants() {
|
||||
// Static check
|
||||
let mut variants = InferenceModelType::all_variants();
|
||||
assert_eq!(variants.len(), 8);
|
||||
assert_eq!(variants.len(), 9);
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::RvcV2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::SadTalker));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::SoVitsSvc));
|
||||
|
||||
@@ -8,12 +8,11 @@ use errors::AnyhowResult;
|
||||
use crate::bucket_clients::get_bucket_clients;
|
||||
use crate::cli_args::parse_cli_args;
|
||||
use crate::seeding::model_weights::seed_weights; // V1
|
||||
use crate::seeding::seed_model_weights::seed_weights_files; // V2 v3 will come later on when everything is more conslidated and clear.
|
||||
use crate::seeding::seed_media_files::seed_media_files;
|
||||
use crate::seeding::seed_model_weights::seed_weights_files; // V2 v3 will come later on when everything is more conslidated and clear.
|
||||
use crate::seeding::tts_tacotron2::seed_tts_tacotron2;
|
||||
use crate::seeding::users::seed_user_accounts;
|
||||
use crate::seeding::voice_conversion::seed_voice_conversion;
|
||||
use crate::seeding::zero_shot_tts::seed_zero_shot_tts;
|
||||
|
||||
pub mod bucket_clients;
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use clap::Parser;
|
||||
use strum::{EnumCount, EnumString, IntoEnumIterator};
|
||||
use strum::EnumIter;
|
||||
|
||||
use errors::{anyhow, AnyhowResult};
|
||||
|
||||
pub struct ParsedArgs {
|
||||
pub action: Action,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, EnumIter, EnumCount, EnumString, strum::Display)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum Action {
|
||||
/// Migrate VC
|
||||
MigrateVoiceConversion,
|
||||
/// Migrate TTS
|
||||
MigrateTts,
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name="migration-tool")]
|
||||
pub struct Args {
|
||||
#[arg(name="action", long="action", help="action to take", required=true)]
|
||||
action: String,
|
||||
}
|
||||
|
||||
pub fn parse_cli_args() -> AnyhowResult<ParsedArgs> {
|
||||
let args = Args::parse();
|
||||
|
||||
Ok(ParsedArgs {
|
||||
action: action_from_str(&args.action)?,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fn action_from_str(value: &str) -> AnyhowResult<Action> {
|
||||
let action = Action::from_str(value)
|
||||
.map_err(|err| {
|
||||
let choices = Action::iter()
|
||||
.map(|e| e.to_string())
|
||||
.collect::<Vec<_>>();
|
||||
anyhow!("parse error: {:?}, provided: \"{}\" choices: {:?}", err, value, choices)
|
||||
})?;
|
||||
Ok(action)
|
||||
}
|
||||
@@ -14,8 +14,12 @@ use cloud_storage::bucket_client::BucketClient;
|
||||
use config::shared_constants::DEFAULT_RUST_LOG;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::cli_args::{Action, parse_cli_args};
|
||||
use crate::deps::Deps;
|
||||
use crate::migrations::tts_models_to_weights::migrate::migrate_tts_to_weights;
|
||||
use crate::migrations::voice_conversion_to_weights::migrate::migrate_voice_conversion_to_weights;
|
||||
|
||||
pub mod cli_args;
|
||||
pub mod deps;
|
||||
pub mod migrations;
|
||||
|
||||
@@ -40,10 +44,20 @@ pub async fn main() -> AnyhowResult<()> {
|
||||
bucket_production_private: get_bucket_client("PRODUCTION_PRIVATE")?,
|
||||
};
|
||||
|
||||
//migrate_voice_conversion_to_weights(&deps).await?;
|
||||
let args = parse_cli_args()?;
|
||||
|
||||
match args.action {
|
||||
Action::MigrateVoiceConversion => {
|
||||
migrate_voice_conversion_to_weights(&deps).await?;
|
||||
}
|
||||
Action::MigrateTts => {
|
||||
migrate_tts_to_weights(&deps).await?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn get_mysql(env_var_name: &str) -> AnyhowResult<Pool<MySql>> {
|
||||
info!("Connecting to MySQL {env_var_name}...");
|
||||
|
||||
|
||||
+4
-3
@@ -1,8 +1,9 @@
|
||||
use crate::util::model_downloader::ModelDownloader;
|
||||
|
||||
pub struct StyleTTS2Downloaders {
|
||||
// pub styletts2: StyleTTS2ModelMapping,
|
||||
}
|
||||
pub struct StyleTTS2Downloaders;
|
||||
//{
|
||||
// pub styletts2: StyleTTS2ModelMapping,
|
||||
//}
|
||||
|
||||
impl StyleTTS2Downloaders {
|
||||
// TODO(KS): All checkpoints are in the container, so we don't need to download them here.
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ pub async fn process_create_voice(
|
||||
|
||||
// TODO(KS): This is a hack to get only the first file to download
|
||||
// Ideally we could have improved logic to pick the "best" media file from a dataset
|
||||
if (index >= 0) {
|
||||
if downloaded_dataset.len() >= 1 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ pub async fn process_inference_voice(
|
||||
.new_tempdir(&work_temp_dir)
|
||||
.map_err(|e| ProcessSingleJobError::from_io_error(e))?;
|
||||
|
||||
let workdir = work_temp_dir.path().to_path_buf();
|
||||
let _workdir = work_temp_dir.path().to_path_buf();
|
||||
let filename = "style.npz".to_string();
|
||||
|
||||
let mut downloaded_weights_path = work_temp_dir.path().to_path_buf();
|
||||
|
||||
Reference in new issue
Block a user