Merge remote-tracking branch 'origin/master' into feature/comfyui
# Conflicts: # crates/lib/api_clients/cloud_storage/src/remote_file_manager/media_descriptor.rs # crates/lib/api_clients/cloud_storage/src/remote_file_manager/remote_cloud_bucket_details.rs
This commit is contained in:
commit
aff8d5d310
53 files changed
+2014
-171
No files matched your search
+399
@@ -0,0 +1,399 @@
|
||||
{
|
||||
"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 | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 33,
|
||||
"name": "user_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 34,
|
||||
"name": "mod_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "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"
|
||||
}
|
||||
+399
@@ -0,0 +1,399 @@
|
||||
{
|
||||
"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 | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 33,
|
||||
"name": "user_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 34,
|
||||
"name": "mod_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "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"
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"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": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "mod_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "be70e3bd4a946da7bd66a29a94e659b25f40a33ef5973a8ff34bfabe08db4051"
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"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": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "mod_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "d243270734f48fce2f5072ddbde224abf24858c6484995949c98382aa58840a7"
|
||||
}
|
||||
+1
-2
@@ -43,8 +43,7 @@ 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 (TODO)
|
||||
"unused_mut", # Be strict about mutability
|
||||
|
||||
# Possible:
|
||||
# "clippy::ptr_arg",
|
||||
|
||||
@@ -165,6 +165,7 @@ 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),
|
||||
|
||||
@@ -43,6 +43,7 @@ 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(
|
||||
|
||||
@@ -127,7 +127,7 @@ mod tests {
|
||||
fn all_variants() {
|
||||
// Static check
|
||||
let mut variants = InferenceCategory::all_variants();
|
||||
assert_eq!(variants.len(), 6);
|
||||
assert_eq!(variants.len(), 7);
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::LipsyncAnimation));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::TextToSpeech));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::VoiceConversion));
|
||||
|
||||
@@ -165,8 +165,8 @@ mod tests {
|
||||
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::StyleTTS2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::ComfyUi));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::StyleTTS2));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
|
||||
// Generated check
|
||||
|
||||
@@ -189,6 +189,7 @@ mod tests {
|
||||
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));
|
||||
@@ -196,7 +197,6 @@ mod tests {
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::ZeroShotVoiceEmbedding));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::ModelWeights));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::FileUpload));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::WorkflowResult));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
|
||||
// Generated check
|
||||
|
||||
@@ -142,7 +142,7 @@ mod tests {
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
let mut variants = MediaFileOriginModelType::all_variants();
|
||||
assert_eq!(variants.len(), 10);
|
||||
assert_eq!(variants.len(), 9);
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::RvcV2));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::SadTalker));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::SoVitsSvc));
|
||||
|
||||
@@ -8,6 +8,7 @@ use errors::AnyhowResult;
|
||||
use crate::bucket_clients::get_bucket_clients;
|
||||
use crate::cli_args::parse_cli_args;
|
||||
use crate::seeding::model_weights::seed_weights;
|
||||
use crate::seeding::media_files::seed_media_seedtool;
|
||||
use crate::seeding::seed_media_files::seed_media_files;
|
||||
use crate::seeding::tts_tacotron2::seed_tts_tacotron2;
|
||||
use crate::seeding::users::seed_user_accounts;
|
||||
@@ -56,6 +57,7 @@ pub async fn main() -> AnyhowResult<()> {
|
||||
//seed_zero_shot_tts(&pool, maybe_bucket_clients.as_ref()).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?;
|
||||
|
||||
// should seed the weights with a few files for hanashi
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
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 weights...");
|
||||
|
||||
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(())
|
||||
}
|
||||
@@ -4,4 +4,5 @@ pub mod tts_tacotron2;
|
||||
pub mod users;
|
||||
pub mod voice_conversion;
|
||||
pub mod zero_shot_tts;
|
||||
pub mod seed_model_weights;
|
||||
pub mod seed_model_weights;
|
||||
pub(crate) mod media_files;
|
||||
@@ -146,22 +146,22 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
_ => WeightsType::LoRA
|
||||
};
|
||||
|
||||
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 model_weight_token;
|
||||
let title;
|
||||
let description;
|
||||
let description_rendered_html;
|
||||
let original_filename;
|
||||
let original_download_url;
|
||||
|
||||
let mut _private_bucket_hash:String = "".to_string();
|
||||
let mut private_bucket_prefix;
|
||||
let mut private_bucket_extension;
|
||||
let _private_bucket_hash = "".to_string();
|
||||
let private_bucket_prefix;
|
||||
let 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;
|
||||
let version;
|
||||
|
||||
match i {
|
||||
1..=20 => {
|
||||
|
||||
@@ -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 mut media_file_type;
|
||||
let mut maybe_mime_type;
|
||||
let mut maybe_public_bucket_prefix;
|
||||
let mut maybe_public_bucket_extension;
|
||||
let media_file_type;
|
||||
let maybe_mime_type;
|
||||
let maybe_public_bucket_prefix;
|
||||
let maybe_public_bucket_extension;
|
||||
|
||||
match mimetype {
|
||||
Some("audio/wav") |
|
||||
|
||||
@@ -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_weight::get_weight_by_token;
|
||||
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;
|
||||
|
||||
@@ -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_weight::get_weight_by_token;
|
||||
use mysql_queries::queries::model_weights::get::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;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::remote_file_manager::file_descriptor::FileDescriptor;
|
||||
|
||||
// TODO ASK BRANDON WHAT path should this be?
|
||||
const MEDIA_FILE_DIRECTORY: &str = "/media";
|
||||
|
||||
@@ -27,12 +26,11 @@ impl FileDescriptor for MediaVideoMp4Descriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
MEDIA_FILE_DIRECTORY
|
||||
}
|
||||
|
||||
fn get_suffix(&self) -> String {
|
||||
fn get_suffix(&self)->String {
|
||||
"mp4".to_string()
|
||||
}
|
||||
|
||||
fn get_prefix(&self) -> String {
|
||||
fn get_prefix(&self)->String {
|
||||
"video".to_string()
|
||||
}
|
||||
|
||||
|
||||
+6
-7
@@ -1,4 +1,3 @@
|
||||
use crate::remote_file_manager::media_descriptor;
|
||||
use crate::remote_file_manager::weights_descriptor::{self};
|
||||
use super::file_descriptor::FileDescriptor;
|
||||
|
||||
@@ -44,18 +43,18 @@ impl RemoteCloudBucketDetails {
|
||||
"svc" => Box::new(weights_descriptor::WeightsSVCDescriptor {}),
|
||||
"workflow" => Box::new(weights_descriptor::WeightsWorkflowDescriptor {}),
|
||||
// Media
|
||||
"video" => {
|
||||
match self.suffix.as_str() {
|
||||
"mp4" => Box::new(media_descriptor::MediaVideoMp4Descriptor {}),
|
||||
_ => panic!("Unknown suffix: {}",self.suffix)
|
||||
}
|
||||
},
|
||||
"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)
|
||||
}
|
||||
},
|
||||
_ => panic!("Unknown prefix: {}", self.prefix)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ impl JobStats {
|
||||
|
||||
pub fn get_status(&self) -> AnyhowResult<SuccessAndFailureStats> {
|
||||
// NB: lock errors can't be moved between threads, so we change their type
|
||||
let mut lock = self.inner.read()
|
||||
let lock = self.inner.read()
|
||||
.map_err(|e| anyhow!("lock read error: {:?}", e))?;
|
||||
|
||||
Ok(SuccessAndFailureStats {
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use sqlx::MySql;
|
||||
use sqlx::pool::PoolConnection;
|
||||
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use mysql_queries::queries::model_weights::get::get_weight_for_legacy_tts_enqueue::{get_weight_for_legacy_tts_enqueue_with_connection, ModelWeightForLegacyTtsInference};
|
||||
use mysql_queries::queries::tts::tts_models::get_tts_model::{get_tts_model_by_token_using_connection, TtsModelRecord};
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
/// Get TTS model
|
||||
/// This is for the tts inference page.
|
||||
pub async fn get_tts_model_for_inference_migration(
|
||||
token: &str,
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
can_see_deleted: bool,
|
||||
use_weights_table: bool,
|
||||
) -> AnyhowResult<Option<TtsModelForInferenceMigration>> {
|
||||
// NB: This is temporary migration code as we switch from the `tts_models` table to the `model_weights` table.
|
||||
if use_weights_table {
|
||||
let token = ModelWeightToken::new_from_str(token);
|
||||
|
||||
let maybe_model = get_weight_for_legacy_tts_enqueue_with_connection(
|
||||
&token,
|
||||
can_see_deleted,
|
||||
mysql_connection
|
||||
).await?;
|
||||
|
||||
Ok(maybe_model.map(|model| TtsModelForInferenceMigration::ModelWeight(model)))
|
||||
|
||||
} else {
|
||||
|
||||
let maybe_model = get_tts_model_by_token_using_connection(
|
||||
&token,
|
||||
true,
|
||||
mysql_connection
|
||||
).await?;
|
||||
|
||||
Ok(maybe_model.map(|model| TtsModelForInferenceMigration::LegacyTts(model)))
|
||||
}
|
||||
}
|
||||
|
||||
/// Union over the legacy table and the new table to support an easier migration.
|
||||
/// This enum can hold a record of either type and present a unified accessor interface.
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub enum TtsModelForInferenceMigration {
|
||||
/// Old type from the `tts_models` table, on the way out
|
||||
LegacyTts(TtsModelRecord),
|
||||
/// New type, replacing the `tts_models` table.
|
||||
ModelWeight(ModelWeightForLegacyTtsInference),
|
||||
}
|
||||
|
||||
impl TtsModelForInferenceMigration {
|
||||
pub fn token(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.model_token.as_str(),
|
||||
Self::ModelWeight(ref model) => model.token.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_user_token(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.creator_user_token,
|
||||
Self::ModelWeight(ref model) => model.creator_user_token.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_set_visibility(&self) -> Visibility{
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.creator_set_visibility,
|
||||
Self::ModelWeight(ref model) => model.creator_set_visibility,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use sqlx::MySql;
|
||||
use sqlx::pool::PoolConnection;
|
||||
use enums::by_table::tts_models::tts_model_type::TtsModelType;
|
||||
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use mysql_queries::column_types::vocoder_type::VocoderType;
|
||||
use mysql_queries::queries::model_weights::get::get_weight_for_legacy_tts_info::{get_weight_for_legacy_tts_info_with_connection, ModelWeightForLegacyTtsInfo};
|
||||
use mysql_queries::queries::tts::tts_models::get_tts_model::{get_tts_model_by_token_using_connection, TtsModelRecord};
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
/// Get TTS model
|
||||
/// This is for the tts model info page
|
||||
pub async fn get_tts_model_info_migration(
|
||||
token: &str,
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
can_see_deleted: bool,
|
||||
use_weights_table: bool,
|
||||
) -> AnyhowResult<Option<TtsModelInfoMigration>> {
|
||||
// NB: This is temporary migration code as we switch from the `tts_models` table to the `model_weights` table.
|
||||
if use_weights_table {
|
||||
let token = ModelWeightToken::new_from_str(token);
|
||||
|
||||
let maybe_model = get_weight_for_legacy_tts_info_with_connection(
|
||||
&token,
|
||||
can_see_deleted,
|
||||
mysql_connection
|
||||
).await?;
|
||||
|
||||
Ok(maybe_model.map(|model| TtsModelInfoMigration::ModelWeight(model)))
|
||||
|
||||
} else {
|
||||
let maybe_model = get_tts_model_by_token_using_connection(
|
||||
&token,
|
||||
true,
|
||||
mysql_connection
|
||||
).await?;
|
||||
|
||||
Ok(maybe_model.map(|model| TtsModelInfoMigration::LegacyTts(model)))
|
||||
}
|
||||
}
|
||||
|
||||
/// Union over the legacy table and the new table to support an easier migration.
|
||||
/// This enum can hold a record of either type and present a unified accessor interface.
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub enum TtsModelInfoMigration {
|
||||
/// Old type from the `tts_models` table, on the way out
|
||||
LegacyTts(TtsModelRecord),
|
||||
/// New type, replacing the `tts_models` table.
|
||||
ModelWeight(ModelWeightForLegacyTtsInfo),
|
||||
}
|
||||
|
||||
impl TtsModelInfoMigration {
|
||||
pub fn token(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.model_token.as_str(),
|
||||
Self::ModelWeight(ref model) => model.token.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.title,
|
||||
Self::ModelWeight(ref model) => &model.title,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ietf_language_tag(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.ietf_language_tag,
|
||||
Self::ModelWeight(ref model) => model.maybe_ietf_language_tag.as_deref().unwrap_or("en"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ietf_primary_language_subtag(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.ietf_primary_language_subtag,
|
||||
Self::ModelWeight(ref model) => model.maybe_ietf_primary_language_subtag.as_deref().unwrap_or("en"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_user_token(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.creator_user_token,
|
||||
Self::ModelWeight(ref model) => model.creator_user_token.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_username(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.creator_username,
|
||||
Self::ModelWeight(ref model) => &model.creator_username,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_display_name(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.creator_display_name,
|
||||
Self::ModelWeight(ref model) => &model.creator_display_name,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_gravatar_hash(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.creator_gravatar_hash,
|
||||
Self::ModelWeight(ref model) => &model.creator_gravatar_hash,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_set_visibility(&self) -> Visibility{
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.creator_set_visibility,
|
||||
Self::ModelWeight(ref model) => model.creator_set_visibility,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn created_at(&self) -> &DateTime<Utc> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.created_at,
|
||||
Self::ModelWeight(ref model) => &model.created_at,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn updated_at(&self) -> &DateTime<Utc> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.updated_at,
|
||||
Self::ModelWeight(ref model) => &model.updated_at,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn is_front_page_featured(&self) -> bool {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.is_front_page_featured,
|
||||
Self::ModelWeight(ref _model) => false,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn is_twitch_featured(&self) -> bool {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.is_twitch_featured,
|
||||
Self::ModelWeight(ref _model) => false,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn is_locked_from_use(&self) -> bool {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.is_locked_from_use,
|
||||
Self::ModelWeight(ref _model) => false,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn is_locked_from_user_modification(&self) -> bool {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.is_locked_from_user_modification,
|
||||
Self::ModelWeight(ref _model) => false,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn user_ratings_positive_count(&self) -> u32 {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.user_ratings_positive_count,
|
||||
Self::ModelWeight(ref _model) => 0,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn user_ratings_negative_count(&self) -> u32 {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.user_ratings_negative_count,
|
||||
Self::ModelWeight(ref _model) => 0,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn user_ratings_total_count(&self) -> u32 {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.user_ratings_total_count,
|
||||
Self::ModelWeight(ref _model) => 0,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn maybe_suggested_unique_bot_command(&self) -> Option<&str> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.maybe_suggested_unique_bot_command.as_deref(),
|
||||
Self::ModelWeight(ref _model) => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tts_model_type(&self) -> TtsModelType {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.tts_model_type,
|
||||
Self::ModelWeight(ref _model) => TtsModelType::Tacotron2, // NB: Always TT2
|
||||
}
|
||||
}
|
||||
|
||||
pub fn description_markdown(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.description_markdown,
|
||||
Self::ModelWeight(ref model) => &model.maybe_description_markdown.as_deref().unwrap_or(""),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn description_rendered_html(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.description_rendered_html,
|
||||
Self::ModelWeight(ref model) => &model.maybe_description_rendered_html.as_deref().unwrap_or(""),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn maybe_default_pretrained_vocoder(&self) -> Option<VocoderType> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.maybe_default_pretrained_vocoder,
|
||||
Self::ModelWeight(ref model) => model.maybe_default_pretrained_vocoder,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn text_preprocessing_algorithm(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.text_preprocessing_algorithm,
|
||||
Self::ModelWeight(ref _model) => "basic", // NB: All records in the DB are "basic"
|
||||
}
|
||||
}
|
||||
|
||||
/* NB(bt, 2024-01-20): Breakdown of the text_pipeline_type values in the DB:
|
||||
mysql> select text_pipeline_type , count(*) from tts_models group by text_pipeline_type ;
|
||||
+--------------------+----------+
|
||||
| text_pipeline_type | count(*) |
|
||||
+--------------------+----------+
|
||||
| NULL | 4406 |
|
||||
| legacy_fakeyou | 2572 |
|
||||
| english_v1 | 1548 |
|
||||
| spanish_v2 | 194 |
|
||||
+--------------------+----------+
|
||||
*/
|
||||
pub fn text_pipeline_type(&self) -> Option<&str> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.text_pipeline_type.as_deref(),
|
||||
Self::ModelWeight(ref model) => model.maybe_text_pipeline_type.as_deref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1,3 @@
|
||||
pub mod get_tts_model_for_inference_migration;
|
||||
pub mod get_tts_model_info_migration;
|
||||
pub mod list_tts_models_for_migration;
|
||||
File renamed without changes.
+142
@@ -0,0 +1,142 @@
|
||||
use anyhow::anyhow;
|
||||
use chrono::{DateTime, Utc};
|
||||
use log::error;
|
||||
use sqlx::{MySql, MySqlPool};
|
||||
use sqlx::pool::PoolConnection;
|
||||
|
||||
use container_common::anyhow_result::AnyhowResult;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use tokens::tokens::{model_weights::ModelWeightToken, users::UserToken};
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct ModelWeightForLegacyTtsInference {
|
||||
pub token: ModelWeightToken,
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub user_deleted_at: Option<DateTime<Utc>>,
|
||||
pub mod_deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
pub async fn get_weight_for_legacy_tts_enqueue(
|
||||
weight_token: &ModelWeightToken,
|
||||
can_see_deleted: bool,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<Option<ModelWeightForLegacyTtsInference>> {
|
||||
let mut connection = mysql_pool.acquire().await?;
|
||||
get_weight_for_legacy_tts_enqueue_with_connection(weight_token, can_see_deleted, &mut connection).await
|
||||
}
|
||||
|
||||
pub async fn get_weight_for_legacy_tts_enqueue_with_connection(
|
||||
weight_token: &ModelWeightToken,
|
||||
can_see_deleted: bool,
|
||||
mysql_connection: &mut PoolConnection<MySql>
|
||||
) -> AnyhowResult<Option<ModelWeightForLegacyTtsInference>> {
|
||||
let maybe_result = if can_see_deleted {
|
||||
select_include_deleted(weight_token, mysql_connection).await
|
||||
} else {
|
||||
select_without_deleted(weight_token, mysql_connection).await
|
||||
};
|
||||
|
||||
let record: RawWeight = match maybe_result {
|
||||
Ok(record) => record,
|
||||
Err(sqlx::Error::RowNotFound) => {
|
||||
return Ok(None);
|
||||
}
|
||||
Err(err) => {
|
||||
error!("Error fetching weights by token: {:?}", err);
|
||||
return Err(anyhow!("Error fetching weights by token: {:?}", err));
|
||||
}
|
||||
};
|
||||
|
||||
// unwrap the result
|
||||
|
||||
Ok(
|
||||
Some(ModelWeightForLegacyTtsInference {
|
||||
token: record.token,
|
||||
weights_type: record.weights_type,
|
||||
weights_category: record.weights_category,
|
||||
creator_user_token: record.creator_user_token,
|
||||
creator_set_visibility: record.creator_set_visibility,
|
||||
user_deleted_at: record.user_deleted_at,
|
||||
mod_deleted_at: record.mod_deleted_at,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
async fn select_include_deleted(
|
||||
weight_token: &ModelWeightToken,
|
||||
mysql_connection: &mut PoolConnection<MySql>
|
||||
) -> Result<RawWeight, sqlx::Error> {
|
||||
sqlx
|
||||
::query_as!(
|
||||
RawWeight,
|
||||
r#"
|
||||
SELECT
|
||||
wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,
|
||||
wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
|
||||
wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,
|
||||
wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
|
||||
wt.user_deleted_at,
|
||||
wt.mod_deleted_at
|
||||
|
||||
FROM model_weights as wt
|
||||
WHERE
|
||||
wt.token = ?
|
||||
"#,
|
||||
weight_token.as_str()
|
||||
)
|
||||
.fetch_one(&mut **mysql_connection).await
|
||||
}
|
||||
|
||||
async fn select_without_deleted(
|
||||
weight_token: &ModelWeightToken,
|
||||
mysql_connection: &mut PoolConnection<MySql>
|
||||
) -> Result<RawWeight, sqlx::Error> {
|
||||
sqlx
|
||||
::query_as!(
|
||||
RawWeight,
|
||||
r#"
|
||||
SELECT
|
||||
wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,
|
||||
wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
|
||||
wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,
|
||||
wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
|
||||
wt.user_deleted_at,
|
||||
wt.mod_deleted_at
|
||||
|
||||
FROM model_weights as wt
|
||||
WHERE
|
||||
wt.token = ?
|
||||
AND wt.user_deleted_at IS NULL
|
||||
AND wt.mod_deleted_at IS NULL
|
||||
"#,
|
||||
weight_token.as_str()
|
||||
)
|
||||
.fetch_one(&mut **mysql_connection).await
|
||||
}
|
||||
|
||||
// RawWeight is the struct that is returned from the database in raw form.
|
||||
#[derive(Serialize)]
|
||||
struct RawWeight {
|
||||
pub token: ModelWeightToken,
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub user_deleted_at: Option<DateTime<Utc>>,
|
||||
pub mod_deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
use anyhow::anyhow;
|
||||
use chrono::{DateTime, Utc};
|
||||
use log::error;
|
||||
use sqlx::{MySql, MySqlPool};
|
||||
use sqlx::pool::PoolConnection;
|
||||
|
||||
use container_common::anyhow_result::AnyhowResult;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use tokens::tokens::{model_weights::ModelWeightToken, users::UserToken};
|
||||
use crate::column_types::vocoder_type::VocoderType;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct ModelWeightForLegacyTtsInfo {
|
||||
pub token: ModelWeightToken,
|
||||
pub title: String,
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_username: String,
|
||||
pub creator_display_name: String,
|
||||
pub creator_gravatar_hash: String,
|
||||
|
||||
pub creator_ip_address: String,
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub maybe_last_update_user_token: Option<UserToken>,
|
||||
pub original_download_url: Option<String>,
|
||||
pub original_filename: Option<String>,
|
||||
pub file_size_bytes: i32,
|
||||
pub file_checksum_sha2: String,
|
||||
pub public_bucket_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_ratings_positive_count: Option<u32>,
|
||||
pub maybe_ratings_negative_count: Option<u32>,
|
||||
pub maybe_bookmark_count: Option<u32>,
|
||||
|
||||
pub maybe_ietf_language_tag: Option<String>,
|
||||
pub maybe_ietf_primary_language_subtag: Option<String>,
|
||||
pub maybe_default_pretrained_vocoder: Option<VocoderType>,
|
||||
pub maybe_text_pipeline_type: Option<String>,
|
||||
|
||||
pub version: i32,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub user_deleted_at: Option<DateTime<Utc>>,
|
||||
pub mod_deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
pub async fn get_weight_for_legacy_tts_info(
|
||||
weight_token: &ModelWeightToken,
|
||||
can_see_deleted: bool,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<Option<ModelWeightForLegacyTtsInfo>> {
|
||||
let mut connection = mysql_pool.acquire().await?;
|
||||
get_weight_for_legacy_tts_info_with_connection(weight_token, can_see_deleted, &mut connection).await
|
||||
}
|
||||
|
||||
pub async fn get_weight_for_legacy_tts_info_with_connection(
|
||||
weight_token: &ModelWeightToken,
|
||||
can_see_deleted: bool,
|
||||
mysql_connection: &mut PoolConnection<MySql>
|
||||
) -> AnyhowResult<Option<ModelWeightForLegacyTtsInfo>> {
|
||||
let maybe_result = if can_see_deleted {
|
||||
select_include_deleted(weight_token, mysql_connection).await
|
||||
} else {
|
||||
select_without_deleted(weight_token, mysql_connection).await
|
||||
};
|
||||
|
||||
let record: RawWeight = match maybe_result {
|
||||
Ok(record) => record,
|
||||
Err(sqlx::Error::RowNotFound) => {
|
||||
return Ok(None);
|
||||
}
|
||||
Err(err) => {
|
||||
error!("Error fetching weights by token: {:?}", err);
|
||||
return Err(anyhow!("Error fetching weights by token: {:?}", err));
|
||||
}
|
||||
};
|
||||
|
||||
// unwrap the result
|
||||
|
||||
Ok(
|
||||
Some(ModelWeightForLegacyTtsInfo {
|
||||
token: record.token,
|
||||
title: record.title,
|
||||
weights_type: record.weights_type,
|
||||
weights_category: record.weights_category,
|
||||
maybe_description_markdown: record.maybe_description_markdown,
|
||||
maybe_description_rendered_html: record.maybe_description_rendered_html,
|
||||
creator_user_token: record.creator_user_token,
|
||||
creator_username: record.creator_username,
|
||||
creator_display_name: record.creator_display_name,
|
||||
creator_gravatar_hash: record.creator_gravatar_hash,
|
||||
creator_ip_address: record.creator_ip_address,
|
||||
creator_set_visibility: record.creator_set_visibility,
|
||||
maybe_last_update_user_token: record.maybe_last_update_user_token,
|
||||
original_download_url: record.original_download_url,
|
||||
original_filename: record.original_filename,
|
||||
file_size_bytes: record.file_size_bytes,
|
||||
file_checksum_sha2: record.file_checksum_sha2,
|
||||
public_bucket_hash: record.public_bucket_hash,
|
||||
maybe_public_bucket_prefix: record.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: record.maybe_public_bucket_extension,
|
||||
maybe_cover_image_public_bucket_hash: record.maybe_cover_image_public_bucket_hash,
|
||||
maybe_cover_image_public_bucket_prefix: record.maybe_cover_image_public_bucket_prefix,
|
||||
maybe_cover_image_public_bucket_extension: record.maybe_cover_image_public_bucket_extension,
|
||||
maybe_ratings_positive_count: record.maybe_ratings_positive_count,
|
||||
maybe_ratings_negative_count: record.maybe_ratings_negative_count,
|
||||
maybe_bookmark_count: record.maybe_bookmark_count,
|
||||
maybe_ietf_language_tag: record.maybe_ietf_language_tag,
|
||||
maybe_ietf_primary_language_subtag: record.maybe_ietf_primary_language_subtag,
|
||||
maybe_default_pretrained_vocoder: record.maybe_default_pretrained_vocoder,
|
||||
maybe_text_pipeline_type: record.maybe_text_pipeline_type,
|
||||
version: record.version,
|
||||
created_at: record.created_at,
|
||||
updated_at: record.updated_at,
|
||||
user_deleted_at: record.user_deleted_at,
|
||||
mod_deleted_at: record.mod_deleted_at,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
async fn select_include_deleted(
|
||||
weight_token: &ModelWeightToken,
|
||||
mysql_connection: &mut PoolConnection<MySql>
|
||||
) -> Result<RawWeight, sqlx::Error> {
|
||||
sqlx
|
||||
::query_as!(
|
||||
RawWeight,
|
||||
r#"
|
||||
SELECT
|
||||
wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,
|
||||
wt.title,
|
||||
wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
wt.maybe_description_markdown,
|
||||
wt.maybe_description_rendered_html,
|
||||
|
||||
wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,
|
||||
users.username as creator_username,
|
||||
users.display_name as creator_display_name,
|
||||
users.email_gravatar_hash AS creator_gravatar_hash,
|
||||
|
||||
wt.creator_ip_address,
|
||||
wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,
|
||||
wt.original_download_url,
|
||||
wt.original_filename,
|
||||
wt.file_size_bytes,
|
||||
wt.file_checksum_sha2,
|
||||
|
||||
wt.public_bucket_hash,
|
||||
wt.maybe_public_bucket_prefix,
|
||||
wt.maybe_public_bucket_extension,
|
||||
|
||||
cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,
|
||||
|
||||
entity_stats.ratings_positive_count as maybe_ratings_positive_count,
|
||||
entity_stats.ratings_negative_count as maybe_ratings_negative_count,
|
||||
entity_stats.bookmark_count as maybe_bookmark_count,
|
||||
|
||||
w_extension.ietf_language_tag as maybe_ietf_language_tag,
|
||||
w_extension.ietf_primary_language_subtag as maybe_ietf_primary_language_subtag,
|
||||
w_extension.maybe_default_pretrained_vocoder as `maybe_default_pretrained_vocoder: crate::column_types::vocoder_type::VocoderType`,
|
||||
w_extension.text_pipeline_type as maybe_text_pipeline_type,
|
||||
|
||||
wt.version,
|
||||
wt.created_at,
|
||||
wt.updated_at,
|
||||
wt.user_deleted_at,
|
||||
wt.mod_deleted_at
|
||||
|
||||
FROM model_weights as wt
|
||||
JOIN users
|
||||
ON users.token = wt.creator_user_token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = wt.maybe_cover_image_media_file_token
|
||||
LEFT OUTER JOIN entity_stats
|
||||
ON entity_stats.entity_type = "model_weight"
|
||||
AND entity_stats.entity_token = wt.token
|
||||
|
||||
LEFT OUTER JOIN model_weights_extension_tts_details as w_extension
|
||||
ON w_extension.model_weights_token = wt.token
|
||||
|
||||
WHERE
|
||||
wt.token = ?
|
||||
"#,
|
||||
weight_token.as_str()
|
||||
)
|
||||
.fetch_one(&mut **mysql_connection).await
|
||||
}
|
||||
|
||||
async fn select_without_deleted(
|
||||
weight_token: &ModelWeightToken,
|
||||
mysql_connection: &mut PoolConnection<MySql>
|
||||
) -> Result<RawWeight, sqlx::Error> {
|
||||
//as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
//as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`
|
||||
sqlx
|
||||
::query_as!(
|
||||
RawWeight,
|
||||
r#"
|
||||
SELECT
|
||||
wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,
|
||||
wt.title,
|
||||
wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
wt.maybe_description_markdown,
|
||||
wt.maybe_description_rendered_html,
|
||||
wt.creator_ip_address,
|
||||
wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
|
||||
wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,
|
||||
users.username as creator_username,
|
||||
users.display_name as creator_display_name,
|
||||
users.email_gravatar_hash AS creator_gravatar_hash,
|
||||
|
||||
wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,
|
||||
wt.original_download_url,
|
||||
wt.original_filename,
|
||||
wt.file_size_bytes,
|
||||
wt.file_checksum_sha2,
|
||||
wt.public_bucket_hash,
|
||||
wt.maybe_public_bucket_prefix,
|
||||
wt.maybe_public_bucket_extension,
|
||||
|
||||
cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,
|
||||
|
||||
entity_stats.ratings_positive_count as maybe_ratings_positive_count,
|
||||
entity_stats.ratings_negative_count as maybe_ratings_negative_count,
|
||||
entity_stats.bookmark_count as maybe_bookmark_count,
|
||||
|
||||
w_extension.ietf_language_tag as maybe_ietf_language_tag,
|
||||
w_extension.ietf_primary_language_subtag as maybe_ietf_primary_language_subtag,
|
||||
w_extension.maybe_default_pretrained_vocoder as `maybe_default_pretrained_vocoder: crate::column_types::vocoder_type::VocoderType`,
|
||||
w_extension.text_pipeline_type as maybe_text_pipeline_type,
|
||||
|
||||
wt.version,
|
||||
wt.created_at,
|
||||
wt.updated_at,
|
||||
wt.user_deleted_at,
|
||||
wt.mod_deleted_at
|
||||
|
||||
FROM model_weights as wt
|
||||
JOIN users
|
||||
ON users.token = wt.creator_user_token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = wt.maybe_cover_image_media_file_token
|
||||
LEFT OUTER JOIN entity_stats
|
||||
ON entity_stats.entity_type = "model_weight"
|
||||
AND entity_stats.entity_token = wt.token
|
||||
|
||||
LEFT OUTER JOIN model_weights_extension_tts_details as w_extension
|
||||
ON w_extension.model_weights_token = wt.token
|
||||
|
||||
WHERE
|
||||
wt.token = ?
|
||||
AND wt.user_deleted_at IS NULL
|
||||
AND wt.mod_deleted_at IS NULL
|
||||
"#,
|
||||
weight_token.as_str()
|
||||
)
|
||||
.fetch_one(&mut **mysql_connection).await
|
||||
}
|
||||
|
||||
// RawWeight is the struct that is returned from the database in raw form.
|
||||
#[derive(Serialize)]
|
||||
pub struct RawWeight {
|
||||
pub token: ModelWeightToken,
|
||||
pub title: String,
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_username: String,
|
||||
pub creator_display_name: String,
|
||||
pub creator_gravatar_hash: String,
|
||||
|
||||
pub creator_ip_address: String,
|
||||
pub creator_set_visibility: Visibility,
|
||||
pub maybe_last_update_user_token: Option<UserToken>,
|
||||
pub original_download_url: Option<String>,
|
||||
pub original_filename: Option<String>,
|
||||
pub file_size_bytes: i32,
|
||||
pub file_checksum_sha2: String,
|
||||
pub public_bucket_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_ratings_positive_count: Option<u32>,
|
||||
pub maybe_ratings_negative_count: Option<u32>,
|
||||
pub maybe_bookmark_count: Option<u32>,
|
||||
|
||||
pub maybe_ietf_language_tag: Option<String>,
|
||||
pub maybe_ietf_primary_language_subtag: Option<String>,
|
||||
pub maybe_default_pretrained_vocoder: Option<VocoderType>,
|
||||
pub maybe_text_pipeline_type: Option<String>,
|
||||
|
||||
pub version: i32,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub user_deleted_at: Option<DateTime<Utc>>,
|
||||
pub mod_deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
pub mod get_weight;
|
||||
pub mod get_weight_for_legacy_tts_enqueue;
|
||||
pub mod get_weight_for_legacy_tts_info;
|
||||
+1
-1
@@ -48,7 +48,7 @@ pub async fn upsert_model_weights_record(
|
||||
record: &WholeTtsModelRecord,
|
||||
model_weight_token: &ModelWeightToken,
|
||||
copied_data: &CopiedTtsFileData,
|
||||
mut transaction: &mut Transaction<'_, MySql>,
|
||||
transaction: &mut Transaction<'_, MySql>,
|
||||
) -> AnyhowResult<()> {
|
||||
|
||||
// NB: We never supported other TTS models in the tts_models table.
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ pub async fn upsert_model_weights_record(
|
||||
record: &WholeVoiceConversionModelRecord,
|
||||
model_weight_token: &ModelWeightToken,
|
||||
copied_data: &CopiedFileData,
|
||||
mut transaction: &mut Transaction<'_, MySql>,
|
||||
transaction: &mut Transaction<'_, MySql>,
|
||||
) -> AnyhowResult<()> {
|
||||
|
||||
let weights_type = match record.model_type {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
pub mod create;
|
||||
pub mod delete_weights;
|
||||
pub mod edit;
|
||||
pub mod get_weight;
|
||||
pub mod get;
|
||||
pub mod inference;
|
||||
pub mod list;
|
||||
pub mod migration;
|
||||
|
||||
@@ -27,7 +27,7 @@ mod tests {
|
||||
undelete_weights_as_mod,
|
||||
undelete_weights_as_user,
|
||||
};
|
||||
use crate::queries::model_weights::get_weight::get_weight_by_token;
|
||||
use crate::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
use crate::queries::model_weights::list::list_weights_by_user::{list_weights_by_creator_username, ListWeightsForUserArgs};
|
||||
use crate::queries::model_weights::list::list_weights_query_builder::ListWeightsQueryBuilder;
|
||||
use crate::queries::users::user::get_user_token_by_username::get_user_token_by_username;
|
||||
|
||||
@@ -9,6 +9,14 @@ impl RedisCacheKeys {
|
||||
format!("get_tts_model:{}", model_token)
|
||||
}
|
||||
|
||||
pub fn get_tts_model_for_info_migration_endpoint(model_token: &str) -> String {
|
||||
format!("get_tts_inf1:{}", model_token)
|
||||
}
|
||||
|
||||
pub fn get_tts_model_for_inference_migration_endpoint(model_token: &str) -> String {
|
||||
format!("get_tts_inf2:{}", model_token)
|
||||
}
|
||||
|
||||
pub fn get_unified_queue_stats_endpoint() -> &'static str {
|
||||
"q_stats_2" // NB: Schema changed, hence _2
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ pub async fn gizmodo_indexer() -> AnyhowResult<Vec<WebScrapingTarget>> {
|
||||
}
|
||||
};
|
||||
|
||||
let mut maybe_skip_reason = None;
|
||||
let maybe_skip_reason = None;
|
||||
|
||||
//// Lazy heuristic to skip CNN video articles, which contain little text.
|
||||
//// eg. https://www.cnn.com/videos/politics/2023/02/08/pelosi-gop-hecklers-reaction-joe-biden-state-of-the-union-tapper-intv-vpx.cnn
|
||||
|
||||
@@ -28,7 +28,7 @@ pub async fn kotaku_indexer() -> AnyhowResult<Vec<WebScrapingTarget>> {
|
||||
}
|
||||
};
|
||||
|
||||
let mut maybe_skip_reason = None;
|
||||
let maybe_skip_reason = None;
|
||||
|
||||
//// Lazy heuristic to skip CNN video articles, which contain little text.
|
||||
//// eg. https://www.cnn.com/videos/politics/2023/02/08/pelosi-gop-hecklers-reaction-joe-biden-state-of-the-union-tapper-intv-vpx.cnn
|
||||
|
||||
+2
-3
@@ -17,7 +17,7 @@ use mysql_queries::payloads::generic_inference_args::image_generation_payload::S
|
||||
use mysql_queries::queries::generic_inference::job::list_available_generic_inference_jobs::AvailableInferenceJob;
|
||||
use mysql_queries::queries::media_files::create::insert_media_file_from_file_upload::{insert_media_file_from_file_upload, InsertMediaFileFromUploadArgs, UploadType};
|
||||
use mysql_queries::queries::model_weights::create::create_weight::{create_weight, CreateModelWeightsArgs};
|
||||
use mysql_queries::queries::model_weights::get_weight::get_weight_by_token;
|
||||
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
@@ -141,11 +141,10 @@ pub async fn process_job_inference(
|
||||
// thread::sleep(seconds) to check the directory
|
||||
|
||||
//NB: TempDir exists until it goes out of scope, at which point it should delete from filesystem.
|
||||
let mut work_temp_dir = args.job_dependencies.fs.scoped_temp_dir_creator_for_work
|
||||
let work_temp_dir = args.job_dependencies.fs.scoped_temp_dir_creator_for_work
|
||||
.new_tempdir(&work_temp_dir)
|
||||
.map_err(|e| ProcessSingleJobError::from_io_error(e))?;
|
||||
|
||||
|
||||
let sd_checkpoint_path = work_temp_dir.path().join("sd_checkpoint.safetensors");
|
||||
let lora_path = work_temp_dir.path().join("lora.safetensors");
|
||||
let vae_path = work_temp_dir.path().join("vae.safetensors");
|
||||
|
||||
+2
-2
@@ -86,8 +86,8 @@ pub fn validate_job(job: &AvailableInferenceJob) -> Result<JobArgs, ProcessSingl
|
||||
Some(FaceEnhancer::R) => Some("RestoreFormer".to_string()),
|
||||
};
|
||||
|
||||
let mut width = inference_args.maybe_resize_width;
|
||||
let mut height = inference_args.maybe_resize_height;
|
||||
let width = inference_args.maybe_resize_width;
|
||||
let height = inference_args.maybe_resize_height;
|
||||
|
||||
Ok(JobArgs {
|
||||
audio_source,
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use cloud_storage::bucket_client::BucketClient;
|
||||
use jobs_common::job_progress_reporter::job_progress_reporter::JobProgressReporter;
|
||||
use mysql_queries::queries::generic_inference::job::list_available_generic_inference_jobs::AvailableInferenceJob;
|
||||
use mysql_queries::queries::model_weights::get_weight::RetrievedModelWeight;
|
||||
use mysql_queries::queries::model_weights::get::get_weight::RetrievedModelWeight;
|
||||
|
||||
use crate::job::job_loop::process_single_job_error::ProcessSingleJobError;
|
||||
use crate::util::maybe_download_file_from_bucket::{maybe_download_file_from_bucket, MaybeDownloadArgs};
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ use mimetypes::mimetype_for_file::get_mimetype_for_file;
|
||||
use mysql_queries::payloads::generic_inference_args::generic_inference_args::PolymorphicInferenceArgs::Rr;
|
||||
use mysql_queries::queries::generic_inference::job::list_available_generic_inference_jobs::AvailableInferenceJob;
|
||||
use mysql_queries::queries::media_files::create::insert_media_file_from_rerender::{insert_media_file_from_rerender, InsertArgs};
|
||||
use mysql_queries::queries::model_weights::get_weight::get_weight_by_token;
|
||||
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
|
||||
use crate::job::job_loop::job_success_result::{JobSuccessResult, ResultEntity};
|
||||
use crate::job::job_loop::process_single_job_error::ProcessSingleJobError;
|
||||
@@ -87,7 +87,7 @@ pub async fn process_job(args: RerenderProcessJobArgs<'_>) -> Result<JobSuccessR
|
||||
|
||||
// ==================== TRANSCODE MEDIA (IF NECESSARY) ==================== //
|
||||
|
||||
let mut usable_video_path = video_path.filesystem_path.clone();
|
||||
let usable_video_path = video_path.filesystem_path.clone();
|
||||
|
||||
//TODO: re encode with ffmpeg
|
||||
|
||||
|
||||
+1
-2
@@ -1,13 +1,12 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use tempdir::TempDir;
|
||||
|
||||
use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use cloud_storage::bucket_client::BucketClient;
|
||||
use jobs_common::job_progress_reporter::job_progress_reporter::JobProgressReporter;
|
||||
use mysql_queries::queries::generic_inference::job::list_available_generic_inference_jobs::AvailableInferenceJob;
|
||||
use mysql_queries::queries::model_weights::get_weight::RetrievedModelWeight;
|
||||
use mysql_queries::queries::model_weights::get::get_weight::RetrievedModelWeight;
|
||||
|
||||
use crate::job::job_loop::process_single_job_error::ProcessSingleJobError;
|
||||
use crate::util::maybe_download_file_from_bucket::{maybe_download_file_from_bucket, MaybeDownloadArgs};
|
||||
|
||||
@@ -2,11 +2,10 @@ use std::fs::read_to_string;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Instant;
|
||||
|
||||
use anyhow::{anyhow};
|
||||
use log::{error, info, warn};
|
||||
use anyhow::anyhow;
|
||||
use jsonpath_lib::replace_with;
|
||||
use log::{error, info, warn};
|
||||
use serde::de::Error;
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
@@ -20,20 +19,18 @@ 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 mimetypes::mimetype_for_file::get_mimetype_for_file;
|
||||
use mysql_queries::payloads::generic_inference_args::generic_inference_args::PolymorphicInferenceArgs::{Cu};
|
||||
use mysql_queries::payloads::generic_inference_args::generic_inference_args::PolymorphicInferenceArgs::Cu;
|
||||
use mysql_queries::payloads::generic_inference_args::workflow_payload::NewValue;
|
||||
use mysql_queries::queries::generic_inference::job::list_available_generic_inference_jobs::AvailableInferenceJob;
|
||||
use mysql_queries::queries::media_files::create::insert_media_file_from_comfy_ui::{insert_media_file_from_comfy_ui, InsertArgs};
|
||||
use mysql_queries::queries::model_weights::get_weight::get_weight_by_token;
|
||||
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
|
||||
use crate::job::job_loop::job_success_result::{JobSuccessResult, ResultEntity};
|
||||
use crate::job::job_loop::process_single_job_error::ProcessSingleJobError;
|
||||
use crate::job::job_types::workflow::comfy_ui::comfy_ui_inference_command::InferenceArgs;
|
||||
use crate::job::job_types::workflow::comfy_ui::download_model_file::download_model_file;
|
||||
use crate::job::job_types::workflow::comfy_ui::validate_job::validate_job;
|
||||
use crate::job_dependencies::JobDependencies;
|
||||
|
||||
|
||||
const BUCKET_FILE_PREFIX: &str = "fakeyou_";
|
||||
|
||||
pub struct ComfyProcessJobArgs<'a> {
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ impl FfmpegLogoWatermarkCommand {
|
||||
&command
|
||||
];
|
||||
|
||||
let mut config = PopenConfig::default();
|
||||
let config = PopenConfig::default();
|
||||
|
||||
let mut p = Popen::create(&command_parts, config)?;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ async fn main() -> AnyhowResult<()> {
|
||||
// I'm too tired to figure out the generic types though.
|
||||
if env_args.enable_gzip {
|
||||
HttpServer::new(move || {
|
||||
let mut app = App::new()
|
||||
let app = App::new()
|
||||
.wrap(Logger::new(&log_format))
|
||||
.wrap(DefaultHeaders::new()
|
||||
.header("X-Backend-Hostname", &server_hostname))
|
||||
@@ -55,7 +55,7 @@ async fn main() -> AnyhowResult<()> {
|
||||
.await?;
|
||||
} else {
|
||||
HttpServer::new(move || {
|
||||
let mut app = App::new()
|
||||
let app = App::new()
|
||||
.wrap(Logger::new(&log_format))
|
||||
.wrap(DefaultHeaders::new()
|
||||
.header("X-Backend-Hostname", &server_hostname));
|
||||
|
||||
@@ -76,6 +76,12 @@ pub async fn delete_tts_model_handler(
|
||||
request: web::Json<DeleteTtsModelRequest>,
|
||||
server_state: web::Data<Arc<ServerState>>
|
||||
) -> Result<HttpResponse, DeleteTtsModelError> {
|
||||
// NB: Disable if we've migrated to model_weights
|
||||
if server_state.flags.switch_tts_to_model_weights {
|
||||
warn!("Migration to model_weights for tts. Cannot delete old model.");
|
||||
return Err(DeleteTtsModelError::ServerError);
|
||||
}
|
||||
|
||||
let maybe_user_session = server_state
|
||||
.session_checker
|
||||
.maybe_get_user_session(&http_request, &server_state.mysql_pool)
|
||||
|
||||
@@ -132,9 +132,15 @@ impl fmt::Display for EditTtsModelError {
|
||||
pub async fn edit_tts_model_handler(
|
||||
http_request: HttpRequest,
|
||||
path: Path<EditTtsModelPathInfo>,
|
||||
request: web::Json<EditTtsModelRequest>,
|
||||
request: Json<EditTtsModelRequest>,
|
||||
server_state: web::Data<Arc<ServerState>>) -> Result<HttpResponse, EditTtsModelError>
|
||||
{
|
||||
// NB: Disable if we've migrated to model_weights
|
||||
if server_state.flags.switch_tts_to_model_weights {
|
||||
warn!("Migration to model_weights for tts. Cannot delete old model.");
|
||||
return Err(EditTtsModelError::ServerError);
|
||||
}
|
||||
|
||||
let maybe_user_session = server_state
|
||||
.session_checker
|
||||
.maybe_get_user_session(&http_request, &server_state.mysql_pool)
|
||||
|
||||
+10
-16
@@ -16,15 +16,14 @@ use rand::seq::SliceRandom;
|
||||
|
||||
use enums::by_table::generic_inference_jobs::inference_category::InferenceCategory;
|
||||
use enums::by_table::generic_inference_jobs::inference_model_type::InferenceModelType;
|
||||
use enums::by_table::tts_models::tts_model_type::TtsModelType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use http_server_common::request::get_request_api_token::get_request_api_token;
|
||||
use http_server_common::request::get_request_header_optional::get_request_header_optional;
|
||||
use http_server_common::request::get_request_ip::get_request_ip;
|
||||
use migration::text_to_speech::get_tts_model_for_inference_migration::TtsModelForInferenceMigration;
|
||||
use mysql_queries::payloads::generic_inference_args::generic_inference_args::{GenericInferenceArgs, InferenceCategoryAbbreviated};
|
||||
use mysql_queries::queries::generic_inference::web::insert_generic_inference_job::{insert_generic_inference_job, InsertGenericInferenceArgs};
|
||||
use mysql_queries::queries::tts::tts_inference_jobs::insert_tts_inference_job::TtsInferenceJobInsertBuilder;
|
||||
use mysql_queries::queries::tts::tts_models::get_tts_model::TtsModelRecord;
|
||||
use redis_common::redis_keys::RedisKeys;
|
||||
use tokens::tokens::tts_inference_jobs::TtsInferenceJobToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
@@ -36,7 +35,7 @@ use crate::configs::app_startup::username_set::UsernameSet;
|
||||
use crate::configs::plans::get_correct_plan_for_session::get_correct_plan_for_session;
|
||||
use crate::configs::plans::plan::Plan;
|
||||
use crate::http_server::endpoints::investor_demo::demo_cookie::request_has_demo_cookie;
|
||||
use crate::http_server::endpoints::tts::enqueue_infer_tts_handler::get_model_with_caching::get_model_with_caching;
|
||||
use crate::http_server::endpoints::tts::enqueue_infer_tts_handler::get_tts_model_with_caching::get_tts_model_with_caching;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
use crate::server_state::ServerState;
|
||||
|
||||
@@ -286,10 +285,11 @@ pub async fn enqueue_infer_tts_handler(
|
||||
|
||||
// ==================== CHECK TTS MODEL EXISTENCE / SETTINGS==================== //
|
||||
|
||||
let tts_model_lookup_result = get_model_with_caching(
|
||||
let tts_model_lookup_result = get_tts_model_with_caching(
|
||||
&request.tts_model_token,
|
||||
&server_state.redis_ttl_cache,
|
||||
&mut mysql_connection
|
||||
&mut mysql_connection,
|
||||
server_state.flags.switch_tts_to_model_weights,
|
||||
).await;
|
||||
|
||||
let tts_model = match tts_model_lookup_result {
|
||||
@@ -377,18 +377,12 @@ pub async fn enqueue_infer_tts_handler(
|
||||
|
||||
// ==================== ENQUEUE APPROPRIATE TTS TYPE ==================== //
|
||||
|
||||
let use_new_job_system = match tts_model.tts_model_type {
|
||||
TtsModelType::Vits => true, // VITS is only on the new system.
|
||||
TtsModelType::Tacotron2 => use_new_job_system_for_request || server_state.flags.enable_enqueue_generic_tts_job,
|
||||
};
|
||||
let use_new_job_system = use_new_job_system_for_request || server_state.flags.enable_enqueue_generic_tts_job;
|
||||
|
||||
let job_token;
|
||||
let job_token_type;
|
||||
|
||||
let model_type = match tts_model.tts_model_type {
|
||||
TtsModelType::Tacotron2 => InferenceModelType::Tacotron2,
|
||||
TtsModelType::Vits => InferenceModelType::Vits,
|
||||
};
|
||||
let model_type = InferenceModelType::Tacotron2;
|
||||
|
||||
let max_duration_seconds = plan.tts_max_duration_seconds();
|
||||
|
||||
@@ -559,10 +553,10 @@ pub fn validate_inference_text(text: &str, plan: &Plan) -> Result<(), String> {
|
||||
/// This is designed to fail closed (read: actually open!) rather than hit resources.
|
||||
async fn check_if_authorized_to_use_model(
|
||||
maybe_user_session: Option<&UserSessionExtended>,
|
||||
tts_model: &TtsModelRecord,
|
||||
tts_model: &TtsModelForInferenceMigration,
|
||||
) -> bool {
|
||||
|
||||
match tts_model.creator_set_visibility {
|
||||
match tts_model.creator_set_visibility() {
|
||||
Visibility::Public => return true,
|
||||
Visibility::Hidden => return true,
|
||||
Visibility::Private => {} // Fall through
|
||||
@@ -570,7 +564,7 @@ async fn check_if_authorized_to_use_model(
|
||||
|
||||
let is_authorized = maybe_user_session
|
||||
.map(|session| {
|
||||
(session.user_token.as_str() == tts_model.creator_user_token.as_str()) // is_author
|
||||
(session.user_token.as_str() == tts_model.creator_user_token()) // is_author
|
||||
|| (session.role.can_ban_users) // is_mod
|
||||
|| (session.user_token.as_str() == USER_FAKEYOU_USER_TOKEN) // is allowed user #1
|
||||
|| (session.user_token.as_str() == USER_NEWS_STORY_USER_TOKEN) // is allowed user #2
|
||||
|
||||
+9
-8
@@ -3,32 +3,34 @@ use sqlx::MySql;
|
||||
use sqlx::pool::PoolConnection;
|
||||
|
||||
use errors::AnyhowResult;
|
||||
use mysql_queries::queries::tts::tts_models::get_tts_model::{get_tts_model_by_token_using_connection, TtsModelRecord};
|
||||
use migration::text_to_speech::get_tts_model_for_inference_migration::{get_tts_model_for_inference_migration, TtsModelForInferenceMigration};
|
||||
use redis_caching::redis_ttl_cache::RedisTtlCache;
|
||||
use redis_common::redis_cache_keys::RedisCacheKeys;
|
||||
|
||||
// TODO: Read from in-memory TTS List cache first (!!!) for further performance savings
|
||||
|
||||
pub async fn get_model_with_caching(
|
||||
pub async fn get_tts_model_with_caching(
|
||||
model_token: &str,
|
||||
redis_ttl_cache: &RedisTtlCache,
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
) -> AnyhowResult<Option<TtsModelRecord>> {
|
||||
|
||||
use_weights_table: bool,
|
||||
) -> AnyhowResult<Option<TtsModelForInferenceMigration>> {
|
||||
// NB: Copy due to move. Not a cloned ref due to clippy lint
|
||||
let model_token2 = model_token.to_string();
|
||||
|
||||
let get_tts_model = move || {
|
||||
// NB: async closures are not yet stable in Rust, so we include an async block.
|
||||
async move {
|
||||
get_tts_model_by_token_using_connection(
|
||||
get_tts_model_for_inference_migration(
|
||||
&model_token2,
|
||||
mysql_connection,
|
||||
true,
|
||||
mysql_connection).await
|
||||
use_weights_table,
|
||||
).await
|
||||
}
|
||||
};
|
||||
|
||||
let cache_key = RedisCacheKeys::get_tts_model_endpoint(model_token);
|
||||
let cache_key = RedisCacheKeys::get_tts_model_for_inference_migration_endpoint(model_token);
|
||||
|
||||
let mut redis_ttl_cache_connection = match redis_ttl_cache.get_connection() {
|
||||
Ok(connection) => connection,
|
||||
@@ -43,4 +45,3 @@ pub async fn get_model_with_caching(
|
||||
get_tts_model()
|
||||
}).await
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
pub mod enqueue_infer_tts_handler;
|
||||
pub mod get_model_with_caching;
|
||||
pub mod get_tts_model_with_caching;
|
||||
@@ -16,8 +16,8 @@ use log::warn;
|
||||
use enums::by_table::tts_models::tts_model_type::TtsModelType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use http_server_common::response::serialize_as_json_error::serialize_as_json_error;
|
||||
use migration::text_to_speech::get_tts_model_info_migration::get_tts_model_info_migration;
|
||||
use mysql_queries::column_types::vocoder_type::VocoderType;
|
||||
use mysql_queries::queries::tts::tts_models::get_tts_model::get_tts_model_by_token_using_connection;
|
||||
use redis_common::redis_cache_keys::RedisCacheKeys;
|
||||
use tts_common::text_pipelines::guess_pipeline::guess_text_pipeline_heuristic;
|
||||
use tts_common::text_pipelines::text_pipeline_type::TextPipelineType;
|
||||
@@ -204,13 +204,16 @@ pub async fn get_tts_model_handler(
|
||||
|
||||
let model_token = path.token.clone();
|
||||
|
||||
let switch_to_weights_flag = server_state.flags.switch_tts_to_model_weights;
|
||||
|
||||
let get_tts_model = move || {
|
||||
// NB: async closures are not yet stable in Rust, so we include an async block.
|
||||
async move {
|
||||
get_tts_model_by_token_using_connection(
|
||||
get_tts_model_info_migration(
|
||||
&model_token,
|
||||
show_deleted_models,
|
||||
&mut mysql_connection,
|
||||
show_deleted_models,
|
||||
switch_to_weights_flag,
|
||||
).await
|
||||
}
|
||||
};
|
||||
@@ -221,14 +224,14 @@ pub async fn get_tts_model_handler(
|
||||
get_tts_model().await
|
||||
}
|
||||
Ok(mut redis_ttl_cache) => {
|
||||
let cache_key = RedisCacheKeys::get_tts_model_endpoint(&path.token);
|
||||
let cache_key = RedisCacheKeys::get_tts_model_for_info_migration_endpoint(&path.token);
|
||||
redis_ttl_cache.lazy_load_if_not_cached(&cache_key, move || {
|
||||
get_tts_model()
|
||||
}).await
|
||||
}
|
||||
};
|
||||
|
||||
let mut model = match model_query_result {
|
||||
let model = match model_query_result {
|
||||
Err(e) => {
|
||||
warn!("query error: {:?}", e);
|
||||
return Err(GetTtsModelError::ServerError);
|
||||
@@ -238,22 +241,24 @@ pub async fn get_tts_model_handler(
|
||||
};
|
||||
|
||||
if let Some(user_session) = &maybe_user_session {
|
||||
is_original_author = user_session.user_token == model.creator_user_token;
|
||||
is_original_author = user_session.user_token == model.creator_user_token();
|
||||
}
|
||||
|
||||
if let Some(moderator_fields) = model.maybe_moderator_fields.as_ref() {
|
||||
// NB: The moderator fields will always be present before removal
|
||||
// We don't want non-mods seeing stuff made by banned users.
|
||||
if moderator_fields.creator_is_banned && !is_moderator {
|
||||
return Err(GetTtsModelError::NotFound);
|
||||
}
|
||||
}
|
||||
// NB(bt, 2024-01-20): Removing to make porting easier.
|
||||
//if let Some(moderator_fields) = model.maybe_moderator_fields.as_ref() {
|
||||
// // NB: The moderator fields will always be present before removal
|
||||
// // We don't want non-mods seeing stuff made by banned users.
|
||||
// if moderator_fields.creator_is_banned && !is_moderator {
|
||||
// return Err(GetTtsModelError::NotFound);
|
||||
// }
|
||||
//}
|
||||
|
||||
if !is_moderator {
|
||||
model.maybe_moderator_fields = None;
|
||||
}
|
||||
// NB(bt, 2024-01-20): Removing to make porting easier.
|
||||
//if !is_moderator {
|
||||
// model.maybe_moderator_fields = None;
|
||||
//}
|
||||
|
||||
let text_pipeline_type = model.text_pipeline_type
|
||||
let text_pipeline_type = model.text_pipeline_type()
|
||||
.as_deref()
|
||||
.and_then(|pipeline_type| {
|
||||
// If there's an error deserializing, turn it to None instead of 500ing. The column is
|
||||
@@ -273,64 +278,68 @@ pub async fn get_tts_model_handler(
|
||||
|
||||
// TODO: Use language to infer as well.
|
||||
let text_pipeline_type_guess =
|
||||
guess_text_pipeline_heuristic(Some(model.created_at.clone()));
|
||||
guess_text_pipeline_heuristic(Some(model.created_at().clone()));
|
||||
|
||||
// Map to public response type.
|
||||
let response = GetTtsModelSuccessResponse {
|
||||
success: true,
|
||||
model: TtsModelInfo {
|
||||
model_token: model.model_token,
|
||||
tts_model_type: model.tts_model_type,
|
||||
model_token: model.token().to_string(),
|
||||
tts_model_type: model.tts_model_type(),
|
||||
text_pipeline_type,
|
||||
text_pipeline_type_guess,
|
||||
maybe_custom_vocoder: match model.maybe_custom_vocoder {
|
||||
None => None,
|
||||
Some(vocoder) => Some(CustomVocoderInfo {
|
||||
vocoder_token: vocoder.vocoder_token,
|
||||
vocoder_title: vocoder.vocoder_title,
|
||||
creator_user_token: vocoder.creator_user_token,
|
||||
creator_username: vocoder.creator_username,
|
||||
creator_display_name: vocoder.creator_display_name,
|
||||
creator_gravatar_hash: vocoder.creator_gravatar_hash,
|
||||
})
|
||||
},
|
||||
maybe_default_pretrained_vocoder: model.maybe_default_pretrained_vocoder,
|
||||
text_preprocessing_algorithm: model.text_preprocessing_algorithm,
|
||||
creator_user_token: model.creator_user_token,
|
||||
creator_username: model.creator_username.to_string(), // NB: Cloned because of ref use for avatar below
|
||||
creator_display_name: model.creator_display_name,
|
||||
creator_gravatar_hash: model.creator_gravatar_hash,
|
||||
creator_default_avatar_index: default_avatar_from_username(&model.creator_username),
|
||||
creator_default_avatar_color_index: default_avatar_color_from_username(&model.creator_username),
|
||||
title: model.title,
|
||||
description_markdown: model.description_markdown,
|
||||
description_rendered_html: model.description_rendered_html,
|
||||
ietf_language_tag: model.ietf_language_tag,
|
||||
ietf_primary_language_subtag: model.ietf_primary_language_subtag,
|
||||
is_front_page_featured: model.is_front_page_featured,
|
||||
is_twitch_featured: model.is_twitch_featured,
|
||||
maybe_suggested_unique_bot_command: model.maybe_suggested_unique_bot_command,
|
||||
// NB(bt, 2024-01-20): We won't be needing these much longer.
|
||||
maybe_custom_vocoder: None,
|
||||
//maybe_custom_vocoder: match model.maybe_custom_vocoder {
|
||||
// None => None,
|
||||
// Some(vocoder) => Some(CustomVocoderInfo {
|
||||
// vocoder_token: vocoder.vocoder_token,
|
||||
// vocoder_title: vocoder.vocoder_title,
|
||||
// creator_user_token: vocoder.creator_user_token,
|
||||
// creator_username: vocoder.creator_username,
|
||||
// creator_display_name: vocoder.creator_display_name,
|
||||
// creator_gravatar_hash: vocoder.creator_gravatar_hash,
|
||||
// })
|
||||
//},
|
||||
maybe_default_pretrained_vocoder: model.maybe_default_pretrained_vocoder(),
|
||||
text_preprocessing_algorithm: model.text_preprocessing_algorithm().to_string(),
|
||||
creator_user_token: model.creator_user_token().to_string(),
|
||||
creator_username: model.creator_username().to_string(), // NB: Cloned because of ref use for avatar below
|
||||
creator_display_name: model.creator_display_name().to_string(),
|
||||
creator_gravatar_hash: model.creator_gravatar_hash().to_string(),
|
||||
creator_default_avatar_index: default_avatar_from_username(&model.creator_username().to_string()),
|
||||
creator_default_avatar_color_index: default_avatar_color_from_username(&model.creator_username().to_string()),
|
||||
title: model.title().to_string(),
|
||||
description_markdown: model.description_markdown().to_string(),
|
||||
description_rendered_html: model.description_rendered_html().to_string(),
|
||||
ietf_language_tag: model.ietf_language_tag().to_string(),
|
||||
ietf_primary_language_subtag: model.ietf_primary_language_subtag().to_string(),
|
||||
is_front_page_featured: model.is_front_page_featured(),
|
||||
is_twitch_featured: model.is_twitch_featured(),
|
||||
maybe_suggested_unique_bot_command: model.maybe_suggested_unique_bot_command().map(|s| s.to_string()),
|
||||
user_ratings: UserRatingsStats {
|
||||
positive_count: model.user_ratings_positive_count,
|
||||
negative_count: model.user_ratings_negative_count,
|
||||
total_count: model.user_ratings_total_count,
|
||||
positive_count: model.user_ratings_positive_count(),
|
||||
negative_count: model.user_ratings_negative_count(),
|
||||
total_count: model.user_ratings_total_count(),
|
||||
},
|
||||
creator_set_visibility: model.creator_set_visibility,
|
||||
is_locked_from_use: model.is_locked_from_use,
|
||||
is_locked_from_user_modification: model.is_locked_from_user_modification,
|
||||
created_at: model.created_at,
|
||||
updated_at: model.updated_at,
|
||||
maybe_moderator_fields: model.maybe_moderator_fields.map(|mod_fields| {
|
||||
TtsModelModeratorFieldInfo {
|
||||
use_default_m_factor: mod_fields.use_default_mel_multiply_factor,
|
||||
maybe_custom_m_factor: mod_fields.maybe_custom_mel_multiply_factor,
|
||||
creator_is_banned: mod_fields.creator_is_banned,
|
||||
creator_ip_address_creation: mod_fields.creator_ip_address_creation,
|
||||
creator_ip_address_last_update: mod_fields.creator_ip_address_last_update,
|
||||
user_deleted_at: mod_fields.user_deleted_at,
|
||||
mod_deleted_at: mod_fields.mod_deleted_at,
|
||||
}
|
||||
})
|
||||
creator_set_visibility: model.creator_set_visibility(),
|
||||
is_locked_from_use: model.is_locked_from_use(),
|
||||
is_locked_from_user_modification: model.is_locked_from_user_modification(),
|
||||
created_at: model.created_at().clone(),
|
||||
updated_at: model.updated_at().clone(),
|
||||
maybe_moderator_fields: None,
|
||||
// NB(bt, 2024-01-20): We won't be needing these much longer.
|
||||
//maybe_moderator_fields: model.maybe_moderator_fields.map(|mod_fields| {
|
||||
// TtsModelModeratorFieldInfo {
|
||||
// use_default_m_factor: mod_fields.use_default_mel_multiply_factor,
|
||||
// maybe_custom_m_factor: mod_fields.maybe_custom_mel_multiply_factor,
|
||||
// creator_is_banned: mod_fields.creator_is_banned,
|
||||
// creator_ip_address_creation: mod_fields.creator_ip_address_creation,
|
||||
// creator_ip_address_last_update: mod_fields.creator_ip_address_last_update,
|
||||
// user_deleted_at: mod_fields.user_deleted_at,
|
||||
// mod_deleted_at: mod_fields.mod_deleted_at,
|
||||
// }
|
||||
//})
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+5
-13
@@ -5,30 +5,22 @@ use actix_web::{HttpRequest, HttpResponse, web};
|
||||
use actix_web::error::ResponseError;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::web::Path;
|
||||
use log::{error, log, warn};
|
||||
use enums::by_table::audit_logs::audit_log_entity_action::AuditLogEntityAction::Delete;
|
||||
use log::warn;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use http_server_common::request::get_request_ip::get_request_ip;
|
||||
use http_server_common::response::serialize_as_json_error::serialize_as_json_error;
|
||||
use mysql_queries::queries::model_weights::delete_weights::{
|
||||
delete_weights_as_user,
|
||||
delete_weights_as_mod,
|
||||
undelete_weights_as_user,
|
||||
undelete_weights_as_mod
|
||||
delete_weights_as_user,
|
||||
undelete_weights_as_user
|
||||
};
|
||||
use mysql_queries::queries::model_weights::get_weight::get_weight_by_token;
|
||||
|
||||
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
use crate::http_server::web_utils::response_success_helpers::simple_json_success;
|
||||
use crate::server_state::ServerState;
|
||||
use crate::util::delete_role_disambiguation::{delete_role_disambiguation, DeleteRole};
|
||||
|
||||
use enums::common::visibility::Visibility;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[derive(Deserialize,ToSchema)]
|
||||
pub struct DeleteWeightPathInfo {
|
||||
weight_token: String,
|
||||
|
||||
@@ -13,10 +13,10 @@ use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use mysql_queries::queries::model_weights::get_weight::get_weight_by_token;
|
||||
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use crate::http_server::common_responses::cover_image_details::CoverImageDetails;
|
||||
|
||||
use crate::http_server::common_responses::cover_image_details::CoverImageDetails;
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::server_state::ServerState;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ use http_server_common::response::response_success_helpers::simple_json_success;
|
||||
use http_server_common::response::serialize_as_json_error::serialize_as_json_error;
|
||||
use mysql_queries::queries::media_files::get_media_file::get_media_file;
|
||||
use mysql_queries::queries::model_weights::edit::set_model_weight_cover_image::{set_model_weight_cover_image, UpdateArgs};
|
||||
use mysql_queries::queries::model_weights::get_weight::get_weight_by_token;
|
||||
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
|
||||
+2
-2
@@ -7,14 +7,14 @@ use actix_web::http::StatusCode;
|
||||
use actix_web::web::Path;
|
||||
use log::warn;
|
||||
use utoipa::ToSchema;
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use http_server_common::response::response_success_helpers::simple_json_success;
|
||||
use http_server_common::response::serialize_as_json_error::serialize_as_json_error;
|
||||
use mysql_queries::queries::media_files::get_media_file::get_media_file;
|
||||
use mysql_queries::queries::model_weights::edit::update_weight::{CoverImageOption, update_weights, UpdateWeightArgs};
|
||||
use mysql_queries::queries::model_weights::get_weight::get_weight_by_token;
|
||||
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use user_input_common::check_for_slurs::contains_slurs;
|
||||
|
||||
Reference in new issue
Block a user