mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-15 06:12:18 +00:00
Merge pull request #231 from storytold/brandon-tts-migration
work on tts model migration
This commit is contained in:
5 files changed
+897
No files matched your search
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nUPDATE voice_conversion_models\nSET\n maybe_migration_new_model_weights_token = ?\nWHERE token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "898a2f89d1f3efcb87adaef432cc73117057e44766c330caff6ce2c9d48518fd"
|
||||
}
|
||||
+542
@@ -0,0 +1,542 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n id,\n token as `token: tokens::tokens::tts_models::TtsModelToken`,\n\n tts_model_type as `tts_model_type: enums::by_table::tts_models::tts_model_type::TtsModelType`,\n\n text_pipeline_type,\n has_self_contained_vocoder,\n has_self_contained_duration_model,\n has_self_contained_pitch_model,\n text_preprocessing_algorithm,\n\n use_default_mel_multiply_factor,\n maybe_custom_mel_multiply_factor,\n maybe_default_pretrained_vocoder,\n maybe_custom_vocoder_token as `maybe_custom_vocoder_token: tokens::tokens::vocoder_models::VocoderModelToken`,\n\n ietf_language_tag,\n ietf_primary_language_subtag,\n\n title,\n description_markdown,\n description_rendered_html,\n\n voice_name,\n actor_name,\n characteristic,\n version_string,\n\n is_front_page_featured,\n is_twitch_featured,\n\n maybe_suggested_unique_bot_command,\n\n original_download_url,\n original_filename,\n file_size_bytes,\n\n creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n\n creator_ip_address_creation,\n creator_ip_address_last_update,\n\n creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n private_bucket_hash,\n private_bucket_object_name,\n\n private_bucket_object_is_archive,\n\n user_ratings_total_count,\n user_ratings_positive_count,\n user_ratings_negative_count,\n\n is_public_listing_approved,\n is_locked_from_user_modification,\n is_locked_from_use,\n\n maybe_mod_comments,\n maybe_mod_user_token as `maybe_mod_user_token: tokens::tokens::users::UserToken`,\n\n maybe_migration_new_model_weights_token as `maybe_migration_new_model_weights_token: tokens::tokens::model_weights::ModelWeightToken`,\n\n version,\n\n created_at,\n updated_at,\n\n user_deleted_at,\n mod_deleted_at\n\nFROM tts_models\nWHERE\n id > ?\nORDER BY id ASC\nLIMIT ?\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": {
|
||||
"type": "LongLong",
|
||||
"flags": "NOT_NULL | PRIMARY_KEY | AUTO_INCREMENT",
|
||||
"char_set": 63,
|
||||
"max_size": 20
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "token: tokens::tokens::tts_models::TtsModelToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "tts_model_type: enums::by_table::tts_models::tts_model_type::TtsModelType",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 60
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "text_pipeline_type",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "has_self_contained_vocoder",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "has_self_contained_duration_model",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "has_self_contained_pitch_model",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "text_preprocessing_algorithm",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "use_default_mel_multiply_factor",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "maybe_custom_mel_multiply_factor",
|
||||
"type_info": {
|
||||
"type": "Double",
|
||||
"flags": "",
|
||||
"char_set": 63,
|
||||
"max_size": 22
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "maybe_default_pretrained_vocoder",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "maybe_custom_vocoder_token: tokens::tokens::vocoder_models::VocoderModelToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "ietf_language_tag",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "ietf_primary_language_subtag",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 48
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"name": "title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"name": "description_markdown",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"name": "description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"name": "voice_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 18,
|
||||
"name": "actor_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 19,
|
||||
"name": "characteristic",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 20,
|
||||
"name": "version_string",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "is_front_page_featured",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 22,
|
||||
"name": "is_twitch_featured",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 23,
|
||||
"name": "maybe_suggested_unique_bot_command",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 24,
|
||||
"name": "original_download_url",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 2048
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 25,
|
||||
"name": "original_filename",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 26,
|
||||
"name": "file_size_bytes",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 27,
|
||||
"name": "creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 28,
|
||||
"name": "creator_ip_address_creation",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 160
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 29,
|
||||
"name": "creator_ip_address_last_update",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 160
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 30,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 31,
|
||||
"name": "private_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 32,
|
||||
"name": "private_bucket_object_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 33,
|
||||
"name": "private_bucket_object_is_archive",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 34,
|
||||
"name": "user_ratings_total_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL | UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 35,
|
||||
"name": "user_ratings_positive_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL | UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 36,
|
||||
"name": "user_ratings_negative_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL | UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 37,
|
||||
"name": "is_public_listing_approved",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "MULTIPLE_KEY",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 38,
|
||||
"name": "is_locked_from_user_modification",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 39,
|
||||
"name": "is_locked_from_use",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 40,
|
||||
"name": "maybe_mod_comments",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 41,
|
||||
"name": "maybe_mod_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 42,
|
||||
"name": "maybe_migration_new_model_weights_token: tokens::tokens::model_weights::ModelWeightToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 43,
|
||||
"name": "version",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 44,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 45,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 46,
|
||||
"name": "user_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 47,
|
||||
"name": "mod_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "a44c637e84152864a00f0ba58838c2f3888e3061fc8b44291541840fdb706e44"
|
||||
}
|
||||
+341
@@ -0,0 +1,341 @@
|
||||
use anyhow::anyhow;
|
||||
use chrono::{DateTime, Utc};
|
||||
use log::warn;
|
||||
use sqlx::{MySql, MySqlPool};
|
||||
use sqlx::pool::PoolConnection;
|
||||
use enums::by_table::tts_models::tts_model_type::TtsModelType;
|
||||
|
||||
use enums::by_table::voice_conversion_models::voice_conversion_model_type::VoiceConversionModelType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::tts_models::TtsModelToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
use tokens::tokens::vocoder_models::VocoderModelToken;
|
||||
use tokens::tokens::voice_conversion_models::VoiceConversionModelToken;
|
||||
|
||||
use crate::helpers::boolean_converters::{i8_to_bool, nullable_i8_to_optional_bool};
|
||||
|
||||
/// This is meant to be the entire table
|
||||
#[derive(Debug)]
|
||||
pub struct WholeTtsModelRecord {
|
||||
pub id: i64,
|
||||
pub token: TtsModelToken,
|
||||
|
||||
pub tts_model_type: TtsModelType,
|
||||
pub text_pipeline_type: Option<String>,
|
||||
|
||||
pub has_self_contained_vocoder: bool,
|
||||
pub has_self_contained_duration_model: bool,
|
||||
pub has_self_contained_pitch_model: bool,
|
||||
|
||||
pub text_preprocessing_algorithm: Option<String>,
|
||||
|
||||
pub use_default_mel_multiply_factor: bool,
|
||||
pub maybe_custom_mel_multiply_factor: Option<f64>,
|
||||
|
||||
pub maybe_default_pretrained_vocoder: Option<String>,
|
||||
pub maybe_custom_vocoder_token: Option<VocoderModelToken>,
|
||||
|
||||
pub ietf_language_tag: String,
|
||||
pub ietf_primary_language_subtag: String,
|
||||
|
||||
pub title: String,
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
|
||||
pub voice_name: Option<String>,
|
||||
pub actor_name: Option<String>,
|
||||
pub characteristic: Option<String>,
|
||||
pub version_string: Option<String>,
|
||||
|
||||
pub is_front_page_featured: bool,
|
||||
pub is_twitch_featured: bool,
|
||||
|
||||
pub maybe_suggested_unique_bot_command: Option<String>,
|
||||
|
||||
pub original_download_url: Option<String>,
|
||||
pub original_filename: Option<String>,
|
||||
pub file_size_bytes: i32,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
|
||||
pub creator_ip_address_creation: String,
|
||||
pub creator_ip_address_last_update: String,
|
||||
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub private_bucket_hash: String,
|
||||
pub private_bucket_object_name: String,
|
||||
|
||||
pub private_bucket_object_is_archive: bool,
|
||||
|
||||
pub user_ratings_total_count: u32,
|
||||
pub user_ratings_positive_count: u32,
|
||||
pub user_ratings_negative_count: u32,
|
||||
|
||||
pub is_public_listing_approved: Option<bool>,
|
||||
pub is_locked_from_user_modification: bool,
|
||||
pub is_locked_from_use: bool,
|
||||
|
||||
pub maybe_mod_comments: Option<String>,
|
||||
pub maybe_mod_user_token: Option<UserToken>,
|
||||
|
||||
pub maybe_migration_new_model_weights_token: Option<ModelWeightToken>,
|
||||
|
||||
pub version: i32,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
|
||||
pub user_deleted_at: Option<DateTime<Utc>>,
|
||||
pub mod_deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
pub async fn list_whole_tts_models_using_cursor(
|
||||
mysql_pool: &MySqlPool,
|
||||
page_size: u64,
|
||||
cursor: u64,
|
||||
) -> AnyhowResult<Vec<WholeTtsModelRecord>> {
|
||||
let mut connection = mysql_pool.acquire().await?;
|
||||
|
||||
let maybe_models
|
||||
= list_whole_voice_conversion_models(&mut connection, page_size, cursor)
|
||||
.await;
|
||||
|
||||
let models : Vec<RawRecord> = match maybe_models {
|
||||
Ok(models) => models,
|
||||
Err(err) => {
|
||||
match err {
|
||||
RowNotFound => {
|
||||
return Ok(Vec::new());
|
||||
},
|
||||
_ => {
|
||||
warn!("vc model list query error: {:?}", err);
|
||||
return Err(anyhow!("vc model list query error"));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Ok(models.into_iter()
|
||||
.map(|model| {
|
||||
WholeTtsModelRecord {
|
||||
id: model.id,
|
||||
token: model.token,
|
||||
tts_model_type: model.tts_model_type,
|
||||
text_pipeline_type: model.text_pipeline_type,
|
||||
has_self_contained_vocoder: i8_to_bool(model.has_self_contained_vocoder),
|
||||
has_self_contained_duration_model: i8_to_bool(model.has_self_contained_duration_model),
|
||||
has_self_contained_pitch_model: i8_to_bool(model.has_self_contained_pitch_model),
|
||||
text_preprocessing_algorithm: model.text_preprocessing_algorithm,
|
||||
use_default_mel_multiply_factor: i8_to_bool(model.use_default_mel_multiply_factor),
|
||||
maybe_custom_mel_multiply_factor: model.maybe_custom_mel_multiply_factor,
|
||||
maybe_default_pretrained_vocoder: model.maybe_default_pretrained_vocoder,
|
||||
title: model.title,
|
||||
description_markdown: model.description_markdown,
|
||||
description_rendered_html: model.description_rendered_html,
|
||||
voice_name: model.voice_name,
|
||||
actor_name: model.actor_name,
|
||||
characteristic: model.characteristic,
|
||||
ietf_language_tag: model.ietf_language_tag,
|
||||
ietf_primary_language_subtag: model.ietf_primary_language_subtag,
|
||||
is_front_page_featured: i8_to_bool(model.is_front_page_featured),
|
||||
is_twitch_featured: i8_to_bool(model.is_twitch_featured),
|
||||
maybe_suggested_unique_bot_command: model.maybe_suggested_unique_bot_command,
|
||||
original_download_url: model.original_download_url,
|
||||
original_filename: model.original_filename,
|
||||
file_size_bytes: model.file_size_bytes,
|
||||
creator_user_token: model.creator_user_token,
|
||||
creator_ip_address_creation: model.creator_ip_address_creation,
|
||||
creator_ip_address_last_update: model.creator_ip_address_last_update,
|
||||
creator_set_visibility: model.creator_set_visibility,
|
||||
private_bucket_hash: model.private_bucket_hash,
|
||||
private_bucket_object_name: model.private_bucket_object_name,
|
||||
private_bucket_object_is_archive: i8_to_bool(model.private_bucket_object_is_archive),
|
||||
user_ratings_total_count: model.user_ratings_total_count,
|
||||
user_ratings_positive_count: model.user_ratings_positive_count,
|
||||
user_ratings_negative_count: model.user_ratings_negative_count,
|
||||
is_public_listing_approved: nullable_i8_to_optional_bool(model.is_public_listing_approved),
|
||||
is_locked_from_user_modification: i8_to_bool(model.is_locked_from_user_modification),
|
||||
is_locked_from_use: i8_to_bool(model.is_locked_from_use),
|
||||
maybe_mod_comments: model.maybe_mod_comments,
|
||||
maybe_mod_user_token: model.maybe_mod_user_token,
|
||||
maybe_migration_new_model_weights_token: model.maybe_migration_new_model_weights_token,
|
||||
version: model.version,
|
||||
created_at: model.created_at,
|
||||
updated_at: model.updated_at,
|
||||
user_deleted_at: model.user_deleted_at,
|
||||
mod_deleted_at: model.mod_deleted_at,
|
||||
maybe_custom_vocoder_token: model.maybe_custom_vocoder_token,
|
||||
version_string: model.version_string
|
||||
}
|
||||
})
|
||||
.collect::<Vec<WholeTtsModelRecord>>())
|
||||
}
|
||||
|
||||
async fn list_whole_voice_conversion_models(
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
page_size: u64,
|
||||
cursor: u64,
|
||||
) -> AnyhowResult<Vec<RawRecord>> {
|
||||
Ok(sqlx::query_as!(
|
||||
RawRecord,
|
||||
r#"
|
||||
SELECT
|
||||
id,
|
||||
token as `token: tokens::tokens::tts_models::TtsModelToken`,
|
||||
|
||||
tts_model_type as `tts_model_type: enums::by_table::tts_models::tts_model_type::TtsModelType`,
|
||||
|
||||
text_pipeline_type,
|
||||
has_self_contained_vocoder,
|
||||
has_self_contained_duration_model,
|
||||
has_self_contained_pitch_model,
|
||||
text_preprocessing_algorithm,
|
||||
|
||||
use_default_mel_multiply_factor,
|
||||
maybe_custom_mel_multiply_factor,
|
||||
maybe_default_pretrained_vocoder,
|
||||
maybe_custom_vocoder_token as `maybe_custom_vocoder_token: tokens::tokens::vocoder_models::VocoderModelToken`,
|
||||
|
||||
ietf_language_tag,
|
||||
ietf_primary_language_subtag,
|
||||
|
||||
title,
|
||||
description_markdown,
|
||||
description_rendered_html,
|
||||
|
||||
voice_name,
|
||||
actor_name,
|
||||
characteristic,
|
||||
version_string,
|
||||
|
||||
is_front_page_featured,
|
||||
is_twitch_featured,
|
||||
|
||||
maybe_suggested_unique_bot_command,
|
||||
|
||||
original_download_url,
|
||||
original_filename,
|
||||
file_size_bytes,
|
||||
|
||||
creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,
|
||||
|
||||
creator_ip_address_creation,
|
||||
creator_ip_address_last_update,
|
||||
|
||||
creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
|
||||
private_bucket_hash,
|
||||
private_bucket_object_name,
|
||||
|
||||
private_bucket_object_is_archive,
|
||||
|
||||
user_ratings_total_count,
|
||||
user_ratings_positive_count,
|
||||
user_ratings_negative_count,
|
||||
|
||||
is_public_listing_approved,
|
||||
is_locked_from_user_modification,
|
||||
is_locked_from_use,
|
||||
|
||||
maybe_mod_comments,
|
||||
maybe_mod_user_token as `maybe_mod_user_token: tokens::tokens::users::UserToken`,
|
||||
|
||||
maybe_migration_new_model_weights_token as `maybe_migration_new_model_weights_token: tokens::tokens::model_weights::ModelWeightToken`,
|
||||
|
||||
version,
|
||||
|
||||
created_at,
|
||||
updated_at,
|
||||
|
||||
user_deleted_at,
|
||||
mod_deleted_at
|
||||
|
||||
FROM tts_models
|
||||
WHERE
|
||||
id > ?
|
||||
ORDER BY id ASC
|
||||
LIMIT ?
|
||||
"#,
|
||||
cursor,
|
||||
page_size
|
||||
)
|
||||
.fetch_all(&mut **mysql_connection)
|
||||
.await?)
|
||||
}
|
||||
|
||||
struct RawRecord {
|
||||
pub id: i64,
|
||||
pub token: TtsModelToken,
|
||||
|
||||
pub tts_model_type: TtsModelType,
|
||||
pub text_pipeline_type: Option<String>,
|
||||
|
||||
pub has_self_contained_vocoder: i8, // bool
|
||||
pub has_self_contained_duration_model: i8, // bool
|
||||
pub has_self_contained_pitch_model: i8, // bool
|
||||
|
||||
pub text_preprocessing_algorithm: Option<String>,
|
||||
|
||||
pub use_default_mel_multiply_factor: i8, // bool
|
||||
pub maybe_custom_mel_multiply_factor: Option<f64>,
|
||||
|
||||
pub maybe_default_pretrained_vocoder: Option<String>,
|
||||
pub maybe_custom_vocoder_token: Option<VocoderModelToken>,
|
||||
|
||||
pub ietf_language_tag: String,
|
||||
pub ietf_primary_language_subtag: String,
|
||||
|
||||
pub title: String,
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
|
||||
pub voice_name: Option<String>,
|
||||
pub actor_name: Option<String>,
|
||||
pub characteristic: Option<String>,
|
||||
pub version_string: Option<String>,
|
||||
|
||||
pub is_front_page_featured: i8, // bool
|
||||
pub is_twitch_featured: i8, // bool
|
||||
|
||||
pub maybe_suggested_unique_bot_command: Option<String>,
|
||||
|
||||
pub original_download_url: Option<String>,
|
||||
pub original_filename: Option<String>,
|
||||
pub file_size_bytes: i32,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
|
||||
pub creator_ip_address_creation: String,
|
||||
pub creator_ip_address_last_update: String,
|
||||
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub private_bucket_hash: String,
|
||||
pub private_bucket_object_name: String,
|
||||
|
||||
pub private_bucket_object_is_archive: i8, // bool
|
||||
|
||||
pub user_ratings_total_count: u32,
|
||||
pub user_ratings_positive_count: u32,
|
||||
pub user_ratings_negative_count: u32,
|
||||
|
||||
pub is_public_listing_approved: Option<i8>, // bool
|
||||
pub is_locked_from_user_modification: i8, // bool
|
||||
pub is_locked_from_use: i8, // bool
|
||||
|
||||
pub maybe_mod_comments: Option<String>,
|
||||
pub maybe_mod_user_token: Option<UserToken>,
|
||||
|
||||
pub maybe_migration_new_model_weights_token: Option<ModelWeightToken>,
|
||||
|
||||
pub version: i32,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
|
||||
pub user_deleted_at: Option<DateTime<Utc>>,
|
||||
pub mod_deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
pub mod list_whole_tts_models_using_cursor;
|
||||
@@ -9,3 +9,4 @@ pub mod get_tts_model_for_inference_improved;
|
||||
pub mod insert_tts_model_from_download_job;
|
||||
pub mod list_all_tts_model_tokens;
|
||||
pub mod list_tts_models;
|
||||
pub mod migration;
|
||||
Reference in new issue
Block a user