Compare commits

..
Author SHA1 Message Date
Madhukar Mishra 7db70f2491 fixup 2024-01-15 21:13:40 +05:30
Madhukar Mishra 6efc7eb859 fixup 2024-01-15 21:13:40 +05:30
Madhukar Mishra 8b1993a225 fixup 2024-01-15 21:13:40 +05:30
Madhukar Mishra 4748a068d7 add a metric to try otel 2024-01-15 21:13:40 +05:30
Madhukar Mishra b12c972c4c update .gitignore 2024-01-15 21:13:40 +05:30
Madhukar Mishra 00c9ae2543 add otel crate 2024-01-15 21:13:39 +05:30
298 changed files with 994 additions and 14166 deletions
+1 -3
View File
@@ -64,8 +64,6 @@ HIFIGAN_ROOT_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-ml/tts
HIFIGAN_VIRTUAL_ENV_ACTIVATION_COMMAND="source python/bin/activate"
HIFIGAN_MODEL_CHECK_SCRIPT_NAME="vocodes_model_check_hifigan.py"
DOWNLOAD_SCRIPT="/home/tensor/code/storyteller/web-downloader/.venv/bin/python3.11 /home/tensor/code/storyteller/web-downloader/download_internet_file.py"
TTS_INFERENCE_SIDECAR_HOSTNAME=localhost:8000
#TTS_WAVEGLOW_VOCODER_MODEL_FILENAME=waveglow_256channels_universal_v5.pt # THIS SOUNDS HORRID
@@ -78,4 +76,4 @@ TTS_HIFIGAN_SUPERRES_VOCODER_MODEL_FILENAME=hifigan_superres_twilight_33000.pt
# Development key. Permissible to check in.
NEWRELIC_API_KEY=c402be1c4c4216ec83d0cfc0851520cfFFFFNRAL
STORYTELLER_ROOT="/home/tensor/code/storyteller/" # Put this in .env-secrets so that not everyone gets this setting.
#STORYTELLER_ROOT="/home/tensor/code/storyteller/" # Put this in .env-secrets so that not everyone gets this setting.
+1
View File
@@ -17,6 +17,7 @@ production_database_voice_clone_report_download.sh
secrets.toml
secrets.yaml
twitch_secrets.toml
.DS_Store
# Old env secrets
.*-secrets
-1
View File
@@ -26,7 +26,6 @@
<w>hparams</w>
<w>huggingface</w>
<w>lipsync</w>
<w>mocap</w>
<w>mochi</w>
<w>nestedness</w>
<w>pathbuf</w>
@@ -288,7 +288,7 @@
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
@@ -298,7 +298,7 @@
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"flags": "BINARY",
"char_set": 63,
"max_size": 19
}
@@ -308,7 +308,7 @@
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"flags": "BINARY",
"char_set": 63,
"max_size": 19
}
@@ -0,0 +1,12 @@
{
"db_name": "MySQL",
"query": "\nINSERT INTO generic_inference_jobs\nSET\n token = ?,\n uuid_idempotency_token = ?,\n\n inference_category = ?,\n maybe_model_type = ?,\n maybe_model_token = ?,\n\n maybe_input_source_token = ?,\n maybe_input_source_token_type = ?,\n\n maybe_raw_inference_text = ?,\n\n maybe_inference_args = ?,\n\n maybe_creator_user_token = ?,\n maybe_creator_anonymous_visitor_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n\n priority_level = ?,\n is_keepalive_required = ?,\n max_duration_seconds = ?,\n\n is_debug_request = ?,\n maybe_routing_tag = ?,\n\n status = \"pending\"\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 18
},
"nullable": []
},
"hash": "0d780caac7560f84efb50bd2ed876cbdd728b32e26b73dfbb3009ada12985405"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nINSERT INTO model_weights_extension_tts_details\nSET\n model_weights_token = ?,\n ietf_language_tag = ?,\n ietf_primary_language_subtag = ?,\n text_pipeline_type = ?,\n use_default_mel_multiply_factor = ?,\n maybe_custom_mel_multiply_factor = ?,\n maybe_default_pretrained_vocoder = ?,\n maybe_custom_vocoder_token = ?\nON DUPLICATE KEY UPDATE\n ietf_language_tag = ?,\n ietf_primary_language_subtag = ?,\n text_pipeline_type = ?,\n use_default_mel_multiply_factor = ?,\n maybe_custom_mel_multiply_factor = ?,\n maybe_default_pretrained_vocoder = ?,\n maybe_custom_vocoder_token = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 15
},
"nullable": []
},
"hash": "1ce9219b8f05fe54adaa6841acb708e165e1c7855b441b9623a2151197578929"
}
@@ -118,7 +118,7 @@
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
@@ -118,7 +118,7 @@
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
@@ -1,47 +0,0 @@
{
"db_name": "MySQL",
"query": "\n SELECT\n token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n updated_at\n FROM model_weights\n WHERE\n updated_at > ?\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token: tokens::tokens::model_weights::ModelWeightToken",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 1,
"name": "weights_type: enums::by_table::model_weights::weights_types::WeightsType",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 2,
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false
]
},
"hash": "5c67010afd0bb8aa3cd8f6c2407c4c314ace016f816eca51991720a276340d41"
}
@@ -228,7 +228,7 @@
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
@@ -238,7 +238,7 @@
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"flags": "BINARY",
"char_set": 63,
"max_size": 19
}
@@ -248,7 +248,7 @@
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"flags": "BINARY",
"char_set": 63,
"max_size": 19
}
@@ -1,465 +0,0 @@
{
"db_name": "MySQL",
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n\n w_extension.ietf_language_tag as maybe_ietf_language_tag,\n w_extension.ietf_primary_language_subtag as maybe_ietf_primary_language_subtag,\n w_extension.maybe_default_pretrained_vocoder,\n w_extension.text_pipeline_type as maybe_text_pipeline_type,\n w_extension.use_default_mel_multiply_factor,\n w_extension.maybe_custom_mel_multiply_factor,\n\n w_extension.maybe_custom_vocoder_token,\n\n vocoder.vocoder_type as `maybe_custom_vocoder_type: enums::common::vocoder_type::VocoderType`,\n vocoder.title as maybe_custom_vocoder_title,\n vocoder.private_bucket_hash as maybe_custom_vocoder_private_bucket_hash,\n\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n LEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = wt.token\n\n LEFT OUTER JOIN model_weights_extension_tts_details as w_extension\n ON w_extension.model_weights_token = wt.token\n\n LEFT OUTER JOIN vocoder_models AS vocoder\n ON vocoder.token = w_extension.maybe_custom_vocoder_token\n\n WHERE\n wt.token = ?\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token: tokens::tokens::model_weights::ModelWeightToken",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 1,
"name": "title",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 2,
"name": "weights_type: enums::by_table::model_weights::weights_types::WeightsType",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 3,
"name": "weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 4,
"name": "maybe_description_markdown",
"type_info": {
"type": "Blob",
"flags": "BLOB | BINARY",
"char_set": 224,
"max_size": 262140
}
},
{
"ordinal": 5,
"name": "maybe_description_rendered_html",
"type_info": {
"type": "Blob",
"flags": "BLOB | BINARY",
"char_set": 224,
"max_size": 262140
}
},
{
"ordinal": 6,
"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": 7,
"name": "creator_username",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 8,
"name": "creator_display_name",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 9,
"name": "creator_gravatar_hash",
"type_info": {
"type": "String",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 10,
"name": "creator_ip_address",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 160
}
},
{
"ordinal": 11,
"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": 12,
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 13,
"name": "original_download_url",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 2048
}
},
{
"ordinal": 14,
"name": "original_filename",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 15,
"name": "file_size_bytes",
"type_info": {
"type": "Long",
"flags": "NOT_NULL",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 16,
"name": "file_checksum_sha2",
"type_info": {
"type": "String",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 17,
"name": "public_bucket_hash",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 18,
"name": "maybe_public_bucket_prefix",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 19,
"name": "maybe_public_bucket_extension",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 20,
"name": "maybe_cover_image_public_bucket_hash",
"type_info": {
"type": "VarString",
"flags": "BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 21,
"name": "maybe_cover_image_public_bucket_prefix",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 22,
"name": "maybe_cover_image_public_bucket_extension",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 23,
"name": "maybe_ratings_positive_count",
"type_info": {
"type": "Long",
"flags": "UNSIGNED",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 24,
"name": "maybe_ratings_negative_count",
"type_info": {
"type": "Long",
"flags": "UNSIGNED",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 25,
"name": "maybe_bookmark_count",
"type_info": {
"type": "Long",
"flags": "UNSIGNED",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 26,
"name": "maybe_ietf_language_tag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 27,
"name": "maybe_ietf_primary_language_subtag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 48
}
},
{
"ordinal": 28,
"name": "maybe_default_pretrained_vocoder",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 29,
"name": "maybe_text_pipeline_type",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 30,
"name": "use_default_mel_multiply_factor",
"type_info": {
"type": "Tiny",
"flags": "",
"char_set": 63,
"max_size": 1
}
},
{
"ordinal": 31,
"name": "maybe_custom_mel_multiply_factor",
"type_info": {
"type": "Double",
"flags": "",
"char_set": 63,
"max_size": 22
}
},
{
"ordinal": 32,
"name": "maybe_custom_vocoder_token",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 33,
"name": "maybe_custom_vocoder_type: enums::common::vocoder_type::VocoderType",
"type_info": {
"type": "VarString",
"flags": "BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 34,
"name": "maybe_custom_vocoder_title",
"type_info": {
"type": "VarString",
"flags": "BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 35,
"name": "maybe_custom_vocoder_private_bucket_hash",
"type_info": {
"type": "String",
"flags": "MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 36,
"name": "version",
"type_info": {
"type": "Long",
"flags": "NOT_NULL",
"char_set": 63,
"max_size": 11
}
},
{
"ordinal": 37,
"name": "created_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | BINARY | TIMESTAMP",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 38,
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 39,
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 40,
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
true,
true,
false,
false,
false,
false,
false,
false,
true,
true,
true,
false,
false,
false,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
false,
false,
false,
true,
true
]
},
"hash": "6c0a2cb31a3241fc6cd0b6738901a31bd91298f131d3b87744c698e92eaec34b"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\n INSERT INTO media_files\n SET\n token = ?,\n media_type = ?,\n\n origin_category = ?, \n origin_product_category = ?, \n maybe_origin_model_type = ?, \n maybe_origin_model_token = ?, \n maybe_origin_filename = ?,\n\n is_batch_generated = ?, \n\n maybe_mime_type = ?,\n file_size_bytes = ?,\n maybe_duration_millis = ?,\n maybe_audio_encoding = ?, \n maybe_video_encoding = ?, \n maybe_frame_width = ?, \n maybe_frame_height = ?, \n checksum_sha2 = ?,\n\n public_bucket_directory_hash = ?, \n maybe_public_bucket_prefix = ?, \n maybe_public_bucket_extension = ?, \n extra_file_modification_info = ?, \n\n maybe_creator_user_token = ?, \n maybe_creator_anonymous_visitor_token = ?, \n\n creator_ip_address = ?, \n creator_set_visibility = ?, \n\n maybe_creator_file_synthetic_id = ?, \n maybe_creator_category_synthetic_id = ?,\n\n maybe_mod_user_token = ?, \n is_generated_on_prem = ?, \n generated_by_worker = ?, \n generated_by_cluster = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 30
},
"nullable": []
},
"hash": "80900178668fb38ae51dfe19401c1be37f4ef97fda0198f83239507b8000d1ae"
}
@@ -1,91 +0,0 @@
{
"db_name": "MySQL",
"query": "\nSELECT\n m.token as `token: tokens::tokens::media_files::MediaFileToken`,\n\n m.media_type as `media_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n\n m.maybe_creator_user_token as `maybe_creator_user_token: tokens::tokens::users::UserToken`,\n m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n m.public_bucket_directory_hash,\n m.maybe_public_bucket_prefix,\n m.maybe_public_bucket_extension\n\nFROM media_files AS m\nWHERE\n m.token = ?\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token: tokens::tokens::media_files::MediaFileToken",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 1,
"name": "media_type: enums::by_table::media_files::media_file_type::MediaFileType",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 2,
"name": "maybe_creator_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 3,
"name": "creator_set_visibility: enums::common::visibility::Visibility",
"type_info": {
"type": "String",
"flags": "NOT_NULL | BINARY | ENUM",
"char_set": 224,
"max_size": 28
}
},
{
"ordinal": 4,
"name": "public_bucket_directory_hash",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 5,
"name": "maybe_public_bucket_prefix",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 6,
"name": "maybe_public_bucket_extension",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
true,
false,
false,
true,
true
]
},
"hash": "8ba733c63aff16f144417eaa2004d7de479e59f62688016f0ce7b7c61ec1ec57"
}
@@ -1,399 +0,0 @@
{
"db_name": "MySQL",
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n\n w_extension.ietf_language_tag as maybe_ietf_language_tag,\n w_extension.ietf_primary_language_subtag as maybe_ietf_primary_language_subtag,\n w_extension.maybe_default_pretrained_vocoder as `maybe_default_pretrained_vocoder: crate::column_types::vocoder_type::VocoderType`,\n w_extension.text_pipeline_type as maybe_text_pipeline_type,\n\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n LEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = wt.token\n\n LEFT OUTER JOIN model_weights_extension_tts_details as w_extension\n ON w_extension.model_weights_token = wt.token\n\n WHERE\n wt.token = ?\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token: tokens::tokens::model_weights::ModelWeightToken",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 1,
"name": "title",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 2,
"name": "weights_type: enums::by_table::model_weights::weights_types::WeightsType",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 3,
"name": "weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 4,
"name": "maybe_description_markdown",
"type_info": {
"type": "Blob",
"flags": "BLOB | BINARY",
"char_set": 224,
"max_size": 262140
}
},
{
"ordinal": 5,
"name": "maybe_description_rendered_html",
"type_info": {
"type": "Blob",
"flags": "BLOB | BINARY",
"char_set": 224,
"max_size": 262140
}
},
{
"ordinal": 6,
"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": 7,
"name": "creator_username",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 8,
"name": "creator_display_name",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 9,
"name": "creator_gravatar_hash",
"type_info": {
"type": "String",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 10,
"name": "creator_ip_address",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 160
}
},
{
"ordinal": 11,
"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": 12,
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 13,
"name": "original_download_url",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 2048
}
},
{
"ordinal": 14,
"name": "original_filename",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 15,
"name": "file_size_bytes",
"type_info": {
"type": "Long",
"flags": "NOT_NULL",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 16,
"name": "file_checksum_sha2",
"type_info": {
"type": "String",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 17,
"name": "public_bucket_hash",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 18,
"name": "maybe_public_bucket_prefix",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 19,
"name": "maybe_public_bucket_extension",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 20,
"name": "maybe_cover_image_public_bucket_hash",
"type_info": {
"type": "VarString",
"flags": "BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 21,
"name": "maybe_cover_image_public_bucket_prefix",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 22,
"name": "maybe_cover_image_public_bucket_extension",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 23,
"name": "maybe_ratings_positive_count",
"type_info": {
"type": "Long",
"flags": "UNSIGNED",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 24,
"name": "maybe_ratings_negative_count",
"type_info": {
"type": "Long",
"flags": "UNSIGNED",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 25,
"name": "maybe_bookmark_count",
"type_info": {
"type": "Long",
"flags": "UNSIGNED",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 26,
"name": "maybe_ietf_language_tag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 27,
"name": "maybe_ietf_primary_language_subtag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 48
}
},
{
"ordinal": 28,
"name": "maybe_default_pretrained_vocoder: crate::column_types::vocoder_type::VocoderType",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 29,
"name": "maybe_text_pipeline_type",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 30,
"name": "version",
"type_info": {
"type": "Long",
"flags": "NOT_NULL",
"char_set": 63,
"max_size": 11
}
},
{
"ordinal": 31,
"name": "created_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | BINARY | TIMESTAMP",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 32,
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 33,
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 34,
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
true,
true,
false,
false,
false,
false,
false,
false,
true,
true,
true,
false,
false,
false,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
false,
false,
false,
true,
true
]
},
"hash": "8bd7ddec0966c742754a278000902c7d5059237ef312c638817a465dcb1979de"
}
@@ -1,399 +0,0 @@
{
"db_name": "MySQL",
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n\n w_extension.ietf_language_tag as maybe_ietf_language_tag,\n w_extension.ietf_primary_language_subtag as maybe_ietf_primary_language_subtag,\n w_extension.maybe_default_pretrained_vocoder as `maybe_default_pretrained_vocoder: crate::column_types::vocoder_type::VocoderType`,\n w_extension.text_pipeline_type as maybe_text_pipeline_type,\n\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n LEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = wt.token\n\n LEFT OUTER JOIN model_weights_extension_tts_details as w_extension\n ON w_extension.model_weights_token = wt.token\n\n WHERE\n wt.token = ?\n AND wt.user_deleted_at IS NULL\n AND wt.mod_deleted_at IS NULL\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token: tokens::tokens::model_weights::ModelWeightToken",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 1,
"name": "title",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 2,
"name": "weights_type: enums::by_table::model_weights::weights_types::WeightsType",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 3,
"name": "weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 4,
"name": "maybe_description_markdown",
"type_info": {
"type": "Blob",
"flags": "BLOB | BINARY",
"char_set": 224,
"max_size": 262140
}
},
{
"ordinal": 5,
"name": "maybe_description_rendered_html",
"type_info": {
"type": "Blob",
"flags": "BLOB | BINARY",
"char_set": 224,
"max_size": 262140
}
},
{
"ordinal": 6,
"name": "creator_ip_address",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 160
}
},
{
"ordinal": 7,
"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": 8,
"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": 9,
"name": "creator_username",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 10,
"name": "creator_display_name",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 11,
"name": "creator_gravatar_hash",
"type_info": {
"type": "String",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 12,
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 13,
"name": "original_download_url",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 2048
}
},
{
"ordinal": 14,
"name": "original_filename",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 15,
"name": "file_size_bytes",
"type_info": {
"type": "Long",
"flags": "NOT_NULL",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 16,
"name": "file_checksum_sha2",
"type_info": {
"type": "String",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 17,
"name": "public_bucket_hash",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 18,
"name": "maybe_public_bucket_prefix",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 19,
"name": "maybe_public_bucket_extension",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 20,
"name": "maybe_cover_image_public_bucket_hash",
"type_info": {
"type": "VarString",
"flags": "BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 21,
"name": "maybe_cover_image_public_bucket_prefix",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 22,
"name": "maybe_cover_image_public_bucket_extension",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 64
}
},
{
"ordinal": 23,
"name": "maybe_ratings_positive_count",
"type_info": {
"type": "Long",
"flags": "UNSIGNED",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 24,
"name": "maybe_ratings_negative_count",
"type_info": {
"type": "Long",
"flags": "UNSIGNED",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 25,
"name": "maybe_bookmark_count",
"type_info": {
"type": "Long",
"flags": "UNSIGNED",
"char_set": 63,
"max_size": 10
}
},
{
"ordinal": 26,
"name": "maybe_ietf_language_tag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 27,
"name": "maybe_ietf_primary_language_subtag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 48
}
},
{
"ordinal": 28,
"name": "maybe_default_pretrained_vocoder: crate::column_types::vocoder_type::VocoderType",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 29,
"name": "maybe_text_pipeline_type",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 30,
"name": "version",
"type_info": {
"type": "Long",
"flags": "NOT_NULL",
"char_set": 63,
"max_size": 11
}
},
{
"ordinal": 31,
"name": "created_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | BINARY | TIMESTAMP",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 32,
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 33,
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 34,
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
true,
true,
false,
false,
false,
false,
false,
false,
true,
true,
true,
false,
false,
false,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
false,
false,
false,
true,
true
]
},
"hash": "a3cf13dd4272af3b8fbcddba1f1ea711e64f57fb114886d60d4ae2937c56841d"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nUPDATE tts_models\nSET\n maybe_migration_new_model_weights_token = ?\nWHERE token = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 2
},
"nullable": []
},
"hash": "aa7ec1c1e32f773212b264f34173f99db1e515e370c47065f932aaec56f89112"
}
@@ -88,7 +88,7 @@
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
@@ -98,7 +98,7 @@
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"flags": "BINARY",
"char_set": 63,
"max_size": 19
}
@@ -108,7 +108,7 @@
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"flags": "BINARY",
"char_set": 63,
"max_size": 19
}
@@ -1,91 +0,0 @@
{
"db_name": "MySQL",
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n wt.user_deleted_at,\n wt.mod_deleted_at\n\n FROM model_weights as wt\n WHERE\n wt.token = ?\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token: tokens::tokens::model_weights::ModelWeightToken",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 1,
"name": "weights_type: enums::by_table::model_weights::weights_types::WeightsType",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 2,
"name": "weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 3,
"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": 4,
"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": 5,
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 6,
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
true,
true
]
},
"hash": "be70e3bd4a946da7bd66a29a94e659b25f40a33ef5973a8ff34bfabe08db4051"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "INSERT INTO idempotency_tokens SET idempotency_value = ?",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "cfeb095db83dfad895835d509818ecccc6cb9da2b32b5155e5ca29d56d3b7fc0"
}
@@ -1,91 +0,0 @@
{
"db_name": "MySQL",
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n wt.user_deleted_at,\n wt.mod_deleted_at\n\n FROM model_weights as wt\n WHERE\n wt.token = ?\n AND wt.user_deleted_at IS NULL\n AND wt.mod_deleted_at IS NULL\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token: tokens::tokens::model_weights::ModelWeightToken",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 1,
"name": "weights_type: enums::by_table::model_weights::weights_types::WeightsType",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 2,
"name": "weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 3,
"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": 4,
"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": 5,
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 6,
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 63,
"max_size": 19
}
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
true,
true
]
},
"hash": "d243270734f48fce2f5072ddbde224abf24858c6484995949c98382aa58840a7"
}
@@ -288,7 +288,7 @@
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
@@ -298,7 +298,7 @@
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"flags": "BINARY",
"char_set": 63,
"max_size": 19
}
@@ -308,7 +308,7 @@
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
"flags": "MULTIPLE_KEY | BINARY",
"flags": "BINARY",
"char_set": 63,
"max_size": 19
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nINSERT INTO generic_inference_jobs\nSET\n token = ?,\n uuid_idempotency_token = ?,\n\n job_type = ?,\n\n inference_category = ?,\n maybe_model_type = ?,\n maybe_model_token = ?,\n\n maybe_input_source_token = ?,\n maybe_input_source_token_type = ?,\n\n maybe_raw_inference_text = ?,\n\n maybe_inference_args = ?,\n\n maybe_creator_user_token = ?,\n maybe_creator_anonymous_visitor_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n\n priority_level = ?,\n is_keepalive_required = ?,\n max_duration_seconds = ?,\n\n is_debug_request = ?,\n maybe_routing_tag = ?,\n\n status = \"pending\"\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 19
},
"nullable": []
},
"hash": "e97a0974ed643b8a20d4d319b4aa93aba979d5f8fc0bdc44b77ef4f945b03b35"
}
Generated
+21 -117
View File
@@ -1259,24 +1259,6 @@ dependencies = [
"my-workspace-hack",
]
[[package]]
name = "composite_identifiers"
version = "0.0.1"
dependencies = [
"enums",
"my-workspace-hack",
"serde",
"serde_derive",
"serde_json",
"sqlx",
"sqlx-core",
"sqlx-mysql",
"strum",
"tokens",
"toml 0.5.11",
"utoipa",
]
[[package]]
name = "concurrency"
version = "0.0.1"
@@ -2149,7 +2131,6 @@ dependencies = [
"errors",
"log",
"my-workspace-hack",
"regex",
"serde",
"serde_json",
"tokens",
@@ -2292,50 +2273,6 @@ dependencies = [
"my-workspace-hack",
]
[[package]]
name = "es-update-job"
version = "0.0.1"
dependencies = [
"actix_helpers",
"anyhow",
"bootstrap",
"chrono",
"concurrency",
"config",
"container_common",
"dotenv",
"easyenv",
"elasticsearch",
"elasticsearch_schema",
"enums",
"errors",
"filesys",
"hashing",
"hostname",
"jobs_common",
"log",
"media",
"memory_caching",
"mimetypes",
"my-workspace-hack",
"mysql_queries",
"once_cell",
"rand 0.8.5",
"redis_common",
"reusable_types",
"serde",
"serde_derive",
"serde_json",
"server_environment",
"sqlx",
"storyteller_root",
"subprocess",
"subprocess_common",
"testing",
"tokens",
"tokio",
]
[[package]]
name = "etcetera"
version = "0.8.0"
@@ -3115,7 +3052,6 @@ dependencies = [
"chrono",
"cloud_storage",
"collections",
"composite_identifiers",
"concurrency",
"config",
"dotenv",
@@ -3123,13 +3059,11 @@ dependencies = [
"enums",
"errors",
"filesys",
"google_drive_common",
"hashing",
"hostname",
"hyper",
"images",
"jobs_common",
"jsonpath_lib",
"lfu",
"log",
"media",
@@ -3140,10 +3074,10 @@ dependencies = [
"my-workspace-hack",
"mysql_queries",
"once_cell",
"opentelemetry",
"r2d2_redis",
"rand 0.8.5",
"redis_common",
"reqwest",
"serde",
"serde_derive",
"serde_json",
@@ -3155,7 +3089,6 @@ dependencies = [
"tokens",
"tokio",
"tts_common",
"walkdir",
]
[[package]]
@@ -3273,17 +3206,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "jsonpath_lib"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eaa63191d68230cccb81c5aa23abd53ed64d83337cacbb25a7b8c7979523774f"
dependencies = [
"log",
"serde",
"serde_json",
]
[[package]]
name = "jwt"
version = "0.13.0"
@@ -3678,7 +3600,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"serial_test 2.0.0",
"serial_test",
"sqlx",
"tokens",
"tokio",
@@ -3936,7 +3858,6 @@ dependencies = [
"anyhow",
"buckets",
"chrono",
"composite_identifiers",
"config",
"container_common",
"dotenv",
@@ -3951,7 +3872,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"serial_test 2.0.0",
"serial_test",
"sqlx",
"tokens",
"tokio",
@@ -4241,6 +4162,22 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "opentelemetry"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a"
dependencies = [
"futures-core",
"futures-sink",
"indexmap",
"js-sys",
"once_cell",
"pin-project-lite",
"thiserror",
"urlencoding",
]
[[package]]
name = "ordered-multimap"
version = "0.4.3"
@@ -5460,7 +5397,6 @@ version = "1.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
dependencies = [
"indexmap",
"itoa 1.0.9",
"ryu",
"serde",
@@ -5572,21 +5508,7 @@ dependencies = [
"lazy_static",
"log",
"parking_lot 0.12.1",
"serial_test_derive 2.0.0",
]
[[package]]
name = "serial_test"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "953ad9342b3aaca7cb43c45c097dd008d4907070394bd0751a0aa8817e5a018d"
dependencies = [
"dashmap",
"futures 0.3.29",
"lazy_static",
"log",
"parking_lot 0.12.1",
"serial_test_derive 3.0.0",
"serial_test_derive",
]
[[package]]
@@ -5600,17 +5522,6 @@ dependencies = [
"syn 2.0.39",
]
[[package]]
name = "serial_test_derive"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b93fb4adc70021ac1b47f7d45e8cc4169baaa7ea58483bc5b721d19a26202212"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
]
[[package]]
name = "server_environment"
version = "0.0.1"
@@ -6112,7 +6023,6 @@ dependencies = [
"buckets",
"chrono",
"cloud_storage",
"composite_identifiers",
"config",
"container_common",
"cookies",
@@ -6175,7 +6085,6 @@ dependencies = [
"sha2 0.9.9",
"speculoos",
"sqlx",
"strum",
"symphonia",
"time 0.3.30",
"tokens",
@@ -6198,7 +6107,7 @@ name = "storyteller_root"
version = "0.0.1"
dependencies = [
"my-workspace-hack",
"serial_test 2.0.0",
"serial_test",
"tempdir",
]
@@ -6281,12 +6190,7 @@ dependencies = [
name = "subprocess_common"
version = "0.0.1"
dependencies = [
"errors",
"filesys",
"log",
"my-workspace-hack",
"serial_test 3.0.0",
"subprocess",
]
[[package]]
-2
View File
@@ -5,7 +5,6 @@ members = [
# Types: common strongly-typed tokens, ids, payloads, etc.
# Also common cloud buckets and other "strongly typed" configs.
"crates/_types/buckets",
"crates/_types/composite_identifiers",
"crates/_types/enums",
"crates/_types/reusable_types", # TODO(bt, 2022-12-21): Deprecate
"crates/_types/tokens",
@@ -73,7 +72,6 @@ members = [
"crates/service/job/analytics_job",
"crates/service/job/download_job",
"crates/service/job/email_sender_job",
"crates/service/job/es-update-job",
"crates/service/job/inference_job",
"crates/service/job/tts_download_job",
"crates/service/job/tts_inference_job",
+2 -5
View File
@@ -18,9 +18,6 @@ deny = [
"clippy::borrow_as_ptr",
"clippy::borrow_deref_ref",
# Clippy async
"clippy::await_holding_lock",
# Clippy - performance
"clippy::cmp_owned",
"clippy::useless_vec",
@@ -46,12 +43,12 @@ deny = [
"unused_imports", # These are easy to automatically cull
"unused_parens", # Unused parens are ugly
"unused_variables", # Don't leave cruft
"unused_mut", # Be strict about mutability
#"unused_mut", # Be strict about mutability (TODO)
# Possible:
# "clippy::ptr_arg",
# "clippy::too_many_lines" (note: this is configurable)
# "clippy::clone_on_copy", # Don't use clone() on Copy types
]
warn = [
-13
View File
@@ -1,13 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
update model_weights
set
mod_deleted_at = NOW()
where token IN (
'weight_tnhacmxb9qwqrygc3pxvk3ds6',
'weight_9g1pghkc0xhfy5n9m36b11vds',
'weight_5k0kzkftr4x39xyc9yg5p9c86'
);
+1 -2
View File
@@ -375,8 +375,7 @@ where token IN (
'vcm_a47wtfbsjrfc',
'vcm_kygenhbg5mgj',
'vcm_s8gndv19yt7p',
'vcm_ny9pj57w5eyh',
'vcm_jg4rst3j2d7x'
'vcm_ny9pj57w5eyh'
);
@@ -1,21 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- Inventory non-deleted
select
m.id,
m.token,
SUBSTRING(m.title, 1, 35) as title,
u.username,
SUBSTRING(m.original_download_url, 1, 35) as url,
m.updated_at
from model_weights as m
left join users AS u on
u.token = m.creator_user_token
where
m.user_deleted_at IS NULL
and m.mod_deleted_at IS NULL
order by m.title asc;
-14
View File
@@ -2,20 +2,6 @@
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- Find jobs that are broken for a given user
select id, last_assigned_worker, internal_debugging_failure_reason,created_at
from tts_inference_jobs
where maybe_creator_user_token IN (
select token
from users
where username IN ('knifecat ', 'rewritten_code', 'johnloberger')
)
and attempt_count > 1
and status IN ('complete_failure', 'dead', 'attempt_failed')
and created_at > ( CURDATE() - INTERVAL 5 DAY );
-- Total pending jobs
select count(*)
from tts_inference_jobs
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
drop table idempotency_tokens;
@@ -1,19 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- A form of optimistic locking
CREATE TABLE idempotency_tokens (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- This can be a UUID or any entropic value.
idempotency_value VARCHAR(36) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (idempotency_value)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
drop table batch_generations;
@@ -1,42 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- Batch generations
CREATE TABLE batch_generations (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- The batch token
-- This is **NOT** a unique token.
token VARCHAR(32) NOT NULL,
-- ========== ENTITY LINKAGE ==========
-- The type of record this is attached to
-- Currently supported values:
-- * 'model_weight'
-- * 'media_file'
-- * 'comment'
entity_type VARCHAR(32) NOT NULL,
-- The token for the record.
entity_token VARCHAR(32) NOT NULL,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token, entity_type, entity_token),
KEY index_token (token),
KEY index_entity_token (entity_token)
-- NB: Realistically, we probably don't need this index until we have a lot of entity types, and the entity_token
-- entropy is probably sufficient enough as-is.
-- KEY index_entity_type_and_token (entity_type, entity_token),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE media_files DROP COLUMN is_batch_generated;
@@ -1,7 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE media_files
ADD COLUMN is_batch_generated BOOLEAN NOT NULL DEFAULT FALSE
AFTER maybe_origin_filename;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE generic_inference_jobs DROP COLUMN job_type;
@@ -1,10 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE generic_inference_jobs
ADD COLUMN job_type VARCHAR(32) DEFAULT NULL
AFTER uuid_idempotency_token;
ALTER TABLE generic_inference_jobs
ADD INDEX index_job_type (job_type);
@@ -1,7 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP INDEX index_updated_at ON model_weights;
DROP INDEX index_user_deleted_at ON model_weights;
DROP INDEX index_mod_deleted_at ON model_weights;
@@ -1,7 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
CREATE INDEX index_updated_at ON model_weights (updated_at);
CREATE INDEX index_user_deleted_at ON model_weights (user_deleted_at);
CREATE INDEX index_mod_deleted_at ON model_weights (mod_deleted_at);
@@ -1,42 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- Batch generations
CREATE TABLE batch_generations (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- The batch token
-- This is **NOT** a unique token.
token VARCHAR(32) NOT NULL,
-- ========== ENTITY LINKAGE ==========
-- The type of record this is attached to
-- Currently supported values:
-- * 'model_weight'
-- * 'media_file'
-- * 'comment'
entity_type VARCHAR(32) NOT NULL,
-- The token for the record.
entity_token VARCHAR(32) NOT NULL,
-- ========== TIMESTAMPS ==========
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token, entity_type, entity_token),
KEY index_token (token),
KEY index_entity_token (entity_token)
-- NB: Realistically, we probably don't need this index until we have a lot of entity types, and the entity_token
-- entropy is probably sufficient enough as-is.
-- KEY index_entity_type_and_token (entity_type, entity_token),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -17,27 +17,12 @@ CREATE TABLE generic_inference_jobs (
-- ========== INFERENCE DETAILS ==========
-- The new enum for the type of job, which will eventually replace `inference_category` and `maybe_model_type`.
-- This isn't fully supported yet in the inference-job, but we'll start populating it and adding logic around it.
-- We'll start this out as nullable, then migrate the old rows with a default column value.
job_type VARCHAR(32) DEFAULT NULL,
-- NB: This is becoming a problematic field and is becoming conflated with `maybe_model_type`.
-- We're using this to handle job dispatching, but the latter is being used to load container
-- dependencies at startup (even if it isn't a real model type or a polymorphic foreign key).
-- This is pretty gross and horrible.
--
-- Broad category of inference
-- Examples (may not be up to date):
-- * text_to_speech
-- * voice_conversion
inference_category VARCHAR(32) NOT NULL,
-- NB: See notes on inference_category. This is becoming a problematic field. We're using
-- this to load the container spin-up arguments and dependencies, but the former is being
-- used to dispatch the job. `inference_category` is the one that should probably go away,
-- and this column should be renamed to `inference_job_type`.
--
-- Potential part of the composite foreign key to the primary model being used, if any.
-- This will normally live in `maybe_inference_args`, but in this case, it's useful for
-- running easy database analytical queries.
@@ -254,7 +239,6 @@ CREATE TABLE generic_inference_jobs (
PRIMARY KEY (id),
UNIQUE KEY (token),
UNIQUE KEY (uuid_idempotency_token),
KEY index_job_type (job_type),
KEY index_inference_category (inference_category),
KEY index_maybe_model_type_and_maybe_model_token (maybe_model_type, maybe_model_token),
KEY index_maybe_model_type (maybe_model_type),
@@ -1,19 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- A form of optimistic locking
CREATE TABLE idempotency_tokens (
-- Not used for anything except replication.
id BIGINT(20) NOT NULL AUTO_INCREMENT,
-- This can be a UUID or any entropic value.
idempotency_value VARCHAR(36) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (idempotency_value)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-5
View File
@@ -58,11 +58,6 @@ CREATE TABLE media_files (
-- The original filename of the media (if uploaded by a user)
maybe_origin_filename VARCHAR(255) DEFAULT NULL,
-- Whether this media file was generated as part of a batch
-- If so, we can look up the batch in a separate query/call to the `batch_generations` table.
-- We won't hold the batch token in this table since it'll be very sparsely populated.
is_batch_generated BOOLEAN NOT NULL DEFAULT FALSE,
-- ========== METADATA ==========
-- We can store text transcripts, etc. in other tables and refer back via foreign key.
@@ -95,7 +95,6 @@ CREATE TABLE model_weights (
-- The filename that was used at upload time (if available)
original_filename VARCHAR(255) DEFAULT NULL,
-- TODO: Make this a BIGINT so we can store more than 2GB.
-- File characteristics
file_size_bytes INT(10) NOT NULL DEFAULT 0,
@@ -166,15 +165,11 @@ CREATE TABLE model_weights (
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
UNIQUE KEY unique_index_maybe_migration_old_model_token (maybe_migration_old_model_token),
KEY index_weights_type (weights_type),
KEY index_weights_category (weights_category),
KEY fk_creator_user_token (creator_user_token),
KEY index_creator_set_visibility (creator_set_visibility),
KEY fk_maybe_cover_media_file_token (maybe_cover_image_media_file_token),
KEY index_updated_at (updated_at),
KEY index_user_deleted_at (user_deleted_at),
KEY index_mod_deleted_at (user_deleted_at)
KEY fk_maybe_cover_media_file_token (maybe_cover_image_media_file_token)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -43,7 +43,6 @@ CREATE TABLE tts_models (
has_self_contained_pitch_model BOOLEAN NOT NULL DEFAULT FALSE,
-- NB(2022-07-05): THIS IS NOW MEANINGLESS AND SUPERSEDED BY `TEXT_PIPELINE_TYPE`.
-- NB(2024-01-20): All 8720 records in the database are "basic".
-- NB: DO NOT CHANGE ORDER; APPEND ONLY!
-- How text should be handled.
text_preprocessing_algorithm ENUM(
@@ -26,14 +26,12 @@ impl ModelCategory {
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum ModelType {
VallEx,
StyleTTS2,
}
impl ModelType {
pub fn to_str(&self) -> &'static str {
match self {
ModelType::VallEx => "vallex",
ModelType::StyleTTS2 => "styletts2",
}
}
}
@@ -73,14 +73,6 @@ impl MediaFileBucketPath {
pub fn get_basename(&self) -> &str {
&self.filename
}
pub fn get_optional_prefix(&self) -> Option<&str> {
self.optional_prefix.as_deref()
}
pub fn get_optional_extension(&self) -> Option<&str> {
self.optional_extension.as_deref()
}
}
#[cfg(test)]
@@ -12,7 +12,6 @@ const ORIGINAL_FILE_BASENAME : &str = "original_upload.bin";
/// The original user upload file.
/// It may have derivative files (down samples, crops, etc.) that live alongside it.
#[derive(Clone)]
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
pub struct MediaUploadOriginalFilePath {
directory: MediaUploadDirectory,
full_object_path: String,
@@ -22,13 +21,11 @@ impl PublicPath for MediaUploadOriginalFilePath {}
impl MediaUploadOriginalFilePath {
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
pub fn generate_new() -> Self {
let entropy = crockford_entropy_lower(32);
Self::from_object_hash(&entropy)
}
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
pub fn from_object_hash(hash: &str) -> Self {
// TODO: Path construction could be cleaner.
let directory = MediaUploadDirectory::from_object_hash(hash);
@@ -39,27 +36,22 @@ impl MediaUploadOriginalFilePath {
}
}
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
pub fn get_full_object_path_str(&self) -> &str {
&self.full_object_path
}
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
pub fn to_full_object_pathbuf(&self) -> PathBuf {
PathBuf::from(&self.full_object_path)
}
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
pub fn get_directory(&self) -> &MediaUploadDirectory {
&self.directory
}
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
pub fn get_object_hash(&self) -> &str {
&self.directory.get_object_hash()
}
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
pub fn get_basename() -> &'static str {
ORIGINAL_FILE_BASENAME
}
@@ -25,11 +25,6 @@ impl PublicPath for WeightFileBucketPath {}
impl WeightFileBucketPath {
// TODO(bt,2024-01-14): This is temporary standardization. Clean this up.
pub fn generate_for_tt2_model() -> Self {
Self::generate_new(Some("tt2_"), Some(".pt"))
}
// TODO(bt,2023-12-19): This is temporary standardization. Clean this up.
pub fn generate_for_svc_model() -> Self {
Self::generate_new(Some("svc_"), Some(".pt"))
@@ -40,11 +35,6 @@ impl WeightFileBucketPath {
Self::generate_new(Some("rvc_"), Some(".pt"))
}
// TODO(bt,2024-01-15): This is temporary standardization. Clean this up.
pub fn tt2_model_file_from_object_hash(hash: &str) -> Self {
Self::from_object_hash(hash, Some("tt2_"), Some(".pt"))
}
// TODO(bt,2023-12-19): This is temporary standardization. Clean this up.
pub fn svc_model_file_from_object_hash(hash: &str) -> Self {
Self::from_object_hash(hash, Some("svc_"), Some(".pt"))
@@ -1,40 +0,0 @@
[package]
name = "composite_identifiers"
edition = "2018"
version = "0.0.1"
authors = [
"Brandon Thomas <bt@brand.io>",
"Brandon Thomas <echelon@gmail.com>",
]
publish = false
[lib]
name = "composite_identifiers"
path = "src/lib.rs"
[dependencies]
# Internal
enums = { path = "../enums" }
tokens = { path = "../tokens" }
# Workspace hack (faster compile times)
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
# Serialization
serde = "1.0.125"
serde_derive = "1.0.125"
sqlx = { version = "0.7.2", features = [ "mysql", "sqlite", "runtime-tokio-native-tls", "chrono" ] }
sqlx-core = { version = "0.7.2" }
sqlx-mysql= { version = "0.7.2" }
utoipa = { version = "4", features = ["chrono","actix_extras"] }
[dev-dependencies]
# Enum utilities
strum = { version = "0.25", features = ["derive"] }
# Test serialization
serde_json = "1.0.108"
toml = "0.5.8"
@@ -1,28 +0,0 @@
use enums::by_table::batch_generations::batch_generation_entity_type::BatchGenerationEntityType;
use tokens::tokens::media_files::MediaFileToken;
// TODO(bt, 2024-01-16): A ref type with <'a> lifetime of inner data instead of ownership?
pub enum BatchGenerationEntity {
MediaFile(MediaFileToken),
}
// TODO(bt, 2024-01-16): Codegen? Make traits for these? Maybe overkill.
impl BatchGenerationEntity {
pub fn get_entity_type(&self) -> BatchGenerationEntityType {
match self {
Self::MediaFile(_) => BatchGenerationEntityType::MediaFile,
}
}
pub fn get_entity_token_str(&self) -> &str {
match self {
Self::MediaFile(token) => token.as_str(),
}
}
pub fn get_composite_keys(&self) -> (BatchGenerationEntityType, &str) {
match self {
Self::MediaFile(token) => (BatchGenerationEntityType::MediaFile, token.as_str()),
}
}
}
@@ -1 +0,0 @@
pub mod batch_generation_entity;
@@ -1 +0,0 @@
pub mod batch_generations;
@@ -1,22 +0,0 @@
//! composite_identifiers
//!
//! The purpose of this library is to provide easy to construct, **typesafe**, composite identifiers.
//! This is mostly a combination of `tokens` and `enums`.
//!
// Never allow these
#![forbid(private_bounds)]
#![forbid(private_interfaces)]
#![forbid(unused_must_use)] // NB: It's unsafe to not close/check some things
// Okay to toggle
#![forbid(unreachable_patterns)]
#![forbid(unused_imports)]
#![forbid(unused_mut)]
#![forbid(unused_variables)]
// Always allow
#![allow(dead_code)]
#![allow(non_snake_case)]
pub mod by_table;
@@ -1,109 +0,0 @@
use std::collections::BTreeSet;
use serde::Deserialize;
use serde::Serialize;
#[cfg(test)]
use strum::EnumCount;
#[cfg(test)]
use strum::EnumIter;
use utoipa::ToSchema;
/// Used in the `batch_generations` table in a `VARCHAR(32)` field named `entity_type`.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
#[derive(Clone, Copy, Eq, PartialEq, Hash, Deserialize, Serialize, Ord, PartialOrd, ToSchema)]
pub enum BatchGenerationEntityType {
/// Media files
/// This will probably be the only type supported, but we'll leave the possibility of future types.
#[serde(rename = "media_file")]
MediaFile,
}
// TODO(bt, 2023-01-17): This desperately needs MySQL integration tests!
impl_enum_display_and_debug_using_to_str!(BatchGenerationEntityType);
impl_mysql_enum_coders!(BatchGenerationEntityType);
impl_mysql_from_row!(BatchGenerationEntityType);
/// NB: Legacy API for older code.
impl BatchGenerationEntityType {
pub fn to_str(&self) -> &'static str {
match self {
Self::MediaFile => "media_file",
}
}
pub fn from_str(value: &str) -> Result<Self, String> {
match value {
"media_file" => Ok(Self::MediaFile),
_ => Err(format!("invalid value: {:?}", value)),
}
}
pub fn all_variants() -> BTreeSet<Self> {
// NB: BTreeSet is sorted
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
BTreeSet::from([
Self::MediaFile,
])
}
}
#[cfg(test)]
mod tests {
use crate::by_table::batch_generations::batch_generation_entity_type::BatchGenerationEntityType;
use crate::test_helpers::assert_serialization;
mod serde {
use super::*;
#[test]
fn test_serialization() {
assert_serialization(BatchGenerationEntityType::MediaFile, "media_file");
}
}
mod impl_methods {
use super::*;
#[test]
fn to_str() {
assert_eq!(BatchGenerationEntityType::MediaFile.to_str(), "media_file");
}
#[test]
fn from_str() {
assert_eq!(BatchGenerationEntityType::from_str("media_file").unwrap(), BatchGenerationEntityType::MediaFile);
assert!(BatchGenerationEntityType::from_str("foo").is_err());
}
}
mod manual_variant_checks {
use super::*;
#[test]
fn all_variants() {
let mut variants = BatchGenerationEntityType::all_variants();
assert_eq!(variants.len(), 1);
assert_eq!(variants.pop_first(), Some(BatchGenerationEntityType::MediaFile));
assert_eq!(variants.pop_first(), None);
}
}
mod mechanical_checks {
use super::*;
#[test]
fn variant_length() {
use strum::IntoEnumIterator;
assert_eq!(BatchGenerationEntityType::all_variants().len(), BatchGenerationEntityType::iter().len());
}
#[test]
fn round_trip() {
for variant in BatchGenerationEntityType::all_variants() {
assert_eq!(variant, BatchGenerationEntityType::from_str(variant.to_str()).unwrap());
assert_eq!(variant, BatchGenerationEntityType::from_str(&format!("{}", variant)).unwrap());
assert_eq!(variant, BatchGenerationEntityType::from_str(&format!("{:?}", variant)).unwrap());
}
}
}
}
@@ -1 +0,0 @@
pub mod batch_generation_entity_type;
@@ -18,7 +18,7 @@ use strum::EnumIter;
/// Another benefit is that we'll surface all of the various types of failure and perhaps eventually
/// come to handle some in a cross-cutting way.
///
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
pub enum FrontendFailureCategory {
@@ -11,7 +11,7 @@ use strum::EnumIter;
/// Each "category" of inference is identified by the following enum variants.
/// These types are present in the HTTP API and database columns as serialized here.
///
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize, Default)]
pub enum InferenceCategory {
@@ -29,17 +29,8 @@ pub enum InferenceCategory {
#[serde(rename = "video_filter")]
VideoFilter,
#[serde(rename = "image_generation")]
ImageGeneration,
#[serde(rename = "mocap")]
Mocap,
#[serde(rename = "workflow")]
Workflow,
#[serde(rename = "format_conversion")]
FormatConversion,
}
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
@@ -54,10 +45,7 @@ impl InferenceCategory {
Self::TextToSpeech => "text_to_speech",
Self::VoiceConversion => "voice_conversion",
Self::VideoFilter => "video_filter",
Self::ImageGeneration => "image_generation",
Self::Mocap => "mocap",
Self::Workflow => "workflow",
Self::FormatConversion => "format_conversion",
}
}
@@ -67,10 +55,7 @@ impl InferenceCategory {
"text_to_speech" => Ok(Self::TextToSpeech),
"voice_conversion" => Ok(Self::VoiceConversion),
"video_filter" => Ok(Self::VideoFilter),
"image_generation" => Ok(Self::ImageGeneration),
"mocap" => Ok(Self::Mocap),
"workflow" => Ok(Self::Workflow),
"format_conversion" => Ok(Self::FormatConversion),
_ => Err(format!("invalid value: {:?}", value)),
}
}
@@ -83,10 +68,7 @@ impl InferenceCategory {
Self::TextToSpeech,
Self::VoiceConversion,
Self::VideoFilter,
Self::ImageGeneration,
Self::Mocap,
Self::Workflow,
Self::FormatConversion,
])
}
}
@@ -96,92 +78,47 @@ mod tests {
use crate::by_table::generic_inference_jobs::inference_category::InferenceCategory;
use crate::test_helpers::assert_serialization;
mod explicit_checks {
use super::*;
#[test]
fn test_serialization() {
assert_serialization(InferenceCategory::LipsyncAnimation, "lipsync_animation");
assert_serialization(InferenceCategory::TextToSpeech, "text_to_speech");
assert_serialization(InferenceCategory::VoiceConversion, "voice_conversion");
assert_serialization(InferenceCategory::VideoFilter, "video_filter");
assert_serialization(InferenceCategory::ImageGeneration, "image_generation");
assert_serialization(InferenceCategory::Mocap, "mocap");
assert_serialization(InferenceCategory::Workflow, "workflow");
assert_serialization(InferenceCategory::FormatConversion, "format_conversion");
}
#[test]
fn to_str() {
assert_eq!(InferenceCategory::LipsyncAnimation.to_str(), "lipsync_animation");
assert_eq!(InferenceCategory::TextToSpeech.to_str(), "text_to_speech");
assert_eq!(InferenceCategory::VoiceConversion.to_str(), "voice_conversion");
assert_eq!(InferenceCategory::VideoFilter.to_str(), "video_filter");
assert_eq!(InferenceCategory::ImageGeneration.to_str(), "image_generation");
assert_eq!(InferenceCategory::Mocap.to_str(), "mocap");
assert_eq!(InferenceCategory::Workflow.to_str(), "workflow");
assert_eq!(InferenceCategory::FormatConversion.to_str(), "format_conversion");
}
#[test]
fn from_str() {
assert_eq!(InferenceCategory::from_str("lipsync_animation").unwrap(), InferenceCategory::LipsyncAnimation);
assert_eq!(InferenceCategory::from_str("text_to_speech").unwrap(), InferenceCategory::TextToSpeech);
assert_eq!(InferenceCategory::from_str("voice_conversion").unwrap(), InferenceCategory::VoiceConversion);
assert_eq!(InferenceCategory::from_str("video_filter").unwrap(), InferenceCategory::VideoFilter);
assert_eq!(InferenceCategory::from_str("image_generation").unwrap(), InferenceCategory::ImageGeneration);
assert_eq!(InferenceCategory::from_str("mocap").unwrap(), InferenceCategory::Mocap);
assert_eq!(InferenceCategory::from_str("workflow").unwrap(), InferenceCategory::Workflow);
assert_eq!(InferenceCategory::from_str("format_conversion").unwrap(), InferenceCategory::FormatConversion);
}
#[test]
fn all_variants() {
// Static check
let mut variants = InferenceCategory::all_variants();
assert_eq!(variants.len(), 8);
assert_eq!(variants.pop_first(), Some(InferenceCategory::LipsyncAnimation));
assert_eq!(variants.pop_first(), Some(InferenceCategory::TextToSpeech));
assert_eq!(variants.pop_first(), Some(InferenceCategory::VoiceConversion));
assert_eq!(variants.pop_first(), Some(InferenceCategory::VideoFilter));
assert_eq!(variants.pop_first(), Some(InferenceCategory::ImageGeneration));
assert_eq!(variants.pop_first(), Some(InferenceCategory::Mocap));
assert_eq!(variants.pop_first(), Some(InferenceCategory::Workflow));
assert_eq!(variants.pop_first(), Some(InferenceCategory::FormatConversion));
assert_eq!(variants.pop_first(), None);
// Generated check
use strum::IntoEnumIterator;
assert_eq!(InferenceCategory::all_variants().len(), InferenceCategory::iter().len());
}
#[test]
fn test_serialization() {
assert_serialization(InferenceCategory::LipsyncAnimation, "lipsync_animation");
assert_serialization(InferenceCategory::TextToSpeech, "text_to_speech");
assert_serialization(InferenceCategory::VoiceConversion, "voice_conversion");
assert_serialization(InferenceCategory::VideoFilter, "video_filter");
assert_serialization(InferenceCategory::Mocap, "mocap")
}
mod mechanical_checks {
use super::*;
#[test]
fn to_str() {
assert_eq!(InferenceCategory::LipsyncAnimation.to_str(), "lipsync_animation");
assert_eq!(InferenceCategory::TextToSpeech.to_str(), "text_to_speech");
assert_eq!(InferenceCategory::VoiceConversion.to_str(), "voice_conversion");
assert_eq!(InferenceCategory::VideoFilter.to_str(), "video_filter");
assert_eq!(InferenceCategory::Mocap.to_str(), "mocap");
}
#[test]
fn variant_length() {
use strum::IntoEnumIterator;
assert_eq!(InferenceCategory::all_variants().len(), InferenceCategory::iter().len());
}
#[test]
fn from_str() {
assert_eq!(InferenceCategory::from_str("lipsync_animation").unwrap(), InferenceCategory::LipsyncAnimation);
assert_eq!(InferenceCategory::from_str("text_to_speech").unwrap(), InferenceCategory::TextToSpeech);
assert_eq!(InferenceCategory::from_str("voice_conversion").unwrap(), InferenceCategory::VoiceConversion);
assert_eq!(InferenceCategory::from_str("video_filter").unwrap(), InferenceCategory::VideoFilter);
assert_eq!(InferenceCategory::from_str("mocap").unwrap(), InferenceCategory::Mocap);
}
#[test]
fn round_trip() {
for variant in InferenceCategory::all_variants() {
assert_eq!(variant, InferenceCategory::from_str(variant.to_str()).unwrap());
assert_eq!(variant, InferenceCategory::from_str(&format!("{}", variant)).unwrap());
assert_eq!(variant, InferenceCategory::from_str(&format!("{:?}", variant)).unwrap());
}
}
#[test]
fn all_variants() {
// Static check
let mut variants = InferenceCategory::all_variants();
assert_eq!(variants.len(), 5);
assert_eq!(variants.pop_first(), Some(InferenceCategory::LipsyncAnimation));
assert_eq!(variants.pop_first(), Some(InferenceCategory::TextToSpeech));
assert_eq!(variants.pop_first(), Some(InferenceCategory::VoiceConversion));
assert_eq!(variants.pop_first(), Some(InferenceCategory::VideoFilter));
assert_eq!(variants.pop_first(), Some(InferenceCategory::Mocap));
assert_eq!(variants.pop_first(), None);
#[test]
fn serialized_length_ok_for_database() {
const MAX_LENGTH : usize = 32;
for variant in InferenceCategory::all_variants() {
let serialized = variant.to_str();
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
}
}
// Generated check
use strum::IntoEnumIterator;
assert_eq!(InferenceCategory::all_variants().len(), InferenceCategory::iter().len());
}
}
@@ -7,7 +7,7 @@ use strum::EnumIter;
/// Used in the `generic_inference_jobs` table in `VARCHAR(32)` field `maybe_input_source_token`.
///
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
pub enum InferenceInputSourceTokenType {
@@ -1,227 +0,0 @@
use std::collections::BTreeSet;
#[cfg(test)]
use strum::EnumCount;
#[cfg(test)]
use strum::EnumIter;
/// Used in the `generic_inference_jobs` table in `VARCHAR(32)` field `job_type`.
///
/// TODO(bt,2024-02-01): This will replace "inference_category" and "maybe_model_type" for job control and dispatch,
/// since those mechanisms are overloaded and inconsistent.
///
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize, Default)]
#[serde(rename_all = "snake_case")]
pub enum InferenceJobType {
/// Jobs that run ComfyUI workflows
ComfyUi,
/// A job that turns "FBX" game engine files into "GLTF" files (Bevy-compatible).
#[serde(rename = "convert_fbx_gltf")]
ConvertFbxToGltf,
/// Process a video into BVH mocap animation data for game engines
MocapNet,
/// Re-render a video is a video style transfer algorithm. We developed code
/// around it, but chose to develop AnimateDiff / ComfyUI support instead.
RerenderAVideo,
/// RVC is a voice conversion model. RVCv2 is the most popular such model currently.
#[serde(rename = "rvc_v2")]
RvcV2,
/// SadTalker does image-to-video lip-syncing when given an audio file and image.
SadTalker,
/// so-vits-svc voice conversion. This predates RVCv2.
SoVitsSvc,
/// Stable diffusion image generation
StableDiffusion,
/// StyleTTS2 is a zero shot multi-speaker TTS model.
/// This job type should handle both speaker vector encoding and inference.
#[serde(rename = "styletts2")]
StyleTTS2,
/// TT2 Text to speech
Tacotron2,
/// A value we may use in the future for historical jobs
/// (i.e. when we backfill the database column and make it non-nullable)
#[default]
Unknown,
}
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
impl_enum_display_and_debug_using_to_str!(InferenceJobType);
impl_mysql_enum_coders!(InferenceJobType);
/// NB: Legacy API for older code.
impl InferenceJobType {
pub fn to_str(&self) -> &'static str {
match self {
Self::ComfyUi => "comfy_ui",
Self::ConvertFbxToGltf => "convert_fbx_gltf",
Self::MocapNet => "mocap_net",
Self::RerenderAVideo => "rerender_a_video",
Self::RvcV2 => "rvc_v2",
Self::SadTalker => "sad_talker",
Self::SoVitsSvc => "so_vits_svc",
Self::StableDiffusion => "stable_diffusion",
Self::StyleTTS2 => "styletts2",
Self::Tacotron2 => "tacotron2",
Self::Unknown => "unknown",
}
}
pub fn from_str(value: &str) -> Result<Self, String> {
match value {
"comfy_ui" => Ok(Self::ComfyUi),
"convert_fbx_gltf" => Ok(Self::ConvertFbxToGltf),
"mocap_net" => Ok(Self::MocapNet),
"rerender_a_video" => Ok(Self::RerenderAVideo),
"rvc_v2" => Ok(Self::RvcV2),
"sad_talker" => Ok(Self::SadTalker),
"so_vits_svc" => Ok(Self::SoVitsSvc),
"stable_diffusion" => Ok(Self::StableDiffusion),
"styletts2" => Ok(Self::StyleTTS2),
"tacotron2" => Ok(Self::Tacotron2),
"unknown" => Ok(Self::Unknown),
_ => Err(format!("invalid value: {:?}", value)),
}
}
pub fn all_variants() -> BTreeSet<Self> {
// NB: BTreeSet is sorted
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
BTreeSet::from([
Self::ComfyUi,
Self::ConvertFbxToGltf,
Self::MocapNet,
Self::RerenderAVideo,
Self::RvcV2,
Self::SadTalker,
Self::SoVitsSvc,
Self::StableDiffusion,
Self::StyleTTS2,
Self::Tacotron2,
Self::Unknown,
])
}
}
#[cfg(test)]
mod tests {
use crate::by_table::generic_inference_jobs::inference_job_type::InferenceJobType;
use crate::test_helpers::assert_serialization;
mod explicit_checks {
use super::*;
#[test]
fn default() {
assert_eq!(InferenceJobType::default(), InferenceJobType::Unknown);
}
#[test]
fn test_serialization() {
assert_serialization(InferenceJobType::ComfyUi, "comfy_ui");
assert_serialization(InferenceJobType::ConvertFbxToGltf, "convert_fbx_gltf");
assert_serialization(InferenceJobType::MocapNet, "mocap_net");
assert_serialization(InferenceJobType::RerenderAVideo, "rerender_a_video");
assert_serialization(InferenceJobType::RvcV2, "rvc_v2");
assert_serialization(InferenceJobType::SadTalker, "sad_talker");
assert_serialization(InferenceJobType::SoVitsSvc, "so_vits_svc");
assert_serialization(InferenceJobType::StableDiffusion, "stable_diffusion");
assert_serialization(InferenceJobType::StyleTTS2, "styletts2");
assert_serialization(InferenceJobType::Tacotron2, "tacotron2");
assert_serialization(InferenceJobType::Unknown, "unknown");
}
#[test]
fn to_str() {
assert_eq!(InferenceJobType::ComfyUi.to_str(), "comfy_ui");
assert_eq!(InferenceJobType::ConvertFbxToGltf.to_str(), "convert_fbx_gltf");
assert_eq!(InferenceJobType::MocapNet.to_str(), "mocap_net");
assert_eq!(InferenceJobType::RerenderAVideo.to_str(), "rerender_a_video");
assert_eq!(InferenceJobType::RvcV2.to_str(), "rvc_v2");
assert_eq!(InferenceJobType::SadTalker.to_str(), "sad_talker");
assert_eq!(InferenceJobType::SoVitsSvc.to_str(), "so_vits_svc");
assert_eq!(InferenceJobType::StableDiffusion.to_str(), "stable_diffusion");
assert_eq!(InferenceJobType::StyleTTS2.to_str(), "styletts2");
assert_eq!(InferenceJobType::Tacotron2.to_str(), "tacotron2");
assert_eq!(InferenceJobType::Unknown.to_str(), "unknown");
}
#[test]
fn from_str() {
assert_eq!(InferenceJobType::from_str("comfy_ui").unwrap(), InferenceJobType::ComfyUi);
assert_eq!(InferenceJobType::from_str("convert_fbx_gltf").unwrap(), InferenceJobType::ConvertFbxToGltf);
assert_eq!(InferenceJobType::from_str("mocap_net").unwrap(), InferenceJobType::MocapNet);
assert_eq!(InferenceJobType::from_str("rerender_a_video").unwrap(), InferenceJobType::RerenderAVideo);
assert_eq!(InferenceJobType::from_str("rvc_v2").unwrap(), InferenceJobType::RvcV2);
assert_eq!(InferenceJobType::from_str("sad_talker").unwrap(), InferenceJobType::SadTalker);
assert_eq!(InferenceJobType::from_str("so_vits_svc").unwrap(), InferenceJobType::SoVitsSvc);
assert_eq!(InferenceJobType::from_str("stable_diffusion").unwrap(), InferenceJobType::StableDiffusion);
assert_eq!(InferenceJobType::from_str("styletts2").unwrap(), InferenceJobType::StyleTTS2);
assert_eq!(InferenceJobType::from_str("tacotron2").unwrap(), InferenceJobType::Tacotron2);
assert_eq!(InferenceJobType::from_str("unknown").unwrap(), InferenceJobType::Unknown);
}
#[test]
fn all_variants() {
// Static check
let mut variants = InferenceJobType::all_variants();
assert_eq!(variants.len(), 11);
assert_eq!(variants.pop_first(), Some(InferenceJobType::ComfyUi));
assert_eq!(variants.pop_first(), Some(InferenceJobType::ConvertFbxToGltf));
assert_eq!(variants.pop_first(), Some(InferenceJobType::MocapNet));
assert_eq!(variants.pop_first(), Some(InferenceJobType::RerenderAVideo));
assert_eq!(variants.pop_first(), Some(InferenceJobType::RvcV2));
assert_eq!(variants.pop_first(), Some(InferenceJobType::SadTalker));
assert_eq!(variants.pop_first(), Some(InferenceJobType::SoVitsSvc));
assert_eq!(variants.pop_first(), Some(InferenceJobType::StableDiffusion));
assert_eq!(variants.pop_first(), Some(InferenceJobType::StyleTTS2));
assert_eq!(variants.pop_first(), Some(InferenceJobType::Tacotron2));
assert_eq!(variants.pop_first(), Some(InferenceJobType::Unknown));
assert_eq!(variants.pop_first(), None);
// Generated check
use strum::IntoEnumIterator;
assert_eq!(InferenceJobType::all_variants().len(), InferenceJobType::iter().len());
}
}
mod mechanical_checks {
use super::*;
#[test]
fn variant_length() {
use strum::IntoEnumIterator;
assert_eq!(InferenceJobType::all_variants().len(), InferenceJobType::iter().len());
}
#[test]
fn round_trip() {
for variant in InferenceJobType::all_variants() {
assert_eq!(variant, InferenceJobType::from_str(variant.to_str()).unwrap());
assert_eq!(variant, InferenceJobType::from_str(&format!("{}", variant)).unwrap());
assert_eq!(variant, InferenceJobType::from_str(&format!("{:?}", variant)).unwrap());
}
}
#[test]
fn serialized_length_ok_for_database() {
const MAX_LENGTH : usize = 32;
for variant in InferenceJobType::all_variants() {
let serialized = variant.to_str();
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
}
}
}
}
@@ -13,7 +13,7 @@ use strum::EnumIter;
///
/// These types are present in the HTTP API and database columns as serialized here.
///
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
pub enum InferenceModelType {
@@ -33,17 +33,8 @@ pub enum InferenceModelType {
VallEX,
#[serde(rename = "rerender_a_video")]
RerenderAVideo,
#[serde(rename = "stable_diffusion")]
StableDiffusion,
#[serde(rename = "mocap_net")]
MocapNet,
#[serde(rename = "comfy_ui")]
ComfyUi,
#[serde(rename = "styletts2")]
StyleTTS2,
/// A job that turns "FBX" game engine files into "GLTF" files (Bevy-compatible).
#[serde(rename = "convert_fbx_gltf")]
ConvertFbxToGltf,
}
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
@@ -61,11 +52,7 @@ impl InferenceModelType {
Self::Vits => "vits",
Self::VallEX => "vall_e_x",
Self::RerenderAVideo => "rerender_a_video",
Self::StableDiffusion => "stable_diffusion",
Self::MocapNet => "mocap_net",
Self::StyleTTS2 => "styletts2",
Self::ComfyUi => "comfy_ui",
Self::ConvertFbxToGltf => "convert_fbx_gltf",
}
}
@@ -78,31 +65,23 @@ impl InferenceModelType {
"vits" => Ok(Self::Vits),
"vall_e_x" => Ok(Self::VallEX),
"rerender_a_video" => Ok(Self::RerenderAVideo),
"stable_diffusion" => Ok(Self::StableDiffusion),
"mocap_net" => Ok(Self::MocapNet),
"styletts2" => Ok(Self::StyleTTS2),
"comfy_ui" => Ok(Self::ComfyUi),
"convert_fbx_gltf" => Ok(Self::ConvertFbxToGltf),
_ => Err(format!("invalid value: {:?}", value)),
}
}
pub fn all_variants() -> BTreeSet<Self> {
pub fn all_variants() -> BTreeSet<InferenceModelType> {
// NB: BTreeSet is sorted
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
BTreeSet::from([
Self::RvcV2,
Self::SadTalker,
Self::SoVitsSvc,
Self::Tacotron2,
Self::Vits,
Self::VallEX,
Self::RerenderAVideo,
Self::StableDiffusion,
Self::MocapNet,
Self::StyleTTS2,
Self::ComfyUi,
Self::ConvertFbxToGltf,
InferenceModelType::RvcV2,
InferenceModelType::SadTalker,
InferenceModelType::SoVitsSvc,
InferenceModelType::Tacotron2,
InferenceModelType::Vits,
InferenceModelType::VallEX,
InferenceModelType::RerenderAVideo,
InferenceModelType::MocapNet,
])
}
}
@@ -112,108 +91,59 @@ mod tests {
use crate::by_table::generic_inference_jobs::inference_model_type::InferenceModelType;
use crate::test_helpers::assert_serialization;
mod explicit_checks {
use super::*;
#[test]
fn test_serialization() {
assert_serialization(InferenceModelType::RvcV2, "rvc_v2");
assert_serialization(InferenceModelType::SadTalker, "sad_talker");
assert_serialization(InferenceModelType::SoVitsSvc, "so_vits_svc");
assert_serialization(InferenceModelType::Tacotron2, "tacotron2");
assert_serialization(InferenceModelType::Vits, "vits");
assert_serialization(InferenceModelType::VallEX, "vall_e_x");
assert_serialization(InferenceModelType::RerenderAVideo, "rerender_a_video");
assert_serialization(InferenceModelType::StableDiffusion, "stable_diffusion");
assert_serialization(InferenceModelType::MocapNet, "mocap_net");
assert_serialization(InferenceModelType::ComfyUi, "comfy_ui");
assert_serialization(InferenceModelType::StyleTTS2, "styletts2");
assert_serialization(InferenceModelType::ConvertFbxToGltf, "convert_fbx_gltf");
}
#[test]
fn to_str() {
assert_eq!(InferenceModelType::RvcV2.to_str(), "rvc_v2");
assert_eq!(InferenceModelType::SadTalker.to_str(), "sad_talker");
assert_eq!(InferenceModelType::SoVitsSvc.to_str(), "so_vits_svc");
assert_eq!(InferenceModelType::Tacotron2.to_str(), "tacotron2");
assert_eq!(InferenceModelType::Vits.to_str(), "vits");
assert_eq!(InferenceModelType::VallEX.to_str(), "vall_e_x");
assert_eq!(InferenceModelType::RerenderAVideo.to_str(), "rerender_a_video");
assert_eq!(InferenceModelType::StableDiffusion.to_str(), "stable_diffusion");
assert_eq!(InferenceModelType::MocapNet.to_str(), "mocap_net");
assert_eq!(InferenceModelType::StyleTTS2.to_str(), "styletts2");
assert_eq!(InferenceModelType::ComfyUi.to_str(), "comfy_ui");
assert_eq!(InferenceModelType::ConvertFbxToGltf.to_str(), "convert_fbx_gltf");
}
#[test]
fn from_str() {
assert_eq!(InferenceModelType::from_str("rvc_v2").unwrap(), InferenceModelType::RvcV2);
assert_eq!(InferenceModelType::from_str("sad_talker").unwrap(), InferenceModelType::SadTalker);
assert_eq!(InferenceModelType::from_str("so_vits_svc").unwrap(), InferenceModelType::SoVitsSvc);
assert_eq!(InferenceModelType::from_str("tacotron2").unwrap(), InferenceModelType::Tacotron2);
assert_eq!(InferenceModelType::from_str("vits").unwrap(), InferenceModelType::Vits);
assert_eq!(InferenceModelType::from_str("vall_e_x").unwrap(), InferenceModelType::VallEX);
assert_eq!(InferenceModelType::from_str("rerender_a_video").unwrap(), InferenceModelType::RerenderAVideo);
assert_eq!(InferenceModelType::from_str("stable_diffusion").unwrap(), InferenceModelType::StableDiffusion);
assert_eq!(InferenceModelType::from_str("mocap_net").unwrap(), InferenceModelType::MocapNet);
assert_eq!(InferenceModelType::from_str("styletts2").unwrap(), InferenceModelType::StyleTTS2);
assert_eq!(InferenceModelType::from_str("comfy_ui").unwrap(), InferenceModelType::ComfyUi);
assert_eq!(InferenceModelType::from_str("convert_fbx_gltf").unwrap(), InferenceModelType::ConvertFbxToGltf);
}
#[test]
fn all_variants() {
// Static check
let mut variants = InferenceModelType::all_variants();
assert_eq!(variants.len(), 12);
assert_eq!(variants.pop_first(), Some(InferenceModelType::RvcV2));
assert_eq!(variants.pop_first(), Some(InferenceModelType::SadTalker));
assert_eq!(variants.pop_first(), Some(InferenceModelType::SoVitsSvc));
assert_eq!(variants.pop_first(), Some(InferenceModelType::Tacotron2));
assert_eq!(variants.pop_first(), Some(InferenceModelType::Vits));
assert_eq!(variants.pop_first(), Some(InferenceModelType::VallEX));
assert_eq!(variants.pop_first(), Some(InferenceModelType::RerenderAVideo));
assert_eq!(variants.pop_first(), Some(InferenceModelType::StableDiffusion));
assert_eq!(variants.pop_first(), Some(InferenceModelType::MocapNet));
assert_eq!(variants.pop_first(), Some(InferenceModelType::ComfyUi));
assert_eq!(variants.pop_first(), Some(InferenceModelType::StyleTTS2));
assert_eq!(variants.pop_first(), Some(InferenceModelType::ConvertFbxToGltf));
assert_eq!(variants.pop_first(), None);
// Generated check
use strum::IntoEnumIterator;
assert_eq!(InferenceModelType::all_variants().len(), InferenceModelType::iter().len());
}
#[test]
fn test_serialization() {
assert_serialization(InferenceModelType::RvcV2, "rvc_v2");
assert_serialization(InferenceModelType::SadTalker, "sad_talker");
assert_serialization(InferenceModelType::SoVitsSvc, "so_vits_svc");
assert_serialization(InferenceModelType::Tacotron2, "tacotron2");
assert_serialization(InferenceModelType::Vits, "vits");
assert_serialization(InferenceModelType::VallEX, "vall_e_x");
assert_serialization(InferenceModelType::RerenderAVideo, "rerender_a_video");
assert_serialization(InferenceModelType::MocapNet, "mocap_net");
}
mod mechanical_checks {
use super::*;
#[test]
fn variant_length() {
use strum::IntoEnumIterator;
assert_eq!(InferenceModelType::all_variants().len(), InferenceModelType::iter().len());
}
#[test]
fn to_str() {
assert_eq!(InferenceModelType::RvcV2.to_str(), "rvc_v2");
assert_eq!(InferenceModelType::SadTalker.to_str(), "sad_talker");
assert_eq!(InferenceModelType::SoVitsSvc.to_str(), "so_vits_svc");
assert_eq!(InferenceModelType::Tacotron2.to_str(), "tacotron2");
assert_eq!(InferenceModelType::Vits.to_str(), "vits");
assert_eq!(InferenceModelType::VallEX.to_str(), "vall_e_x");
assert_eq!(InferenceModelType::RerenderAVideo.to_str(), "rerender_a_video");
assert_eq!(InferenceModelType::MocapNet.to_str(), "mocap_net");
}
#[test]
fn round_trip() {
for variant in InferenceModelType::all_variants() {
assert_eq!(variant, InferenceModelType::from_str(variant.to_str()).unwrap());
assert_eq!(variant, InferenceModelType::from_str(&format!("{}", variant)).unwrap());
assert_eq!(variant, InferenceModelType::from_str(&format!("{:?}", variant)).unwrap());
}
}
#[test]
fn from_str() {
assert_eq!(InferenceModelType::from_str("rvc_v2").unwrap(), InferenceModelType::RvcV2);
assert_eq!(InferenceModelType::from_str("sad_talker").unwrap(), InferenceModelType::SadTalker);
assert_eq!(InferenceModelType::from_str("so_vits_svc").unwrap(), InferenceModelType::SoVitsSvc);
assert_eq!(InferenceModelType::from_str("tacotron2").unwrap(), InferenceModelType::Tacotron2);
assert_eq!(InferenceModelType::from_str("vits").unwrap(), InferenceModelType::Vits);
assert_eq!(InferenceModelType::from_str("vall_e_x").unwrap(), InferenceModelType::VallEX);
assert_eq!(InferenceModelType::from_str("rerender_a_video").unwrap(), InferenceModelType::RerenderAVideo);
assert_eq!(InferenceModelType::from_str("mocap_net").unwrap(), InferenceModelType::MocapNet);
}
#[test]
fn serialized_length_ok_for_database() {
const MAX_LENGTH : usize = 32;
for variant in InferenceModelType::all_variants() {
let serialized = variant.to_str();
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
}
}
#[test]
fn all_variants() {
// Static check
let mut variants = InferenceModelType::all_variants();
assert_eq!(variants.len(), 8);
assert_eq!(variants.pop_first(), Some(InferenceModelType::RvcV2));
assert_eq!(variants.pop_first(), Some(InferenceModelType::SadTalker));
assert_eq!(variants.pop_first(), Some(InferenceModelType::SoVitsSvc));
assert_eq!(variants.pop_first(), Some(InferenceModelType::Tacotron2));
assert_eq!(variants.pop_first(), Some(InferenceModelType::Vits));
assert_eq!(variants.pop_first(), Some(InferenceModelType::VallEX));
assert_eq!(variants.pop_first(), Some(InferenceModelType::RerenderAVideo));
assert_eq!(variants.pop_first(), Some(InferenceModelType::MocapNet));
assert_eq!(variants.pop_first(), None);
// Generated check
use strum::IntoEnumIterator;
assert_eq!(InferenceModelType::all_variants().len(), InferenceModelType::iter().len());
}
}
@@ -12,7 +12,7 @@ use strum::EnumIter;
///
/// These types are present in the HTTP API and database columns as serialized here.
///
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
pub enum InferenceResultType {
@@ -29,9 +29,6 @@ pub enum InferenceResultType {
#[serde(rename = "zs_voice_embedding")]
ZeroShotVoiceEmbedding,
#[serde(rename = "upload_model")]
UploadModel
}
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
@@ -46,7 +43,6 @@ impl InferenceResultType {
Self::TextToSpeech => "text_to_speech",
Self::VoiceConversion => "voice_conversion",
Self::ZeroShotVoiceEmbedding => "zs_voice_embedding",
Self::UploadModel => "upload_model",
}
}
@@ -56,7 +52,6 @@ impl InferenceResultType {
"text_to_speech" => Ok(Self::TextToSpeech),
"voice_conversion" => Ok(Self::VoiceConversion),
"zs_voice_embedding" => Ok(Self::ZeroShotVoiceEmbedding),
"upload_model" => Ok(Self::UploadModel),
_ => Err(format!("invalid value: {:?}", value)),
}
}
@@ -69,7 +64,6 @@ impl InferenceResultType {
InferenceResultType::TextToSpeech,
InferenceResultType::VoiceConversion,
InferenceResultType::ZeroShotVoiceEmbedding,
InferenceResultType::UploadModel,
])
}
}
@@ -85,7 +79,6 @@ mod tests {
assert_serialization(InferenceResultType::TextToSpeech, "text_to_speech");
assert_serialization(InferenceResultType::VoiceConversion, "voice_conversion");
assert_serialization(InferenceResultType::ZeroShotVoiceEmbedding, "zs_voice_embedding");
assert_serialization(InferenceResultType::UploadModel, "upload_model");
}
#[test]
@@ -94,7 +87,6 @@ mod tests {
assert_eq!(InferenceResultType::TextToSpeech.to_str(), "text_to_speech");
assert_eq!(InferenceResultType::VoiceConversion.to_str(), "voice_conversion");
assert_eq!(InferenceResultType::ZeroShotVoiceEmbedding.to_str(), "zs_voice_embedding");
assert_eq!(InferenceResultType::UploadModel.to_str(), "upload_model");
}
#[test]
@@ -103,19 +95,17 @@ mod tests {
assert_eq!(InferenceResultType::from_str("text_to_speech").unwrap(), InferenceResultType::TextToSpeech);
assert_eq!(InferenceResultType::from_str("voice_conversion").unwrap(), InferenceResultType::VoiceConversion);
assert_eq!(InferenceResultType::from_str("zs_voice_embedding").unwrap(), InferenceResultType::ZeroShotVoiceEmbedding);
assert_eq!(InferenceResultType::from_str("upload_model").unwrap(), InferenceResultType::UploadModel);
}
#[test]
fn all_variants() {
// Static check
let mut variants = InferenceResultType::all_variants();
assert_eq!(variants.len(), 5);
assert_eq!(variants.len(), 4);
assert_eq!(variants.pop_first(), Some(InferenceResultType::MediaFile));
assert_eq!(variants.pop_first(), Some(InferenceResultType::TextToSpeech));
assert_eq!(variants.pop_first(), Some(InferenceResultType::VoiceConversion));
assert_eq!(variants.pop_first(), Some(InferenceResultType::ZeroShotVoiceEmbedding));
assert_eq!(variants.pop_first(), Some(InferenceResultType::UploadModel));
assert_eq!(variants.pop_first(), None);
// Generated check
@@ -1,6 +1,5 @@
pub mod frontend_failure_category;
pub mod inference_category;
pub mod inference_input_source_token_type;
pub mod inference_job_type;
pub mod inference_model_type;
pub mod inference_result_type;
@@ -29,10 +29,6 @@ pub enum IdCategory {
#[serde(rename = "mocap")]
MocapResult,
// Results from workflows
#[serde(rename = "workflow")]
WorkflowResult,
/// Results from tacotron2
/// Applies for RVC and SVC
#[serde(rename = "tts_result")]
@@ -82,7 +78,6 @@ impl IdCategory {
Self::ModelWeights => "model_weights",
Self::FileUpload => "file_upload",
Self::MocapResult => "mocap",
Self::WorkflowResult => "workflow",
}
}
@@ -99,7 +94,6 @@ impl IdCategory {
"model_weights" => Ok(Self::ModelWeights),
"file_upload" => Ok(Self::FileUpload),
"mocap" => Ok(Self::MocapResult),
"workflow" => Ok(Self::WorkflowResult),
_ => Err(format!("invalid value: {:?}", value)),
}
}
@@ -119,7 +113,6 @@ impl IdCategory {
Self::ModelWeights,
Self::FileUpload,
Self::MocapResult,
Self::WorkflowResult,
])
}
}
@@ -145,7 +138,6 @@ mod tests {
assert_serialization(IdCategory::ModelWeights, "model_weights");
assert_serialization(IdCategory::FileUpload, "file_upload");
assert_serialization(IdCategory::MocapResult, "mocap");
assert_serialization(IdCategory::WorkflowResult, "workflow");
}
#[test]
@@ -161,7 +153,6 @@ mod tests {
assert_eq!(IdCategory::ModelWeights.to_str(), "model_weights");
assert_eq!(IdCategory::FileUpload.to_str(), "file_upload");
assert_eq!(IdCategory::MocapResult.to_str(), "mocap");
assert_eq!(IdCategory::WorkflowResult.to_str(), "workflow");
}
#[test]
@@ -177,19 +168,17 @@ mod tests {
assert_eq!(IdCategory::from_str("model_weights").unwrap(), IdCategory::ModelWeights);
assert_eq!(IdCategory::from_str("file_upload").unwrap(), IdCategory::FileUpload);
assert_eq!(IdCategory::from_str("mocap").unwrap(), IdCategory::MocapResult);
assert_eq!(IdCategory::from_str("workflow").unwrap(), IdCategory::WorkflowResult);
}
#[test]
fn all_variants() {
// Static check
let mut variants = IdCategory::all_variants();
assert_eq!(variants.len(), 12);
assert_eq!(variants.len(), 11);
assert_eq!(variants.pop_first(), Some(IdCategory::MediaFile));
assert_eq!(variants.pop_first(), Some(IdCategory::LipsyncAnimationResult));
assert_eq!(variants.pop_first(), Some(IdCategory::VideoFilterResult));
assert_eq!(variants.pop_first(), Some(IdCategory::MocapResult));
assert_eq!(variants.pop_first(), Some(IdCategory::WorkflowResult));
assert_eq!(variants.pop_first(), Some(IdCategory::TtsResult));
assert_eq!(variants.pop_first(), Some(IdCategory::VoiceConversionResult));
assert_eq!(variants.pop_first(), Some(IdCategory::ZeroShotTtsResult));
@@ -38,15 +38,6 @@ pub enum MediaFileOriginModelType {
#[serde(rename = "mocap_net")]
MocapNet,
#[serde(rename = "comfy_ui")]
ComfyUi,
#[serde(rename = "styletts2")]
StyleTTS2,
#[serde(rename = "stable_diffusion_1_5")]
StableDiffusion15,
}
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
@@ -65,9 +56,6 @@ impl MediaFileOriginModelType {
Self::VallEX => "vall_e_x",
Self::Rerender => "rerender",
Self::MocapNet => "mocap_net",
Self::ComfyUi => "comfy_ui",
Self::StyleTTS2 => "styletts2",
Self::StableDiffusion15 => "stable_diffusion_1_5"
}
}
@@ -80,9 +68,6 @@ impl MediaFileOriginModelType {
"vall_e_x" => Ok(Self::VallEX),
"rerender" => Ok(Self::Rerender),
"mocap_net" => Ok(Self::MocapNet),
"comfy_ui" => Ok(Self::ComfyUi),
"styletts2" => Ok(Self::StyleTTS2),
"stable_diffusion_1_5" => Ok(Self::StableDiffusion15),
_ => Err(format!("invalid value: {:?}", value)),
}
}
@@ -98,9 +83,6 @@ impl MediaFileOriginModelType {
Self::VallEX,
Self::Rerender,
Self::MocapNet,
Self::ComfyUi,
Self::StyleTTS2,
Self::StableDiffusion15
])
}
}
@@ -127,9 +109,6 @@ mod tests {
assert_eq!(MediaFileOriginModelType::VallEX.to_str(), "vall_e_x");
assert_eq!(MediaFileOriginModelType::Rerender.to_str(), "rerender");
assert_eq!(MediaFileOriginModelType::MocapNet.to_str(), "mocap_net");
assert_eq!(MediaFileOriginModelType::ComfyUi.to_str(), "comfy_ui");
assert_eq!(MediaFileOriginModelType::StyleTTS2.to_str(), "styletts2");
assert_eq!(MediaFileOriginModelType::StableDiffusion15.to_str(), "stable_diffusion_1_5");
}
#[test]
@@ -141,16 +120,13 @@ mod tests {
assert_eq!(MediaFileOriginModelType::from_str("vall_e_x").unwrap(), MediaFileOriginModelType::VallEX);
assert_eq!(MediaFileOriginModelType::from_str("rerender").unwrap(), MediaFileOriginModelType::Rerender);
assert_eq!(MediaFileOriginModelType::from_str("mocap_net").unwrap(), MediaFileOriginModelType::MocapNet);
assert_eq!(MediaFileOriginModelType::from_str("comfy_ui").unwrap(), MediaFileOriginModelType::ComfyUi);
assert_eq!(MediaFileOriginModelType::from_str("styletts2").unwrap(), MediaFileOriginModelType::StyleTTS2);
assert_eq!(MediaFileOriginModelType::from_str("stable_diffusion_1_5").unwrap(), MediaFileOriginModelType::StableDiffusion15);
assert!(MediaFileOriginModelType::from_str("foo").is_err());
}
#[test]
fn all_variants() {
let mut variants = MediaFileOriginModelType::all_variants();
assert_eq!(variants.len(), 10);
assert_eq!(variants.len(), 7);
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::RvcV2));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::SadTalker));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::SoVitsSvc));
@@ -158,9 +134,6 @@ mod tests {
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::VallEX));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::Rerender));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::MocapNet));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::ComfyUi));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::StyleTTS2));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::StableDiffusion15));
assert_eq!(variants.pop_first(), None);
}
}
@@ -46,12 +46,6 @@ pub enum MediaFileOriginProductCategory {
// Mocap
#[serde(rename = "mocap")]
Mocap,
#[serde(rename = "image_gen")]
ImageGeneration,
// Workflow
#[serde(rename = "workflow")]
Workflow,
}
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
@@ -70,8 +64,6 @@ impl MediaFileOriginProductCategory {
Self::ZeroShotVoice => "zs_voice",
Self::VideoFilter => "video_filter",
Self::Mocap => "mocap",
Self::ImageGeneration => "image_gen",
Self::Workflow => "workflow",
}
}
@@ -84,8 +76,6 @@ impl MediaFileOriginProductCategory {
"zs_voice" => Ok(Self::ZeroShotVoice),
"video_filter" => Ok(Self::VideoFilter),
"mocap" => Ok(Self::Mocap),
"image_gen" => Ok(Self::ImageGeneration),
"workflow" => Ok(Self::Workflow),
_ => Err(format!("invalid value: {:?}", value)),
}
}
@@ -101,8 +91,6 @@ impl MediaFileOriginProductCategory {
Self::VoiceConversion,
Self::ZeroShotVoice,
Self::Mocap,
Self::ImageGeneration,
Self::Workflow,
])
}
}
@@ -123,9 +111,7 @@ mod tests {
assert_serialization(MediaFileOriginProductCategory::VoiceConversion, "voice_conversion");
assert_serialization(MediaFileOriginProductCategory::ZeroShotVoice, "zs_voice");
assert_serialization(MediaFileOriginProductCategory::VideoFilter, "video_filter");
assert_serialization(MediaFileOriginProductCategory::Mocap, "mocap");
assert_serialization(MediaFileOriginProductCategory::ImageGeneration, "image_gen");
assert_serialization(MediaFileOriginProductCategory::Workflow, "workflow");
assert_serialization(MediaFileOriginProductCategory::Mocap, "mocap")
}
#[test]
@@ -137,8 +123,6 @@ mod tests {
assert_eq!(MediaFileOriginProductCategory::ZeroShotVoice.to_str(), "zs_voice");
assert_eq!(MediaFileOriginProductCategory::VideoFilter.to_str(), "video_filter");
assert_eq!(MediaFileOriginProductCategory::Mocap.to_str(), "mocap");
assert_eq!(MediaFileOriginProductCategory::ImageGeneration.to_str(), "image_gen");
assert_eq!(MediaFileOriginProductCategory::Workflow.to_str(), "workflow");
}
#[test]
@@ -150,14 +134,12 @@ mod tests {
assert_eq!(MediaFileOriginProductCategory::from_str("zs_voice").unwrap(), MediaFileOriginProductCategory::ZeroShotVoice);
assert_eq!(MediaFileOriginProductCategory::from_str("video_filter").unwrap(), MediaFileOriginProductCategory::VideoFilter);
assert_eq!(MediaFileOriginProductCategory::from_str("mocap").unwrap(), MediaFileOriginProductCategory::Mocap);
assert_eq!(MediaFileOriginProductCategory::from_str("image_gen").unwrap(),MediaFileOriginProductCategory::ImageGeneration);
assert_eq!(MediaFileOriginProductCategory::from_str("workflow").unwrap(), MediaFileOriginProductCategory::Workflow);
}
#[test]
fn all_variants() {
let mut variants = MediaFileOriginProductCategory::all_variants();
assert_eq!(variants.len(), 9);
assert_eq!(variants.len(), 7);
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::Unknown));
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::FaceAnimator));
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::TextToSpeech));
@@ -165,8 +147,6 @@ mod tests {
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::ZeroShotVoice));
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::VideoFilter));
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::Mocap));
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::ImageGeneration));
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::Workflow));
assert_eq!(variants.pop_first(), None);
}
}
@@ -6,7 +6,7 @@ use strum::EnumCount;
use strum::EnumIter;
use utoipa::ToSchema;
/// Used in the `media_files` table in a `VARCHAR(16)` field.
/// Used in the `media_files` table in a `VARCHAR` field.
///
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
@@ -23,22 +23,7 @@ pub enum MediaFileType {
Video,
/// Mocap files: BVH, etc.
/// NB: In actuality, this is just the BVH file type.
/// NB: This is the old type to migrate from.
Mocap,
/// BVH files (for Bevy)
/// NB: This is the new type to migrate to.
Bvh,
/// FBX files (for Bevy)
Fbx,
/// glTF binary files (for Bevy)
Glb,
/// glTF files (for Bevy)
Gltf,
}
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
@@ -54,10 +39,6 @@ impl MediaFileType {
Self::Image => "image",
Self::Video => "video",
Self::Mocap => "mocap",
Self::Bvh => "bvh",
Self::Fbx => "fbx",
Self::Glb => "glb",
Self::Gltf => "gltf",
}
}
@@ -67,10 +48,6 @@ impl MediaFileType {
"image" => Ok(Self::Image),
"video" => Ok(Self::Video),
"mocap" => Ok(Self::Mocap),
"bvh" => Ok(Self::Bvh),
"fbx" => Ok(Self::Fbx),
"glb" => Ok(Self::Glb),
"gltf" => Ok(Self::Gltf),
_ => Err(format!("invalid value: {:?}", value)),
}
}
@@ -83,10 +60,6 @@ impl MediaFileType {
Self::Image,
Self::Video,
Self::Mocap,
Self::Bvh,
Self::Fbx,
Self::Glb,
Self::Gltf,
])
}
}
@@ -105,10 +78,6 @@ mod tests {
assert_serialization(MediaFileType::Image, "image");
assert_serialization(MediaFileType::Video, "video");
assert_serialization(MediaFileType::Mocap, "mocap");
assert_serialization(MediaFileType::Bvh, "bvh");
assert_serialization(MediaFileType::Fbx, "fbx");
assert_serialization(MediaFileType::Glb, "glb");
assert_serialization(MediaFileType::Gltf, "gltf");
}
}
@@ -120,10 +89,7 @@ mod tests {
assert_eq!(MediaFileType::Audio.to_str(), "audio");
assert_eq!(MediaFileType::Image.to_str(), "image");
assert_eq!(MediaFileType::Video.to_str(), "video");
assert_eq!(MediaFileType::Bvh.to_str(), "bvh");
assert_eq!(MediaFileType::Fbx.to_str(), "fbx");
assert_eq!(MediaFileType::Glb.to_str(), "glb");
assert_eq!(MediaFileType::Gltf.to_str(), "gltf");
assert_eq!(MediaFileType::Mocap.to_str(), "mocap");
}
#[test]
@@ -132,10 +98,6 @@ mod tests {
assert_eq!(MediaFileType::from_str("image").unwrap(), MediaFileType::Image);
assert_eq!(MediaFileType::from_str("video").unwrap(), MediaFileType::Video);
assert_eq!(MediaFileType::from_str("mocap").unwrap(), MediaFileType::Mocap);
assert_eq!(MediaFileType::from_str("bvh").unwrap(), MediaFileType::Bvh);
assert_eq!(MediaFileType::from_str("fbx").unwrap(), MediaFileType::Fbx);
assert_eq!(MediaFileType::from_str("glb").unwrap(), MediaFileType::Glb);
assert_eq!(MediaFileType::from_str("gltf").unwrap(), MediaFileType::Gltf);
assert!(MediaFileType::from_str("foo").is_err());
}
}
@@ -146,15 +108,11 @@ mod tests {
#[test]
fn all_variants() {
let mut variants = MediaFileType::all_variants();
assert_eq!(variants.len(), 8);
assert_eq!(variants.len(), 4);
assert_eq!(variants.pop_first(), Some(MediaFileType::Audio));
assert_eq!(variants.pop_first(), Some(MediaFileType::Image));
assert_eq!(variants.pop_first(), Some(MediaFileType::Video));
assert_eq!(variants.pop_first(), Some(MediaFileType::Mocap));
assert_eq!(variants.pop_first(), Some(MediaFileType::Bvh));
assert_eq!(variants.pop_first(), Some(MediaFileType::Fbx));
assert_eq!(variants.pop_first(), Some(MediaFileType::Glb));
assert_eq!(variants.pop_first(), Some(MediaFileType::Gltf));
assert_eq!(variants.pop_first(), None);
}
}
@@ -176,15 +134,5 @@ mod tests {
assert_eq!(variant, MediaFileType::from_str(&format!("{:?}", variant)).unwrap());
}
}
#[test]
fn serialized_length_ok_for_database() {
const MAX_LENGTH : usize = 16;
for variant in MediaFileType::all_variants() {
let serialized = variant.to_str();
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
}
}
}
}
-2
View File
@@ -1,6 +1,5 @@
// ===== MySql =====
pub mod audit_logs;
pub mod batch_generations;
pub mod comments;
pub mod email_sender_jobs;
pub mod entity_stats;
@@ -18,7 +17,6 @@ pub mod user_ratings;
pub mod voice_conversion_models;
pub mod voice_conversion_results;
pub mod zs_voices;
// ===== Sqlite =====
pub mod tts_render_tasks;
pub mod web_rendition_targets;
@@ -17,8 +17,6 @@ pub enum WeightsCategory {
Vocoder,
#[serde(rename = "voice_conversion")]
VoiceConversion,
#[serde(rename = "workflow_config")]
WorkflowConfig,
}
impl WeightsCategory {
@@ -28,7 +26,6 @@ impl WeightsCategory {
Self::TextToSpeech => "text_to_speech",
Self::Vocoder => "vocoder",
Self::VoiceConversion => "voice_conversion",
Self::WorkflowConfig => "workflow_config",
}
}
@@ -38,7 +35,6 @@ impl WeightsCategory {
"text_to_speech" => Ok(Self::TextToSpeech),
"vocoder" => Ok(Self::Vocoder),
"voice_conversion" => Ok(Self::VoiceConversion),
"workflow_config" => Ok(Self::WorkflowConfig),
_ => Err(format!("invalid value: {:?}", value)),
}
}
@@ -49,7 +45,6 @@ impl WeightsCategory {
Self::TextToSpeech,
Self::Vocoder,
Self::VoiceConversion,
Self::WorkflowConfig,
])
}
}
@@ -67,7 +62,6 @@ mod tests {
assert_eq!(WeightsCategory::TextToSpeech.to_str(), "text_to_speech");
assert_eq!(WeightsCategory::Vocoder.to_str(), "vocoder");
assert_eq!(WeightsCategory::VoiceConversion.to_str(), "voice_conversion");
assert_eq!(WeightsCategory::WorkflowConfig.to_str(), "workflow_config");
}
#[test]
@@ -76,18 +70,16 @@ mod tests {
assert_eq!(WeightsCategory::from_str("text_to_speech").unwrap(), WeightsCategory::TextToSpeech);
assert_eq!(WeightsCategory::from_str("vocoder").unwrap(), WeightsCategory::Vocoder);
assert_eq!(WeightsCategory::from_str("voice_conversion").unwrap(), WeightsCategory::VoiceConversion);
assert_eq!(WeightsCategory::from_str("workflow_config").unwrap(), WeightsCategory::WorkflowConfig);
assert!(WeightsCategory::from_str("invalid").is_err());
}
#[test]
fn test_all_variants() {
let variants = WeightsCategory::all_variants();
assert_eq!(variants.len(), 5);
assert_eq!(variants.len(), 4);
assert!(variants.contains(&WeightsCategory::ImageGeneration));
assert!(variants.contains(&WeightsCategory::TextToSpeech));
assert!(variants.contains(&WeightsCategory::Vocoder));
assert!(variants.contains(&WeightsCategory::VoiceConversion));
assert!(variants.contains(&WeightsCategory::WorkflowConfig));
}
}
@@ -25,8 +25,6 @@ pub enum WeightsType {
LoRA,
#[serde(rename = "vall_e")]
VallE,
#[serde(rename = "comfy_ui")]
ComfyUi,
}
@@ -41,7 +39,6 @@ impl WeightsType {
Self::Tacotron2 => "tt2",
Self::LoRA => "loRA",
Self::VallE => "vall_e",
Self::ComfyUi => "comfy_ui",
}
}
@@ -55,7 +52,6 @@ impl WeightsType {
"tt2" => Ok(Self::Tacotron2),
"loRA" => Ok(Self::LoRA),
"vall_e" => Ok(Self::VallE),
"comfy_ui" => Ok(Self::ComfyUi),
_ => Err(format!("invalid value: {:?}", value)),
}
}
@@ -69,8 +65,7 @@ impl WeightsType {
Self::SoVitsSvc,
Self::Tacotron2,
Self::LoRA,
Self::VallE,
Self::ComfyUi,
Self::VallE
])
}
}
@@ -93,7 +88,6 @@ mod tests {
assert_eq!(WeightsType::Tacotron2.to_str(), "tt2");
assert_eq!(WeightsType::LoRA.to_str(), "loRA");
assert_eq!(WeightsType::VallE.to_str(), "vall_e");
assert_eq!(WeightsType::ComfyUi.to_str(), "comfy_ui");
}
#[test]
@@ -106,14 +100,13 @@ mod tests {
assert_eq!(WeightsType::from_str("tt2").unwrap(), WeightsType::Tacotron2);
assert_eq!(WeightsType::from_str("loRA").unwrap(), WeightsType::LoRA);
assert_eq!(WeightsType::from_str("vall_e").unwrap(), WeightsType::VallE);
assert_eq!(WeightsType::from_str("comfy_ui").unwrap(), WeightsType::ComfyUi);
assert!(WeightsType::from_str("invalid").is_err());
}
#[test]
fn test_all_variants() {
let variants = WeightsType::all_variants();
assert_eq!(variants.len(), 9);
assert_eq!(variants.len(), 8);
assert!(variants.contains(&WeightsType::HifiganTacotron2));
assert!(variants.contains(&WeightsType::RvcV2));
assert!(variants.contains(&WeightsType::StableDiffusion15));
@@ -122,6 +115,5 @@ mod tests {
assert!(variants.contains(&WeightsType::Tacotron2));
assert!(variants.contains(&WeightsType::LoRA));
assert!(variants.contains(&WeightsType::VallE));
assert!(variants.contains(&WeightsType::ComfyUi));
}
}
@@ -16,8 +16,6 @@ pub enum ZsVoiceModelType {
/// TTS-type zero shot models
#[serde(rename = "vall-e-x")]
VallEX,
#[serde(rename = "styletts2")]
StyleTTS2,
}
// TODO(bt, 2023-01-17): This desperately needs MySQL integration tests!
@@ -29,14 +27,12 @@ impl ZsVoiceModelType {
pub fn to_str(&self) -> &'static str {
match self {
Self::VallEX=> "vall-e-x",
Self::StyleTTS2 => "styletts2",
}
}
pub fn from_str(value: &str) -> Result<Self, String> {
match value {
"vall-e-x" => Ok(Self::VallEX),
"styletts2" => Ok(Self::StyleTTS2),
_ => Err(format!("invalid value: {:?}", value)),
}
}
@@ -46,7 +42,6 @@ impl ZsVoiceModelType {
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
BTreeSet::from([
Self::VallEX,
Self::StyleTTS2,
])
}
}
@@ -71,13 +66,11 @@ mod tests {
#[test]
fn to_str() {
assert_eq!(ZsVoiceModelType::VallEX.to_str(), "vall-e-x");
assert_eq!(ZsVoiceModelType::StyleTTS2.to_str(), "styletts2");
}
#[test]
fn from_str() {
assert_eq!(ZsVoiceModelType::from_str("vall-e-x").unwrap(), ZsVoiceModelType::VallEX);
assert_eq!(ZsVoiceModelType::from_str("styletts2").unwrap(), ZsVoiceModelType::StyleTTS2);
assert!(ZsVoiceModelType::from_str("foo").is_err());
}
}
@@ -88,9 +81,8 @@ mod tests {
#[test]
fn all_variants() {
let mut variants = ZsVoiceModelType::all_variants();
assert_eq!(variants.len(), 2);
assert_eq!(variants.len(), 1);
assert_eq!(variants.pop_first(), Some(ZsVoiceModelType::VallEX));
assert_eq!(variants.pop_first(), Some(ZsVoiceModelType::StyleTTS2));
assert_eq!(variants.pop_first(), None);
}
}
+1 -9
View File
@@ -24,7 +24,6 @@ use strum::EnumIter;
pub(crate) enum TokenPrefix {
AnonymousVisitorTracking, // AVTs are not stored as primary keys in any table, but an index in many tables.
AuditLog,
BatchGeneration,
Comment,
DownloadJob,
EmailSenderJob,
@@ -91,7 +90,6 @@ impl PrefixGenerator for TokenPrefix {
match self {
Self::AnonymousVisitorTracking => "avt_",
Self::AuditLog => "audit_",
Self::BatchGeneration => "batch_g_",
Self::Comment => "comment_",
Self::DownloadJob => "jdown_", // NB: Previously "JGUP:"
Self::EmailSenderJob => "email_job_",
@@ -299,13 +297,7 @@ mod tests {
#[test]
fn test_all_prefixes_end_with_separator_length_one() {
for prefix in get_all_prefixes().iter().map(|s| *s) {
if prefix == "news_story_"
|| prefix == "tts_task_"
|| prefix == "INT_API:"
|| prefix == "pw_reset_"
|| prefix == "email_job_"
|| prefix == "batch_g_"
{
if prefix == "news_story_" || prefix == "tts_task_" || prefix == "INT_API:" || prefix == "pw_reset_" || prefix == "email_job_" {
// TODO/FIXME: I'm too tired at 5AM to replacen from the left. Make this test valid.
// These tokens are from the AIChatBot sidecar, so asserting their validity is less important.
continue;
@@ -1,15 +0,0 @@
use std::fmt::Debug;
use serde::Deserialize;
use serde::Serialize;
use utoipa::ToSchema;
use crate::prefixes::TokenPrefix;
/// The primary key for Audit Logs.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
#[sqlx(transparent)]
pub struct BatchGenerationToken(pub String);
impl_string_token!(BatchGenerationToken);
impl_crockford_generator!(BatchGenerationToken, 32usize, TokenPrefix::BatchGeneration, CrockfordLower);
+1 -2
View File
@@ -2,7 +2,6 @@ pub mod anonymous_visitor_tracking;
pub mod api_tokens_external;
pub mod api_tokens_internal;
pub mod audit_logs;
pub mod batch_generations;
pub mod comments;
pub mod email_sender_job_token;
pub mod firehose_entries;
@@ -21,7 +20,6 @@ pub mod tts_results;
pub mod twitch_event_rule;
pub mod twitch_oauth_tokens_grouping;
pub mod twitch_oauth_tokens_internal;
pub mod user_bookmarks;
pub mod user_sessions;
pub mod user_subscriptions;
pub mod users;
@@ -36,3 +34,4 @@ pub mod w2l_templates;
pub mod zs_voice_dataset_samples;
pub mod zs_voice_datasets;
pub mod zs_voices;
pub mod user_bookmarks;
+14 -10
View File
@@ -7,7 +7,13 @@ use errors::AnyhowResult;
use crate::bucket_clients::get_bucket_clients;
use crate::cli_args::parse_cli_args;
use crate::seeding::seed_model_weights_for_local::seed_weights;
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::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;
@@ -47,19 +53,17 @@ pub async fn main() -> AnyhowResult<()> {
// maybe_elasticsearch = Some(get_elasticsearch_client());
// }
// seed_user_accounts(&pool).await?;
// seed_media_files(&pool, maybe_bucket_clients.as_ref()).await?;
seed_user_accounts(&pool).await?;
seed_media_files(&pool, maybe_bucket_clients.as_ref()).await?;
//seed_zero_shot_tts(&pool, maybe_bucket_clients.as_ref()).await?;
// seed_voice_conversion(&pool).await?;
seed_voice_conversion(&pool).await?;
seed_weights(&pool).await?;
// seed_media_seedtool(&pool).await?;
// seed_tts_tacotron2(&pool, maybe_bucket_clients.as_ref()).await?;
seed_tts_tacotron2(&pool, maybe_bucket_clients.as_ref()).await?;
// should seed the weights with a few files for hanashi
//seed_weights_files(&pool, maybe_bucket_clients.as_ref()).await?;
//println!("TESTING DOWLOAD");
//test_seed_weights_files().await?;
//info!("Done!");
seed_weights_files(&pool, maybe_bucket_clients.as_ref()).await?;
info!("Done!");
Ok(())
}
@@ -1,56 +0,0 @@
use log::info;
use sqlx::{MySql, Pool};
use cloud_storage::remote_file_manager::media_descriptor::MediaVideoMp4Descriptor;
use cloud_storage::remote_file_manager::remote_cloud_file_manager::RemoteCloudFileClient;
use enums::by_table::media_files::media_file_type::MediaFileType;
use enums::common::visibility::Visibility;
use mysql_queries::queries::media_files::create::insert_media_file_from_cli_tool::{insert_media_file_from_cli_tool, InsertArgs};
use errors::{anyhow, AnyhowResult};
use mysql_queries::queries::users::user::get_user_token_by_username::get_user_token_by_username;
use storyteller_root::get_seed_tool_data_root;
use tokens::tokens::media_files::MediaFileToken;
use tokens::tokens::users::UserToken;
use crate::seeding::users::HANASHI_USERNAME;
pub async fn seed_test_videos(mysql_pool: &Pool<MySql>, user_token: UserToken) -> AnyhowResult<()> {
let model_weight_token1 = MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
let seed_tool_data_root = get_seed_tool_data_root();
let mut media_file_path = seed_tool_data_root.clone();
media_file_path.push("media/video/video-style-transfer/miku.mp4");
let remote_cloud_file_client = RemoteCloudFileClient::get_remote_cloud_file_client().await?;
let video_media_descriptor = Box::new(MediaVideoMp4Descriptor {});
let metadata1 = remote_cloud_file_client.upload_file(video_media_descriptor, media_file_path.as_path().to_str().unwrap()).await?;
let bucket_details = metadata1.bucket_details.as_ref().unwrap().clone();
let media1 = InsertArgs {
pool: &mysql_pool,
maybe_use_apriori_media_token: Some(&model_weight_token1),
media_file_type: MediaFileType::Video,
maybe_mime_type: Some(&*metadata1.mimetype),
file_size_bytes: metadata1.file_size_bytes,
sha256_checksum: &metadata1.sha256_checksum,
maybe_origin_filename: Some("miku.mp4"),
maybe_creator_user_token: Some(&user_token),
creator_set_visibility: Visibility::Public,
public_bucket_directory_hash: &bucket_details.object_hash,
maybe_public_bucket_prefix: Some(&bucket_details.prefix),
maybe_public_bucket_extension: Some(&bucket_details.suffix),
};
let (_media_file_token1, _) = insert_media_file_from_cli_tool(media1).await.unwrap();
Ok(())
}
pub async fn seed_media_seedtool(mysql_pool: &Pool<MySql>) -> AnyhowResult<()> {
info!("Seeding media...");
let user_token = match get_user_token_by_username(HANASHI_USERNAME, mysql_pool).await? {
None => {
return Err(anyhow!("could not find user hanashi"));
}
Some(token) => token,
};
seed_test_videos(mysql_pool, user_token.clone()).await?;
Ok(())
}
@@ -1,8 +1,7 @@
pub mod seed_model_weights_for_local;
pub mod model_weights;
pub mod seed_media_files;
pub mod tts_tacotron2;
pub mod users;
pub mod voice_conversion;
pub mod zero_shot_tts;
pub mod seed_model_weights;
pub(crate) mod media_files;
pub mod seed_model_weights;
@@ -1,12 +1,8 @@
use std::path::PathBuf;
use std::vec;
use log::info;
use sqlx::{MySql, Pool};
use cloud_storage::remote_file_manager::remote_cloud_bucket_details::RemoteCloudBucketDetails;
use cloud_storage::remote_file_manager::remote_cloud_file_manager::RemoteCloudFileClient;
use cloud_storage::remote_file_manager::weights_descriptor::{WeightsLoRADescriptor, WeightsSD15Descriptor, WeightsSD15CkptDescriptor, WeightsWorkflowDescriptor};
use enums::by_table::model_weights::{
weights_category::WeightsCategory,
weights_types::WeightsType,
@@ -15,48 +11,11 @@ use enums::common::visibility::Visibility;
use errors::{anyhow, AnyhowResult};
use mysql_queries::queries::model_weights::create::create_weight::{create_weight, CreateModelWeightsArgs};
use mysql_queries::queries::users::user::get_user_token_by_username::get_user_token_by_username;
use storyteller_root::get_seed_tool_data_root;
use tokens::tokens::model_weights::ModelWeightToken;
use tokens::tokens::users::UserToken;
use crate::seeding::users::HANASHI_USERNAME;
pub async fn test_seed_weights_files() -> AnyhowResult<()> {
let seed_path = PathBuf::from("/storyteller/root/custom-seed-tool-data");
let remote_cloud_file_client = RemoteCloudFileClient::get_remote_cloud_file_client().await;
let remote_cloud_file_client = match remote_cloud_file_client {
Ok(res) => {
res
}
Err(_) => {
return Err(anyhow!("failed to get remote cloud file client"));
}
};
let mut path_dl1 = seed_path.clone();
path_dl1.push("downloads/loRA");
let mut path_dl2 = seed_path.clone();
path_dl2.push("downloads/checkpoint");
let bucket_details1 = RemoteCloudBucketDetails {
object_hash: String::from("apa0ej6es8d3ss2gwtf1cghge35qn9tn"),
prefix: String::from("sd15"),
suffix: String::from("safetensors"),
};
let bucket_details2 = RemoteCloudBucketDetails {
object_hash: String::from("27kz11et18fargyyxbj66ntfn621k9d3"),
prefix: String::from("loRA"),
suffix: String::from("safetensors"),
};
remote_cloud_file_client.download_file(bucket_details1, String::from("./checkpoint")).await?;
remote_cloud_file_client.download_file(bucket_details2, String::from("./loRA")).await?;
Ok(())
}
pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserToken) -> AnyhowResult<()> {
let sd1_5_markdown_description = r#"
# Dragonfruit AI Models Update and Workflow
@@ -126,7 +85,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
// create a loop that loops from 1 to 100
for i in 1..=100 {
// create a new weight
let weights_category = match i {
1..=20 => WeightsCategory::VoiceConversion,
@@ -146,17 +105,22 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
_ => WeightsType::LoRA
};
let model_weight_token;
let title;
let description;
let description_rendered_html;
let original_filename;
let original_download_url;
let mut model_weight_token;
let mut title;
let mut description;
let mut description_rendered_html;
let mut original_filename;
let mut original_download_url;
let _private_bucket_hash = "".to_string();
let private_bucket_prefix;
let private_bucket_extension;
let version;
let mut _private_bucket_hash:String = "".to_string();
let mut private_bucket_prefix;
let mut private_bucket_extension;
//let mut cached_user_ratings_total_count;
//let mut cached_user_ratings_positive_count;
//let mut cached_user_ratings_negative_count;
//let mut cached_user_ratings_ratio;
let mut version;
match i {
1..=20 => {
@@ -174,8 +138,14 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
original_filename = format!("gura_gwar{}.safetensors", i);
original_download_url = format!("www.google.ca");
// private_bucket_hash = format!("bucket_hash{}", i);
private_bucket_prefix = format!("_fake");
private_bucket_extension = format!("rvcV2");
//cached_user_ratings_total_count = i;
//cached_user_ratings_positive_count = i;
//cached_user_ratings_negative_count = i;
//cached_user_ratings_ratio = i as u32 / 100;
version = i as i32;
println!("Seeding RVCv2 model {}", i);
},
@@ -193,10 +163,18 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
"#;
description_rendered_html = tts_markdown_description;
original_filename = format!("filename{}.txt", i);
original_download_url = format!("https://civitai.com/api/download/models/149193?type=Model&format=SafeTensor&size=pruned&fp=fp16");
// private_bucket_hash = format!("bucket_hash{}", i);
private_bucket_prefix = format!("_fake");
private_bucket_extension = format!("tt2");
//cached_user_ratings_total_count = i;
//cached_user_ratings_positive_count = i;
//cached_user_ratings_negative_count = i;
//cached_user_ratings_ratio = i as u32 / 100;
version = i as i32;
println!("Seeding TT2 model {}", i);
},
@@ -204,12 +182,22 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
// SD 1.5
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
title = format!("dragonfruitGTv1: {}", i);
description = format!("Description Number {}:", i);
description_rendered_html = sd1_5_markdown_description;
original_filename = format!("filename{}.txt", i);
original_download_url = format!("https://civitai.com/api/download/models/149193?type=Model&format=SafeTensor&size=pruned&fp=fp16");
// private_bucket_hash = format!("bucket_hash{}", i);
private_bucket_prefix = format!("_fake");
private_bucket_extension = format!("sd15");
//cached_user_ratings_total_count = i;
//cached_user_ratings_positive_count = i;
//cached_user_ratings_negative_count = i;
//cached_user_ratings_ratio = i as u32 / 100;
version = i as i32;
println!("Seeding SD15 model {}", i);
},
@@ -233,14 +221,24 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
Have fun! 😊
"#;
let _sdxl_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/be706282-2978-42a0-aaa2-73881aad94e9/width=1024/00049-2287632957-1girl,face,curly%20hair,red%20hair,white%20background,.jpeg";
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
title = format!("SDXL_Niji_Special Edition: {}", i);
description = format!("Description Number {}:", i);
// private_bucket_hash = format!("bucket_hash{}", i);
private_bucket_prefix = format!("_fake");
private_bucket_extension = format!("sdxl");
description_rendered_html = sdxl_markdown_description;
original_filename = format!("filename{}.txt", i);
original_download_url = format!("https://civitai.com/api/download/models/149193?type=Model&format=SafeTensor&size=pruned&fp=fp16");
//cached_user_ratings_total_count = i;
//cached_user_ratings_positive_count = i;
//cached_user_ratings_negative_count = i;
//cached_user_ratings_ratio = i as u32 / 100;
version = i as i32;
println!("Seeding SDXL model {}", i);
},
@@ -250,15 +248,26 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
- **Improved Quality:** The special edition offers significantly better quality with fewer issues. It's the model as initially envisioned.
- LoRA Gawr Gura
"#;
let _lora_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/123645df-dee2-4239-863a-76a150b09c32/width=1024/00000-2171948503.jpeg";
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
title = format!("Gawr Gura LoRA: {}", i);
description = format!("Description Number {}:", i);
description_rendered_html = lora_markdown_description;
original_filename = format!("filename{}.txt", i);
original_download_url = format!("https://civitai.com/api/download/models/149193?type=Model&format=SafeTensor&size=pruned&fp=fp16");
// private_bucket_hash = format!("bucket_hash{}", i);
private_bucket_prefix = format!("_fake");
private_bucket_extension = format!("loRA");
//cached_user_ratings_total_count = i;
//cached_user_ratings_positive_count = i;
//cached_user_ratings_negative_count = i;
//cached_user_ratings_ratio = i as u32 / 100;
version = i as i32;
println!("Seeding LoRA model {}", i);
},
@@ -269,14 +278,22 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
- **Improved Quality:** The special edition offers significantly better quality with fewer issues. It's the model as initially envisioned.
- Gawr Gura MOS 4
"#;
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
title = format!("Gawr Gura: {}", i);
description = format!("Description Number {} The special edition offers significantly better quality with fewer issues. It's the model as initially envisioned.", i);
description_rendered_html = rvc_markdown_description;
original_filename = format!("gura_gwar{}.safetensors", i);
original_download_url = format!("www.google.ca");
// private_bucket_hash = format!("bucket_hash{}", i);
private_bucket_prefix = format!("_fake");
private_bucket_extension = format!("rvcV2");
//cached_user_ratings_total_count = i;
//cached_user_ratings_positive_count = i;
//cached_user_ratings_negative_count = i;
//cached_user_ratings_ratio = i as u32 / 100;
version = i as i32;
println!("Out of range");
@@ -301,7 +318,11 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
public_bucket_hash: "bucket_hash1".to_string(),
maybe_public_bucket_prefix: Some(private_bucket_prefix),
maybe_public_bucket_extension: Some(private_bucket_extension),
version: version as u32,
//cached_user_ratings_total_count,
//cached_user_ratings_positive_count,
//cached_user_ratings_negative_count,
//maybe_cached_user_ratings_ratio: Some(cached_user_ratings_ratio as f32),
version,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
};
@@ -309,452 +330,6 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
}
Ok(())
}
pub async fn seed_weights_for_testing_inference(mysql_pool: &Pool<MySql>, user_token: UserToken) -> AnyhowResult<()>{
let miyhoyo_description = r#"一个面向米哈游角色的模型合集~A collection for MIHOYO Characters~
对应人物tag记录在版本信息里,可在右侧“About this version”选项中查看。The corresponding character prompts are recorded in the version information and can be viewed in the About this version option on the right.
打开目录寻找最爱~(附带链接,点击直达)~Open the catalog, find your favorites~ (with links, click to go directly):
崩坏三 Honkai Impact 3rd:
梅比乌斯- Mobius
琪亚娜-Kiana:琪亚娜 合集-Collections for Kiana (Honkai Impact 3rd)
布洛妮娅-bronya:布洛妮娅 合集-Collections for Bronya (Honkai Impact 3rd | Honkai Star Rail)
芽衣:雷电芽衣 合集-Collections for Raiden Mei (Honkai Impact 3rd)
西琳-Sirin
魔法少女-Miracle ☆ Magical Girl
赤鸢-Jingwei
丹朱苍玄-Nuwa/Fuxi
李素裳-Li Sushang
玉骑士·月痕/锦岁玉团-Jade Knight/Auspicious Dazzle
卡莲-kallen
第六夜想曲-Sixth Serenade
符华-Fu hua
崩落
云墨丹心-Azure Empyrea
八重樱-Yae Sakura
逆神巫女-Gyakushinn Miko
御神装·勿忘-Goushinnso Memento
信花舞伎-Blooming Maiko
希尔-Seele
生死律者-Herrscher of Rebirth
栖于永夜-Eternal Night's Embrace
德莉莎-Theresa:德莉莎 合集-Collections for Theresa (Honkai Impact 3rd)
月下誓约-Lunar Vow: Crimson Love
月下初拥-Luna Kindred
花裳月纱-Rosy Bridesmaid
格蕾修-Griseo
繁星·绘世之卷-Starry Impression
天行·绘星之卷-Cosmic Expression
画中的童话-Maroon Riding Hood
原神 Genshin:
凝光-Ningguang
申鹤-Shenhe
妮露
诺艾尔
神里绫华(包含礼装)
甘雨(包含喜茶联动礼装)-Ganyu
胡桃(包含森罗联动礼装)-Hutao
琳妮特-Lynette
绮良良-Kirara
坎蒂丝-Candace
芙宁娜-Furina
芙宁娜/芙卡洛斯-Furina/Focalors
克洛琳德-Clorinde
娜维娅-Navia
丝柯克-Skirk
夏洛蒂-Charlotte
归终-Guizhong
闲云-Xianyun
千织-Chiori
夏沃蕾-Chevreuse
崩坏:星穹铁道 Honkai Star Rand:
驭空-Yukong
银狼-Silver Wolf
符玄-Fu Xuan
李素裳-Sushang
三月七(礼装)-March 7th (New Outfit)
停云-Tingyun
青雀-Qingque
布洛妮娅·兰德-Bronya Rand
镜流-Jingliu
卡芙卡-Kafka
托帕-Topaz
桂乃芬-Guinaifen
玲可-Lynx
佩拉-Peia
寒鸦-Hanya
藿藿-Huohuo
阮·梅-Ruan Mei
雪衣-Xueyi
希露瓦-Serval
绝区零 Zenless-zone-zero:
星见雅-Miyabi
猫宫又奈-Nekomata
艾莲·乔-Ellen
妮可-Nicole
苍角-Soukaku
格莉丝-Grace
珂蕾妲-koleda
可琳-Corin
其他 Others:
鹿鸣-Luming
"""#;
let sd1_5_markdown_description = r#"
00025-2161235528-1girl,(orange_hair_1.1),(zentangle, mandala, tangle, entangle_0.6),(fractal art),the most beautiful form of chaos,brutalist desi.png
00010-1626070972-elf portrait,enchanting beauty,fantasy,ethereal glow,pointed ears,delicate facial features,long elegant hair,nature-themed attir.png
00001-301370162-girl in a snowy landscape,winter coat,fluffy hood,white fur trim,breath visible in cold air,soft falling snowflakes,glistening s.png
00002-3996269517-venomous sorcerer,ominous dark robes,glowing green eyes,holding a staff with a serpent design,mystical green flames,poisonous mi.png
00003-3817469732-Thunder Deity,immense power,hovering above the sea,stormy ocean waves below,crackling lightning in fingertips,dramatic stormy cl.png
if you want to remake my front image, check this out: Lightflow | SD webUI Extension - workflow restore & save in one click - majicMIXfantasy example | Stable Diffusion Other | Civitai
v3 is here. Shouldn't be difficult to use. Simple and complex prompts can be used, unleash your imagination.
v3来了,简单复杂的提示词都可以用。
I developed the v3 version towards 2D in order to make more room for 2.5D models like majicmix lux.
v3版本我往2D发展是为了给majicmix lux等2.5D模型让出更多空间。
merged from融了:
Jack Of All by GeneratedJudge
AWPainting by DynamicWang
majicMIX fantasy v2 =
Noosphere by skumerz + dalcefoPainting + 饭特稀V08 by zhazhahui345 + GhostMix
"#;
let sd_vae_description = r"This is an earlier version of a stable VAE. Compared to other VAEs, it has a higher level of stability. I am not the creator, but I could not find this VAE on the website, so I am sharing it here.
这是较早时候的稳定VAE,与其他VAE相比具有较高的稳定性,不容易坏图。我不是作者,但是站里没找着所以搬运。#";
info!("Seeding weights for inference...");
ModelWeightToken::reset_rng_for_testing_and_dev_seeding_never_use_in_production_seriously(54321);
let model_weight_token1 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
let model_weight_token2 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
let model_weight_token3 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
let model_weight_token4 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
let model_weight_token5 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
let model_weight_token6 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
let remote_cloud_file_client = RemoteCloudFileClient::get_remote_cloud_file_client().await?;
let sd_15_weights_descriptor = Box::new(WeightsSD15Descriptor {});
let lora_descriptor = Box::new(WeightsLoRADescriptor{});
let sd_vae_15_weights_descriptor = Box::new(WeightsSD15Descriptor {});
let sd_15_weights_descriptor2 = Box::new(WeightsSD15Descriptor {});
let lora_descriptor2 = Box::new(WeightsLoRADescriptor{});
let sd_vae_15_weights_descriptor2 = Box::new(WeightsSD15Descriptor {});
let mut path_object_SD = get_seed_tool_data_root();
path_object_SD.push("models/imagegen/sd15/majicmixFantasy_v30Vae.safetensors");
let mut path_object_loRA = get_seed_tool_data_root();
path_object_loRA.push("models/imagegen/loRA/xiawolei-v100-000019.safetensors");
let mut path_to_VAE = get_seed_tool_data_root();
path_to_VAE.push("models/imagegen/vae/zVae_v20.safetensors");
// anime model
let mut path_object_SD_anime = get_seed_tool_data_root();
path_object_SD_anime.push("models/imagegen/sd15/animerge_v26.safetensors");
// hongkai clara
let mut path_object_loRA2 = get_seed_tool_data_root();
path_object_loRA2.push("models/imagegen/loRA/Clara_Honkai_Star_Rail_v2-10.safetensors");
// anime vae
let mut path_to_VAE2 = get_seed_tool_data_root();
path_to_VAE2.push("models/imagegen/vae/vaeFtMse840000EmaPruned_vae.safetensors");
let metadata1 = remote_cloud_file_client.upload_file(sd_15_weights_descriptor,path_object_SD.as_path().to_str().unwrap()).await?;
let metadata2 = remote_cloud_file_client.upload_file(lora_descriptor,path_object_loRA.as_path().to_str().unwrap()).await?;
let metadata3 = remote_cloud_file_client.upload_file(sd_vae_15_weights_descriptor,path_to_VAE.as_path().to_str().unwrap()).await?;
let metadata4 = remote_cloud_file_client.upload_file(sd_15_weights_descriptor2,path_object_SD_anime.as_path().to_str().unwrap()).await?;
let metadata5 = remote_cloud_file_client.upload_file(lora_descriptor2,path_object_loRA2.as_path().to_str().unwrap()).await?;
let metadata6 = remote_cloud_file_client.upload_file(sd_vae_15_weights_descriptor2,path_to_VAE2.as_path().to_str().unwrap()).await?;
let weights1 = CreateModelWeightsArgs {
token: &model_weight_token1, // replace with actual ModelWeightToken
weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
title: "Dragonfruit".to_string(),
maybe_description_markdown: Some(sd1_5_markdown_description.to_string()),
maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
creator_user_token: Some(&user_token), // replace with actual UserToken
creator_ip_address: "192.168.1.1",
creator_set_visibility: Visibility::Public,
maybe_last_update_user_token: Some("Last Update User Token".to_string()),
original_download_url: Some("https://civitai.com/models/41865/majicmix-fantasy".to_string()),
original_filename: Some("majicmixFantasy_v30Vae.safetensors".to_string()),
file_size_bytes: 0,
file_checksum_sha2: metadata1.sha256_checksum.to_string(),
public_bucket_hash: metadata1.bucket_details.clone().unwrap().object_hash,
maybe_public_bucket_prefix: Some(metadata1.bucket_details.clone().unwrap().prefix),
maybe_public_bucket_extension: Some(metadata1.bucket_details.clone().unwrap().suffix),
version: 1,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
};
let weights2 = CreateModelWeightsArgs {
token: &model_weight_token2, // replace with actual ModelWeightToken
weights_type: WeightsType::LoRA, // replace with actual WeightsType
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
title: "MIHOYO Collection 米家全家桶 (Honkai Impact 3rd | Honkai Star Rail | Genshin Impact | Zenless Zone Zero)".to_string(),
maybe_description_markdown: Some(miyhoyo_description.to_string()),
maybe_description_rendered_html: Some(miyhoyo_description.to_string()),
creator_user_token: Some(&user_token), // replace with actual UserToken
creator_ip_address: "292.268.2.2",
creator_set_visibility: Visibility::Public,
maybe_last_update_user_token: Some("<p> Honkai <p>".to_string()),
original_download_url: Some("https://civitai.com/models/95243/mihoyo-collection-honkai-impact-3rd-or-honkai-star-rail-or-genshin-impact-or-zenless-zone-zero".to_string()),
original_filename: Some("xiawolei-v100-000019.safetensors".to_string()),
file_size_bytes: 0,
file_checksum_sha2: metadata2.sha256_checksum.to_string(),
public_bucket_hash: metadata2.bucket_details.clone().unwrap().object_hash.clone(),
maybe_public_bucket_prefix: Some(metadata2.bucket_details.clone().unwrap().prefix),
maybe_public_bucket_extension: Some(metadata2.bucket_details.clone().unwrap().suffix),
version: 2,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
};
let weights3 = CreateModelWeightsArgs {
token: &model_weight_token3, // replace with actual ModelWeightToken
weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
title: "z-vae".to_string(),
maybe_description_markdown: Some(sd_vae_description.to_string()),
maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
creator_user_token: Some(&user_token), // replace with actual UserToken
creator_ip_address: "192.168.1.1",
creator_set_visibility: Visibility::Public,
maybe_last_update_user_token: Some("Last Update User Token".to_string()),
original_download_url: Some("https://civitai.com/models/97653/z-vae".to_string()),
original_filename: Some("zVae_v20.safetensors".to_string()),
file_size_bytes: 0,
file_checksum_sha2: metadata3.sha256_checksum.to_string(),
public_bucket_hash: metadata3.bucket_details.clone().unwrap().object_hash,
maybe_public_bucket_prefix: Some(metadata3.bucket_details.clone().unwrap().prefix),
maybe_public_bucket_extension: Some(metadata3.bucket_details.clone().unwrap().suffix),
version: 1,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
};
let weights4 = CreateModelWeightsArgs {
token: &model_weight_token4, // replace with actual ModelWeightToken
weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
title: "animerge_v26".to_string(),
maybe_description_markdown: Some(sd1_5_markdown_description.to_string()),
maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
creator_user_token: Some(&user_token), // replace with actual UserToken
creator_ip_address: "192.168.1.1",
creator_set_visibility: Visibility::Public,
maybe_last_update_user_token: Some("Last Update User Token".to_string()),
original_download_url: Some("https://civitai.com/models/144249/animerge".to_string()),
original_filename: Some("".to_string()),
file_size_bytes: 0,
file_checksum_sha2: metadata4.sha256_checksum.to_string(),
public_bucket_hash: metadata4.bucket_details.clone().unwrap().object_hash,
maybe_public_bucket_prefix: Some(metadata4.bucket_details.clone().unwrap().prefix),
maybe_public_bucket_extension: Some(metadata4.bucket_details.clone().unwrap().suffix),
version: 1,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
};
let weights5 = CreateModelWeightsArgs {
token: &model_weight_token5, // replace with actual ModelWeightToken
weights_type: WeightsType::LoRA, // replace with actual WeightsType
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
title: "clara LoRA".to_string(),
maybe_description_markdown: Some(miyhoyo_description.to_string()),
maybe_description_rendered_html: Some(miyhoyo_description.to_string()),
creator_user_token: Some(&user_token), // replace with actual UserToken
creator_ip_address: "292.268.2.2",
creator_set_visibility: Visibility::Public,
maybe_last_update_user_token: Some("<p> Honkai <p>".to_string()),
original_download_url: Some("https://civitai.com/models/56454/clara-honkai-star-rail-lora".to_string()),
original_filename: Some("clara.safetensors".to_string()),
file_size_bytes: 0,
file_checksum_sha2: metadata5.sha256_checksum.to_string(),
public_bucket_hash: metadata5.bucket_details.clone().unwrap().object_hash.clone(),
maybe_public_bucket_prefix: Some(metadata5.bucket_details.clone().unwrap().prefix),
maybe_public_bucket_extension: Some(metadata5.bucket_details.clone().unwrap().suffix),
version: 2,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
};
// some VAE
let weights6 = CreateModelWeightsArgs {
token: &model_weight_token6, // replace with actual ModelWeightToken
weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
title: "anime-vae".to_string(),
maybe_description_markdown: Some(sd_vae_description.to_string()),
maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
creator_user_token: Some(&user_token), // replace with actual UserToken
creator_ip_address: "192.168.1.1",
creator_set_visibility: Visibility::Public,
maybe_last_update_user_token: Some("Last Update User Token".to_string()),
original_download_url: Some("https://civitai.com/models/97653/????".to_string()),
original_filename: Some("zVae_v20.safetensors".to_string()),
file_size_bytes: 0,
file_checksum_sha2: metadata6.sha256_checksum.to_string(),
public_bucket_hash: metadata6.bucket_details.clone().unwrap().object_hash,
maybe_public_bucket_prefix: Some(metadata6.bucket_details.clone().unwrap().prefix),
maybe_public_bucket_extension: Some(metadata6.bucket_details.clone().unwrap().suffix),
version: 1,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
};
create_weight(weights1).await?;
create_weight(weights2).await?;
create_weight(weights3).await?;
create_weight(weights4).await?;
create_weight(weights5).await?;
create_weight(weights6).await?;
Ok(())
}
pub async fn seed_workflows_for_testing_inference(mysql_pool: &Pool<MySql>, user_token: UserToken) -> AnyhowResult<()>{
let model_weight_token1 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
let mut path_to_comfy = get_seed_tool_data_root();
path_to_comfy.push("models/workflows/comfyui/yae_video_prod.json");
let remote_cloud_file_client = RemoteCloudFileClient::get_remote_cloud_file_client().await?;
let comfy_weights_descriptor = Box::new(WeightsWorkflowDescriptor {});
let metadata1 = remote_cloud_file_client.upload_file(comfy_weights_descriptor, path_to_comfy.as_path().to_str().unwrap()).await?;
let weights1 = CreateModelWeightsArgs {
token: &model_weight_token1, // replace with actual ModelWeightToken
weights_type: WeightsType::ComfyUi, // replace with actual WeightsType
weights_category: WeightsCategory::WorkflowConfig, // replace with actual WeightsCategory
title: "yae-video-prod".to_string(),
maybe_description_markdown: Some("ComfyUI Workflow".to_string()),
maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
creator_user_token: Some(&user_token), // replace with actual UserToken
creator_ip_address: "192.168.1.1",
creator_set_visibility: Visibility::Public,
maybe_last_update_user_token: Some("Last Update User Token".to_string()),
original_download_url: Some("https://github.com/comfyanonymous/ComfyUI".to_string()),
original_filename: Some("yae_video_prod.json".to_string()),
file_size_bytes: metadata1.file_size_bytes,
file_checksum_sha2: metadata1.sha256_checksum.to_string(),
public_bucket_hash: metadata1.bucket_details.clone().unwrap().object_hash,
maybe_public_bucket_prefix: Some(metadata1.bucket_details.clone().unwrap().prefix),
maybe_public_bucket_extension: Some(metadata1.bucket_details.clone().unwrap().suffix),
version: 1,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
};
create_weight(weights1).await?;
Ok(())
}
pub async fn seed_weights_for_user_token(
mysql_pool: &Pool<MySql>,
user_token: UserToken
@@ -788,10 +363,10 @@ pub async fn seed_weights_for_user_token(
public_bucket_hash: "bucket_hash1".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("rvc".to_string()),
//cached_user_ratings_total_count: 10,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 1,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 1,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
},
@@ -813,10 +388,10 @@ pub async fn seed_weights_for_user_token(
public_bucket_hash: "bucket_hash2".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("tt2".to_string()),
//cached_user_ratings_total_count: 20,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 2,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 2,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
},
@@ -838,10 +413,10 @@ pub async fn seed_weights_for_user_token(
public_bucket_hash: "bucket_hash3".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("safetensors".to_string()),
//cached_user_ratings_total_count: 10,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 1,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 1,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
},
@@ -863,10 +438,10 @@ pub async fn seed_weights_for_user_token(
public_bucket_hash: "bucket_hash4".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("LoRA".to_string()),
//cached_user_ratings_total_count: 10,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 1,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 2,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
},
@@ -888,10 +463,10 @@ pub async fn seed_weights_for_user_token(
public_bucket_hash: "bucket_hash4".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("LoRA".to_string()),
//cached_user_ratings_total_count: 10,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 1,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 2,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
}
@@ -939,10 +514,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>, _user_token: UserTo
public_bucket_hash: "bucket_hash1".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("rvc".to_string()),
//cached_user_ratings_total_count: 10,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 1,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 1,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
},
@@ -964,10 +539,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>, _user_token: UserTo
public_bucket_hash: "bucket_hash2".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("tt2".to_string()),
//cached_user_ratings_total_count: 20,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 2,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 2,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
},
@@ -989,10 +564,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>, _user_token: UserTo
public_bucket_hash: "bucket_hash3".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("safetensors".to_string()),
//cached_user_ratings_total_count: 10,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 1,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 1,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
},
@@ -1014,10 +589,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>, _user_token: UserTo
public_bucket_hash: "bucket_hash4".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("LoRA".to_string()),
//cached_user_ratings_total_count: 10,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 1,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 2,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
},
@@ -1039,10 +614,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>, _user_token: UserTo
public_bucket_hash: "bucket_hash5".to_string(),
maybe_public_bucket_prefix: Some("_fake".to_string()),
maybe_public_bucket_extension: Some("LoRA".to_string()),
//cached_user_ratings_total_count: 10,
//cached_user_ratings_positive_count: 9,
//cached_user_ratings_negative_count: 1,
//maybe_cached_user_ratings_ratio: Some(0.9),
version: 2,
mysql_pool: &mysql_pool, // replace with actual MySqlPool
}
@@ -1055,7 +630,6 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>, _user_token: UserTo
Ok(())
}
pub async fn seed_weights(mysql_pool: &Pool<MySql>) -> AnyhowResult<()> {
info!("Seeding weights...");
@@ -1066,12 +640,9 @@ pub async fn seed_weights(mysql_pool: &Pool<MySql>) -> AnyhowResult<()> {
Some(token) => token,
};
// original_seed_weights(mysql_pool,user_token).await?;
// seed_weights_for_user_token(mysql_pool, user_token).await?;
// seed_weights_for_paging(mysql_pool,user_token).await?;
seed_weights_for_testing_inference(mysql_pool,user_token.clone()).await?;
// println!("TESTING DOWLOAD");
// test_seed_weights_files().await?;
//seed_workflows_for_testing_inference(mysql_pool,user_token.clone()).await?;
//original_seed_weights(mysql_pool,user_token).await?;
//seed_weights_for_user_token(mysql_pool, user_token).await?;
seed_weights_for_paging(mysql_pool,user_token).await?;
Ok(())
}
@@ -137,7 +137,7 @@ pub async fn seed_weights_files(
maybe_last_update_user_token: None, // Assuming there is no last update user token
original_download_url: Some(original_download_url.to_string()),
original_filename: Some(original_filename.to_string()),
file_size_bytes, // Assuming the file size is 0
file_size_bytes: file_size_bytes as i32, // Assuming the file size is 0
file_checksum_sha2: sha256_checksum.to_string(), // Assuming the file checksum is an empty string
public_bucket_hash: bucket_hash,
maybe_public_bucket_prefix: Some(maybe_bucket_prefix.to_string()),
@@ -226,5 +226,3 @@ async fn seed_file_to_bucket(
maybe_bucket_extension: maybe_bucket_extension.map(|s| s.to_string()),
})
}
+4 -4
View File
@@ -64,10 +64,10 @@ pub async fn main() -> AnyhowResult<()> {
let bytes = file_read_bytes(args.file_path)?;
let mimetype = get_mimetype_for_bytes(&bytes);
let media_file_type;
let maybe_mime_type;
let maybe_public_bucket_prefix;
let maybe_public_bucket_extension;
let mut media_file_type;
let mut maybe_mime_type;
let mut maybe_public_bucket_prefix;
let mut maybe_public_bucket_extension;
match mimetype {
Some("audio/wav") |
+2 -4
View File
@@ -14,7 +14,6 @@ use sqlx::mysql::MySqlPoolOptions;
use config::shared_constants::DEFAULT_RUST_LOG;
use elasticsearch_schema::searches::search_model_weights::search_model_weights;
use elasticsearch_schema::searches::search_tts_models::search_tts_models;
use enums::by_table::model_weights::weights_types::WeightsType;
use errors::AnyhowResult;
use crate::cli_args::{Action, Environment, parse_cli_args};
@@ -56,10 +55,9 @@ pub async fn main() -> AnyhowResult<()> {
}
Action::SearchModelWeights => {
info!("Searching model weights...");
//let results = search_model_weights(&elasticsearch, "zel", Some("en"), Some(WeightsType::SoVitsSvc)).await?;
let results = search_model_weights(&elasticsearch, "zel", None, Some(WeightsType::RvcV2), None).await?;
let results = search_model_weights(&elasticsearch, "zel", Some("en")).await?;
for result in results {
println!("Result: {:#?}", result);
println!("Result: {:?}", result);
}
}
}
-47
View File
@@ -1,47 +0,0 @@
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)
}
+2 -16
View File
@@ -5,21 +5,17 @@
use std::time::Duration;
use log::info;
use sqlx::{MySql, Pool};
use sqlx::mysql::MySqlPoolOptions;
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;
@@ -44,20 +40,10 @@ pub async fn main() -> AnyhowResult<()> {
bucket_production_private: get_bucket_client("PRODUCTION_PRIVATE")?,
};
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?;
}
}
migrate_voice_conversion_to_weights(&deps).await?;
Ok(())
}
async fn get_mysql(env_var_name: &str) -> AnyhowResult<Pool<MySql>> {
info!("Connecting to MySQL {env_var_name}...");
@@ -1,2 +1 @@
pub mod tts_models_to_weights;
pub mod voice_conversion_to_weights;
@@ -1,47 +0,0 @@
use tempdir::TempDir;
use buckets::public::weight_files::bucket_file_path::WeightFileBucketPath;
use cloud_storage::bucket_path_unifier::BucketPathUnifier;
use errors::AnyhowResult;
use filesys::safe_delete_temp_directory::safe_delete_temp_directory;
use filesys::safe_delete_temp_file::safe_delete_temp_file;
use hashing::sha256::sha256_hash_file::sha256_hash_file;
use mysql_queries::queries::model_weights::migration::upsert_model_weight_from_tts_model::CopiedTtsFileData;
use mysql_queries::queries::tts::tts_models::migration::list_whole_tts_models_using_cursor::WholeTtsModelRecord;
use crate::deps::Deps;
pub async fn copy_cloud_files(model: &WholeTtsModelRecord, deps: &Deps) -> AnyhowResult<CopiedTtsFileData> {
let copied_file_data = copy_model(model, deps).await?;
Ok(copied_file_data)
}
async fn copy_model(model: &WholeTtsModelRecord, deps: &Deps) -> AnyhowResult<CopiedTtsFileData> {
let bucket_path_unifier = BucketPathUnifier::default_paths();
let old_model_bucket_path = bucket_path_unifier.tts_synthesizer_path(&model.private_bucket_hash);
// TODO(bt,2023-12-19): Probably faster to stream between buckets, but whatever.
let temp_dir = TempDir::new("model_transfer")?;
let model_temp_fs_path = temp_dir.path().join("model.bin");
deps.bucket_production_private.download_file_to_disk(&old_model_bucket_path, &model_temp_fs_path).await?;
let file_checksum = sha256_hash_file(&model_temp_fs_path)?;
let new_model_bucket_path = WeightFileBucketPath::generate_for_tt2_model();
deps.bucket_production_public.upload_filename_with_content_type(
&new_model_bucket_path.get_full_object_path_str(),
&model_temp_fs_path,
"application/octet-stream").await?;
safe_delete_temp_file(&model_temp_fs_path);
safe_delete_temp_directory(&temp_dir);
Ok(CopiedTtsFileData {
bucket_path: new_model_bucket_path,
file_sha_hash: file_checksum,
})
}
@@ -1,95 +0,0 @@
use std::thread;
use std::time::Duration;
use log::{info, warn};
use buckets::public::weight_files::bucket_file_path::WeightFileBucketPath;
use enums::by_table::model_weights::weights_types::WeightsType;
use errors::AnyhowResult;
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
use mysql_queries::queries::model_weights::migration::upsert_model_weight_from_tts_model::{CopiedTtsFileData, upsert_model_weight_from_tts_model};
use mysql_queries::queries::tts::tts_models::migration::list_whole_tts_models_using_cursor::{list_whole_tts_models_using_cursor, WholeTtsModelRecord};
use tokens::tokens::model_weights::ModelWeightToken;
use crate::deps::Deps;
use crate::migrations::tts_models_to_weights::copy_cloud_files::copy_cloud_files;
const PAGE_SIZE: u64 = 10;
// TODO(bt,2024-01-15): This hasn't been fully vetted / tested. Do not run until it's combed over.
pub async fn migrate_tts_to_weights(deps: &Deps) -> AnyhowResult<()> {
let mut cursor = 0;
let mut counter = 0;
loop {
info!("Querying {PAGE_SIZE} models at cursor = {cursor}");
let results
= list_whole_tts_models_using_cursor(&deps.mysql_production, PAGE_SIZE, cursor).await?;
if results.is_empty() {
warn!("No more results found; exiting.");
break;
}
for result in results.iter() {
println!("\n\nmigrating over (counter: {counter}, id: {}, token: {:?}) : {:?} ...", result.id, result.token, result);
copy_model_record_and_bucket_files(result, &deps).await?;
counter += 1;
}
if let Some(last_id) = results.last().map(|result| result.id) {
cursor = last_id as u64;
}
thread::sleep(Duration::from_millis(500));
}
Ok(())
}
async fn copy_model_record_and_bucket_files(record: &WholeTtsModelRecord, deps: &Deps) -> AnyhowResult<()> {
let mut maybe_copied_data = None;
match &record.maybe_migration_new_model_weights_token {
None => {
info!("Copying bucket files for record {:?} ...", record.token);
let result = copy_cloud_files(record, &deps).await?;
maybe_copied_data = Some(result);
}
Some(token) => {
info!("Existing migrated record; skipping cloud bucket copy...");
maybe_copied_data = lookup_bucket_details_from_record(token, &deps).await?;
}
}
if let Some(copied_data) = &maybe_copied_data {
info!("Upserting records...");
upsert_model_weight_from_tts_model(record, &deps.mysql_production, copied_data).await?;
}
Ok(())
}
/// Look up the bucket storage details from a previously-migrated record
async fn lookup_bucket_details_from_record(model_weight_token: &ModelWeightToken, deps: &Deps) -> AnyhowResult<Option<CopiedTtsFileData>> {
let maybe_model_weight_record =
get_weight_by_token(model_weight_token, true, &deps.mysql_production).await?;
let model_weight_record = match maybe_model_weight_record {
None => return Ok(None),
Some(record) => record,
};
let bucket_path = match model_weight_record.weights_type {
WeightsType::Tacotron2 => WeightFileBucketPath::tt2_model_file_from_object_hash(&model_weight_record.public_bucket_hash),
_ => return Ok(None), // NB: SVC, RVC, Stable Diffusion, etc. aren't valid for TTS migration
};
Ok(Some(CopiedTtsFileData {
bucket_path,
file_sha_hash: model_weight_record.file_checksum_sha2,
}))
}
@@ -1,2 +0,0 @@
pub mod copy_cloud_files;
pub mod migrate;
@@ -6,7 +6,7 @@ use log::{info, warn};
use buckets::public::weight_files::bucket_file_path::WeightFileBucketPath;
use enums::by_table::model_weights::weights_types::WeightsType;
use errors::AnyhowResult;
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
use mysql_queries::queries::model_weights::get_weight::get_weight_by_token;
use mysql_queries::queries::model_weights::migration::upsert_model_weight_from_voice_conversion_model::{CopiedFileData, upsert_model_weight_from_voice_conversion_model};
use mysql_queries::queries::voice_conversion::migration::list_whole_voice_conversion_models_using_cursor::{list_whole_voice_conversion_models_using_cursor, WholeVoiceConversionModelRecord};
use tokens::tokens::model_weights::ModelWeightToken;
@@ -19,6 +19,7 @@ pub trait BucketOrchestrationCore {
bytes: &[u8],
content_type: &str,
is_public: bool) -> AnyhowResult<()>;
}
@@ -1,9 +1,6 @@
use crate::remote_file_manager::remote_cloud_bucket_details::RemoteCloudBucketDetails;
#[derive(Debug, Clone)]
pub struct FileMetaData {
pub file_size_bytes: u64,
pub sha256_checksum: String,
pub mimetype: String,
pub bucket_details: Option<RemoteCloudBucketDetails>
pub mimetype: String
}
@@ -1,59 +0,0 @@
use crate::remote_file_manager::file_descriptor::FileDescriptor;
// TODO ASK BRANDON WHAT path should this be?
const MEDIA_FILE_DIRECTORY: &str = "/media";
pub struct MediaImagePngDescriptor;
impl FileDescriptor for MediaImagePngDescriptor {
fn remote_directory_path(&self) -> &str {
MEDIA_FILE_DIRECTORY
}
fn get_suffix(&self)->String {
"png".to_string()
}
fn get_prefix(&self)->String {
"image".to_string()
}
fn is_public(&self) -> bool {
true
}
}
pub struct MediaVideoMp4Descriptor;
impl FileDescriptor for MediaVideoMp4Descriptor {
fn remote_directory_path(&self) -> &str {
MEDIA_FILE_DIRECTORY
}
fn get_suffix(&self)->String {
"mp4".to_string()
}
fn get_prefix(&self)->String {
"video".to_string()
}
fn is_public(&self) -> bool {
true
}
}
pub struct UploadVideoMp4Descriptor;
impl FileDescriptor for UploadVideoMp4Descriptor {
fn remote_directory_path(&self) -> &str {
MEDIA_FILE_DIRECTORY
}
fn get_suffix(&self)->String {
"mp4".to_string()
}
fn get_prefix(&self)->String {
"upload".to_string()
}
fn is_public(&self) -> bool {
true
}
}
@@ -1,8 +1,7 @@
use crate::remote_file_manager::media_descriptor;
use crate::remote_file_manager::weights_descriptor::{self};
use super::file_descriptor::FileDescriptor;
#[derive(Debug, Clone)]
pub struct RemoteCloudBucketDetails {
pub object_hash: String,
pub prefix: String,
@@ -29,14 +28,8 @@ impl RemoteCloudBucketDetails {
pub fn file_descriptor_from_bucket_details(&self) -> Box<dyn FileDescriptor> {
match self.prefix.as_str() {
// Weights
"loRA" => Box::new(weights_descriptor::WeightsLoRADescriptor {}),
"sd15" =>
match self.suffix.as_str() {
"safetensors" => Box::new(weights_descriptor::WeightsSD15Descriptor {}),
"ckpt" => Box::new(weights_descriptor::WeightsSD15CkptDescriptor {}),
_ => panic!("Unknown suffix: {}",self.suffix)
},
"sd15" => Box::new(weights_descriptor::WeightsSD15Descriptor {}),
"sdxl" => Box::new(weights_descriptor::WeightsSDXLDescriptor {}),
"valle_prompt" => Box::new(weights_descriptor::WeightsVallePromptDescriptor {}),
"rvc" => {
@@ -47,26 +40,6 @@ impl RemoteCloudBucketDetails {
}
},
"svc" => Box::new(weights_descriptor::WeightsSVCDescriptor {}),
"workflow" => Box::new(weights_descriptor::WeightsWorkflowDescriptor {}),
// Media
"image" => {
match self.suffix.as_str() {
"png" => Box::new(media_descriptor::MediaImagePngDescriptor {}),
_ => panic!("Unknown suffix: {}",self.suffix)
}
},
"video" => {
match self.suffix.as_str() {
"mp4" => Box::new(media_descriptor::MediaVideoMp4Descriptor {}),
_ => panic!("Unknown suffix: {}",self.suffix)
}
},
"upload" => {
match self.suffix.as_str() {
"mp4" => Box::new(media_descriptor::UploadVideoMp4Descriptor {}),
_ => panic!("Unknown suffix: {}",self.suffix)
}
},
_ => panic!("Unknown prefix: {}", self.prefix)
}
}
@@ -1,6 +1,4 @@
use anyhow::anyhow;
use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
use errors::AnyhowResult;
use filesys::file_read_bytes::file_read_bytes;
use filesys::file_size::file_size;
@@ -19,7 +17,12 @@ pub struct RemoteCloudFileClient {
}
impl RemoteCloudFileClient {
pub fn new(bucket_orchestration_client: Box<dyn BucketOrchestrationCore>) -> Self {
Self {
bucket_orchestration_client
}
}
pub async fn get_remote_cloud_file_client() -> AnyhowResult<Self> {
let bucket_orchestration = match BucketOrchestration::new_bucket_client_from_existing_env() {
Ok(client) => client,
@@ -33,31 +36,16 @@ impl RemoteCloudFileClient {
})
}
pub fn new(bucket_orchestration_client: Box<dyn BucketOrchestrationCore>) -> Self {
Self {
bucket_orchestration_client
}
}
// Where the to_system_file_path is let sd_checkpoint_path = work_temp_dir.path().join("sd_checkpoint.safetensors"); path and file name and extension
pub async fn download_file(&self, remote_cloud_bucket_details:RemoteCloudBucketDetails, to_system_file_path:String) -> AnyhowResult<()> {
let file_descriptor = remote_cloud_bucket_details.file_descriptor_from_bucket_details();
let file_bucket_directory = FileBucketDirectory::from_existing_bucket_details(remote_cloud_bucket_details);
let full_remote_cloud_file_path = file_bucket_directory.get_full_remote_cloud_file_path().to_string();
let is_public = file_descriptor.is_public();
let is_public = file_descriptor.is_public().clone();
self.bucket_orchestration_client.download_file_to_disk(full_remote_cloud_file_path, to_system_file_path, is_public).await?;
Ok(())
}
pub async fn download_media_file(&self, media_file_path: &MediaFileBucketPath, to_system_file_path: String) -> AnyhowResult<()> {
const IS_PUBLIC: bool = true; // NB: Media files are always public
let full_remote_cloud_file_path = media_file_path.get_full_object_path_str().to_string();
self.bucket_orchestration_client.download_file_to_disk(full_remote_cloud_file_path, to_system_file_path, IS_PUBLIC).await?;
Ok(())
}
// return error or success with meta data.
pub async fn upload_file(&self, file_descriptor:Box<dyn FileDescriptor>, from_system_file_path:&str) -> AnyhowResult<FileMetaData> {
@@ -65,26 +53,17 @@ impl RemoteCloudFileClient {
println!("Reading media file: {:?}", from_system_file_path);
// get meta data
let bytes = file_read_bytes(from_system_file_path)?;
let mut result = Self::get_file_meta_data(from_system_file_path)?;
let result = Self::get_file_meta_data(from_system_file_path)?;
let is_public = file_descriptor.is_public();
let suffix = file_descriptor.get_suffix().clone();
let prefix = file_descriptor.get_prefix().clone();
let directory = FileBucketDirectory::generate_new(
file_descriptor
);
result.bucket_details = Some(RemoteCloudBucketDetails {
object_hash: directory.get_file_object_hash().to_string(),
suffix,
prefix,
});
println!("Uploading media file to bucket path: {:?}",directory.get_full_remote_cloud_file_path());
self.bucket_orchestration_client.upload_file_with_content_type_process(
&directory.get_full_remote_cloud_file_path(),
&directory.get_remote_cloud_base_directory(),
bytes.as_ref(),
result.mimetype.as_ref(),
is_public
@@ -94,7 +73,7 @@ impl RemoteCloudFileClient {
}
// Retrieve the metadata from the file
pub fn get_file_meta_data(system_file_path:&str) -> AnyhowResult<FileMetaData> {
fn get_file_meta_data(system_file_path:&str) -> AnyhowResult<FileMetaData> {
let file_size_bytes = file_size(system_file_path.clone())?;
let sha256_checksum = sha256_hash_file(system_file_path.clone())?;
@@ -104,8 +83,7 @@ impl RemoteCloudFileClient {
Ok(FileMetaData {
file_size_bytes,
sha256_checksum,
mimetype: mimetype.to_string(),
bucket_details: None
mimetype: mimetype.to_string()
})
}
}
@@ -114,7 +92,6 @@ impl RemoteCloudFileClient {
mod tests {
use async_trait::async_trait;
use env_logger;
use errors::AnyhowResult;
use crate::remote_file_manager::bucket_orchestration::BucketOrchestrationCore;
@@ -148,8 +125,7 @@ mod tests {
is_public: bool) -> AnyhowResult<()> {
println!("Upload File to Disk");
println!("{}",object_name);
// this is random you have to just check the outputs
//assert_eq!(object_name,String::from("/weights/2/y/q/m/2/2yqm2f1bamh88seyd690h9v24apgezhr/loRA_2yqm2f1bamh88seyd690h9v24apgezhr.safetensors"));
assert_eq!(object_name,String::from("/weights/2/y/q/m/2/2yqm2f1bamh88seyd690h9v24apgezhr/loRA_2yqm2f1bamh88seyd690h9v24apgezhr.safetensors"));
println!("ContentType:{}",content_type);
println!("{}",is_public);
assert_eq!(is_public,true);
@@ -3,6 +3,7 @@ use super::file_descriptor::FileDescriptor;
pub struct WeightsLoRADescriptor;
const REMOTE_FILE_DIRECTORY: &str = "/weights";
impl FileDescriptor for WeightsLoRADescriptor {
fn remote_directory_path(&self) -> &str {
REMOTE_FILE_DIRECTORY
@@ -25,7 +26,6 @@ impl FileDescriptor for WeightsLoRADescriptor {
}
}
pub struct WeightsSD15Descriptor;
impl FileDescriptor for WeightsSD15Descriptor {
@@ -50,30 +50,6 @@ impl FileDescriptor for WeightsSD15Descriptor {
}
}
pub struct WeightsSD15CkptDescriptor;
impl FileDescriptor for WeightsSD15CkptDescriptor {
fn remote_directory_path(&self) -> &str {
REMOTE_FILE_DIRECTORY
}
// this will be the type of file peroid is handled by the file formatter
// e.g safetensors bin jpg
fn get_suffix(&self)->String {
"ckpt".to_string()
}
// This will be the prefix of the media type or the weights type.
// name of the weights or the name of the media type
// vall-e_prompt, SD15, sd15, sdxl when implmenting add to the end
fn get_prefix(&self)->String {
"sd15".to_string()
}
// This will be ensure that the right bucket is picked
fn is_public(&self) -> bool {
true
}
}
pub struct WeightsSDXLDescriptor;
@@ -193,24 +169,4 @@ impl FileDescriptor for crate::remote_file_manager::weights_descriptor::WeightsV
fn is_public(&self) -> bool {
true
}
}
pub struct WeightsWorkflowDescriptor;
impl FileDescriptor for WeightsWorkflowDescriptor {
fn remote_directory_path(&self) -> &str {
REMOTE_FILE_DIRECTORY
}
fn get_suffix(&self) -> String {
"json".to_string()
}
fn get_prefix(&self) -> String {
"workflow".to_string()
}
fn is_public(&self) -> bool {
true
}
}
}
@@ -57,59 +57,6 @@ impl GoogleDriveDownloadCommand {
}
}
pub async fn download_file_with_file_name(&self,
download_url: &str,
temp_dir: &TempDir,
file_name:&str) -> AnyhowResult<String>
{
let temp_dir_path = temp_dir.path()
.to_str()
.unwrap_or("/tmp")
.to_string();
let temp_filename = format!("{}/{}", temp_dir_path, file_name);
info!("Downloading {} to: {}", download_url, temp_filename);
let mut command = format!("{} --url \"{}\" --output_filename {}",
&self.download_script,
download_url,
&temp_filename);
if let Some(venv_activation_script) = self.maybe_venv_activation_script.as_deref() {
// NB: "." is source for non-bash shells
command = format!(". {} && {}",
venv_activation_script,
&command);
}
if let Some(change_to_directory) = self.maybe_change_to_directory.as_deref() {
command = format!("cd {} && {}",
change_to_directory,
&command);
}
if let Some(docker_options) = self.maybe_docker_options.as_ref() {
command = docker_options.to_command_string(&command);
}
info!("Running command: {}", command);
let result = Command::new("sh")
.arg("-c")
.arg(command)
.output()?;
info!("Downloader Result: {:?}", result);
if !result.status.success() {
let reason = String::from_utf8(result.stderr).unwrap_or("UNKNOWN".to_string());
return Err(anyhow!("Failure to execute command: {:?}", reason))
}
Ok(temp_filename)
}
/// Download file from Google Drive into the `TempDir`.
/// Return the local filesystem filename.
pub async fn download_file(&self,
@@ -30,7 +30,7 @@ impl TtlKeyCounter {
Ok(0)
}
Some(count) => {
let return_count = *count;
let return_count = count.clone();
*count = count.saturating_add(1);
Ok(return_count)
}
+2 -17
View File
@@ -13,10 +13,7 @@ pub enum EnvError {
reason: String
},
/// The required environment variable wasn't present.
RequiredNotPresent {
/// The name of the missing environment variable.
name: String
},
RequiredNotPresent,
}
impl Display for EnvError {
@@ -24,19 +21,7 @@ impl Display for EnvError {
let reason = match self {
EnvError::NotUnicode => "EnvError::NotUnicode",
EnvError::ParseError { .. } => "EnvError::ParseError",
EnvError::RequiredNotPresent { name } =>
return write!(f, r#"
EnvError::RequiredNotPresent: the following environment variable was not present:
---> {:?}
In development, setting it in the environment config files: .env, .env-secrets,
cargo/service/../{{app_name}}/config/{{app_name}}.development.env, etc.
If it looks like it might be a secret, ask for help in our company Discord.
In production, make sure these environment variables are set in Kubernetes.
"#, name),
EnvError::RequiredNotPresent => "EnvError::RequiredNotPresent",
};
write!(f, "{:?}", reason)
}
+1 -1
View File
@@ -51,7 +51,7 @@ pub fn get_env_bool_required(env_name: &str) -> Result<bool, EnvError> {
.and_then(|maybe| match maybe {
None => {
warn!("Env var '{}' not supplied.", env_name);
Err(EnvError::RequiredNotPresent { name: env_name.to_string() })
Err(EnvError::RequiredNotPresent)
},
Some(val) => Ok(val),
})
+1 -1
View File
@@ -12,7 +12,7 @@ pub fn get_env_duration_seconds_required(env_name: &str) -> Result<Duration, Env
.and_then(|maybe| match maybe {
None => {
warn!("Env var '{}' not supplied.", env_name);
Err(EnvError::RequiredNotPresent { name: env_name.to_string() })
Err(EnvError::RequiredNotPresent)
},
Some(val) => Ok(val),
})
+1 -1
View File
@@ -15,7 +15,7 @@ pub fn get_env_pathbuf_required(env_name: &str) -> Result<PathBuf, EnvError> {
.and_then(|maybe| match maybe {
None => {
warn!("Env var '{}' not supplied.", env_name);
Err(EnvError::RequiredNotPresent { name: env_name.to_string() })
Err(EnvError::RequiredNotPresent)
},
Some(val) => Ok(val),
})

Some files were not shown because too many files have changed in this diff Show More