mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-31 15:55:54 -04:00
Compare commits
103
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f08cc3fd4a | ||
|
|
b7853b8914 | ||
|
|
26d5d6d272 | ||
|
|
4e20f63f87 | ||
|
|
c8fa722b3d | ||
|
|
0540d2caba | ||
|
|
449c29e824 | ||
|
|
bf4bd8f21c | ||
|
|
59bcf8b040 | ||
|
|
9785f3292d | ||
|
|
6f7262d0e8 | ||
|
|
ec0b475457 | ||
|
|
47db5d0f3d | ||
|
|
e9de700f2c | ||
|
|
f365f1a02f | ||
|
|
bfebf60289 | ||
|
|
f0f2788e1b | ||
|
|
33b66f388f | ||
|
|
387cb22e65 | ||
|
|
7248425f30 | ||
|
|
cc0e3a2f01 | ||
|
|
aa719ba56f | ||
|
|
1da489a177 | ||
|
|
e777d996bc | ||
|
|
eeb6d486e1 | ||
|
|
57ca10f23d | ||
|
|
7b97c3bfd2 | ||
|
|
111383a0ae | ||
|
|
542a7c7116 | ||
|
|
c6dc35eccb | ||
|
|
d8fbc09867 | ||
|
|
2b0ebd5350 | ||
|
|
8d22697855 | ||
|
|
6cdbe9ea00 | ||
|
|
15db937039 | ||
|
|
a01bde2a4b | ||
|
|
98bf91fa17 | ||
|
|
6f4fe5c542 | ||
|
|
ebae1dbc9f | ||
|
|
39a07b25f5 | ||
|
|
168afd72cd | ||
|
|
8ba103fd2b | ||
|
|
ef53d96a27 | ||
|
|
ebc6834128 | ||
|
|
ea1090b8ef | ||
|
|
3415ad4e80 | ||
|
|
9c9c2b4fff | ||
|
|
7bea2ed724 | ||
|
|
e7f2aed1ef | ||
|
|
13573437fb | ||
|
|
215e958405 | ||
|
|
1238f95af8 | ||
|
|
69e6a73ef4 | ||
|
|
51ce0c29cb | ||
|
|
e45ee58cdf | ||
|
|
d80b883ce7 | ||
|
|
0743684f0d | ||
|
|
2a2b08d711 | ||
|
|
06feb58d83 | ||
|
|
e91f57944e | ||
|
|
84a2aa6108 | ||
|
|
126ed66232 | ||
|
|
af8fb02078 | ||
|
|
968af24ccc | ||
|
|
2c8e9ff823 | ||
|
|
403529c83d | ||
|
|
ea85dbc6e6 | ||
|
|
0ee62b64fe | ||
|
|
d2d295c12f | ||
|
|
edb2a7f95a | ||
|
|
aff8d5d310 | ||
|
|
f37c04ee07 | ||
|
|
93f8a95298 | ||
|
|
55367e8723 | ||
|
|
957b68f679 | ||
|
|
cb6feaaa46 | ||
|
|
c7bc5e3686 | ||
|
|
0811e12c0b | ||
|
|
65c5138533 | ||
|
|
20ced958e6 | ||
|
|
22026977d9 | ||
|
|
f812fbb4e6 | ||
|
|
20832a9af9 | ||
|
|
7558a4edc9 | ||
|
|
59745551ce | ||
|
|
3e875fb6fa | ||
|
|
da2ea13524 | ||
|
|
550a11c493 | ||
|
|
a4b549af19 | ||
|
|
7eb93c7600 | ||
|
|
c44cc5671f | ||
|
|
380933d1aa | ||
|
|
5298c028e0 | ||
|
|
ad32bdb119 | ||
|
|
3318067cb5 | ||
|
|
c15360ddb3 | ||
|
|
e741951630 | ||
|
|
c91f548878 | ||
|
|
35231e5f82 | ||
|
|
7f1173956a | ||
|
|
f6da4f3247 | ||
|
|
8dc7c81a78 | ||
|
|
387dbbeed9 |
@@ -64,6 +64,8 @@ HIFIGAN_ROOT_CODE_DIRECTORY=/home/bt/dev/storyteller/storyteller-ml/tts
|
||||
HIFIGAN_VIRTUAL_ENV_ACTIVATION_COMMAND="source python/bin/activate"
|
||||
HIFIGAN_MODEL_CHECK_SCRIPT_NAME="vocodes_model_check_hifigan.py"
|
||||
|
||||
DOWNLOAD_SCRIPT="/home/tensor/code/storyteller/web-downloader/.venv/bin/python3.11 /home/tensor/code/storyteller/web-downloader/download_internet_file.py"
|
||||
|
||||
TTS_INFERENCE_SIDECAR_HOSTNAME=localhost:8000
|
||||
|
||||
#TTS_WAVEGLOW_VOCODER_MODEL_FILENAME=waveglow_256channels_universal_v5.pt # THIS SOUNDS HORRID
|
||||
@@ -76,4 +78,4 @@ TTS_HIFIGAN_SUPERRES_VOCODER_MODEL_FILENAME=hifigan_superres_twilight_33000.pt
|
||||
# Development key. Permissible to check in.
|
||||
NEWRELIC_API_KEY=c402be1c4c4216ec83d0cfc0851520cfFFFFNRAL
|
||||
|
||||
#STORYTELLER_ROOT="/home/tensor/code/storyteller/" # Put this in .env-secrets so that not everyone gets this setting.
|
||||
STORYTELLER_ROOT="/home/tensor/code/storyteller/" # Put this in .env-secrets so that not everyone gets this setting.
|
||||
|
||||
Generated
+1
@@ -26,6 +26,7 @@
|
||||
<w>hparams</w>
|
||||
<w>huggingface</w>
|
||||
<w>lipsync</w>
|
||||
<w>mocap</w>
|
||||
<w>mochi</w>
|
||||
<w>nestedness</w>
|
||||
<w>pathbuf</w>
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO generic_inference_jobs\nSET\n token = ?,\n uuid_idempotency_token = ?,\n\n inference_category = ?,\n maybe_model_type = ?,\n maybe_model_token = ?,\n\n maybe_input_source_token = ?,\n maybe_input_source_token_type = ?,\n\n maybe_raw_inference_text = ?,\n\n maybe_inference_args = ?,\n\n maybe_creator_user_token = ?,\n maybe_creator_anonymous_visitor_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n\n priority_level = ?,\n is_keepalive_required = ?,\n max_duration_seconds = ?,\n\n is_debug_request = ?,\n maybe_routing_tag = ?,\n\n status = \"pending\"\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 18
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "0d780caac7560f84efb50bd2ed876cbdd728b32e26b73dfbb3009ada12985405"
|
||||
}
|
||||
+465
@@ -0,0 +1,465 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n\n w_extension.ietf_language_tag as maybe_ietf_language_tag,\n w_extension.ietf_primary_language_subtag as maybe_ietf_primary_language_subtag,\n w_extension.maybe_default_pretrained_vocoder,\n w_extension.text_pipeline_type as maybe_text_pipeline_type,\n w_extension.use_default_mel_multiply_factor,\n w_extension.maybe_custom_mel_multiply_factor,\n\n w_extension.maybe_custom_vocoder_token,\n\n vocoder.vocoder_type as `maybe_custom_vocoder_type: enums::common::vocoder_type::VocoderType`,\n vocoder.title as maybe_custom_vocoder_title,\n vocoder.private_bucket_hash as maybe_custom_vocoder_private_bucket_hash,\n\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n LEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = wt.token\n\n LEFT OUTER JOIN model_weights_extension_tts_details as w_extension\n ON w_extension.model_weights_token = wt.token\n\n LEFT OUTER JOIN vocoder_models AS vocoder\n ON vocoder.token = w_extension.maybe_custom_vocoder_token\n\n WHERE\n wt.token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::model_weights::ModelWeightToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "weights_type: enums::by_table::model_weights::weights_types::WeightsType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "maybe_description_markdown",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "maybe_description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "creator_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "creator_ip_address",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 160
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "original_download_url",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 2048
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"name": "original_filename",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"name": "file_size_bytes",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"name": "file_checksum_sha2",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"name": "public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 18,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 19,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 20,
|
||||
"name": "maybe_cover_image_public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "maybe_cover_image_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 22,
|
||||
"name": "maybe_cover_image_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 23,
|
||||
"name": "maybe_ratings_positive_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 24,
|
||||
"name": "maybe_ratings_negative_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 25,
|
||||
"name": "maybe_bookmark_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 26,
|
||||
"name": "maybe_ietf_language_tag",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 27,
|
||||
"name": "maybe_ietf_primary_language_subtag",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 48
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 28,
|
||||
"name": "maybe_default_pretrained_vocoder",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 29,
|
||||
"name": "maybe_text_pipeline_type",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 30,
|
||||
"name": "use_default_mel_multiply_factor",
|
||||
"type_info": {
|
||||
"type": "Tiny",
|
||||
"flags": "",
|
||||
"char_set": 63,
|
||||
"max_size": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 31,
|
||||
"name": "maybe_custom_mel_multiply_factor",
|
||||
"type_info": {
|
||||
"type": "Double",
|
||||
"flags": "",
|
||||
"char_set": 63,
|
||||
"max_size": 22
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 32,
|
||||
"name": "maybe_custom_vocoder_token",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 33,
|
||||
"name": "maybe_custom_vocoder_type: enums::common::vocoder_type::VocoderType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 34,
|
||||
"name": "maybe_custom_vocoder_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 35,
|
||||
"name": "maybe_custom_vocoder_private_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 36,
|
||||
"name": "version",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 37,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 38,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 39,
|
||||
"name": "user_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 40,
|
||||
"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,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "6c0a2cb31a3241fc6cd0b6738901a31bd91298f131d3b87744c698e92eaec34b"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n INSERT INTO media_files\n SET\n token = ?,\n media_type = ?,\n\n origin_category = ?, \n origin_product_category = ?, \n maybe_origin_model_type = ?, \n maybe_origin_model_token = ?, \n maybe_origin_filename = ?,\n\n is_batch_generated = ?, \n\n maybe_mime_type = ?,\n file_size_bytes = ?,\n maybe_duration_millis = ?,\n maybe_audio_encoding = ?, \n maybe_video_encoding = ?, \n maybe_frame_width = ?, \n maybe_frame_height = ?, \n checksum_sha2 = ?,\n\n public_bucket_directory_hash = ?, \n maybe_public_bucket_prefix = ?, \n maybe_public_bucket_extension = ?, \n extra_file_modification_info = ?, \n\n maybe_creator_user_token = ?, \n maybe_creator_anonymous_visitor_token = ?, \n\n creator_ip_address = ?, \n creator_set_visibility = ?, \n\n maybe_creator_file_synthetic_id = ?, \n maybe_creator_category_synthetic_id = ?,\n\n maybe_mod_user_token = ?, \n is_generated_on_prem = ?, \n generated_by_worker = ?, \n generated_by_cluster = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 30
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "80900178668fb38ae51dfe19401c1be37f4ef97fda0198f83239507b8000d1ae"
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n m.token as `token: tokens::tokens::media_files::MediaFileToken`,\n\n m.media_type as `media_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n\n m.maybe_creator_user_token as `maybe_creator_user_token: tokens::tokens::users::UserToken`,\n m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n m.public_bucket_directory_hash,\n m.maybe_public_bucket_prefix,\n m.maybe_public_bucket_extension\n\nFROM media_files AS m\nWHERE\n m.token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::media_files::MediaFileToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "media_type: enums::by_table::media_files::media_file_type::MediaFileType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "maybe_creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "public_bucket_directory_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "8ba733c63aff16f144417eaa2004d7de479e59f62688016f0ce7b7c61ec1ec57"
|
||||
}
|
||||
+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"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO generic_inference_jobs\nSET\n token = ?,\n uuid_idempotency_token = ?,\n\n job_type = ?,\n\n inference_category = ?,\n maybe_model_type = ?,\n maybe_model_token = ?,\n\n maybe_input_source_token = ?,\n maybe_input_source_token_type = ?,\n\n maybe_raw_inference_text = ?,\n\n maybe_inference_args = ?,\n\n maybe_creator_user_token = ?,\n maybe_creator_anonymous_visitor_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n\n priority_level = ?,\n is_keepalive_required = ?,\n max_duration_seconds = ?,\n\n is_debug_request = ?,\n maybe_routing_tag = ?,\n\n status = \"pending\"\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 19
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "e97a0974ed643b8a20d4d319b4aa93aba979d5f8fc0bdc44b77ef4f945b03b35"
|
||||
}
|
||||
Generated
+51
-4
@@ -2149,6 +2149,7 @@ dependencies = [
|
||||
"errors",
|
||||
"log",
|
||||
"my-workspace-hack",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokens",
|
||||
@@ -3084,6 +3085,7 @@ dependencies = [
|
||||
"hyper",
|
||||
"images",
|
||||
"jobs_common",
|
||||
"jsonpath_lib",
|
||||
"lfu",
|
||||
"log",
|
||||
"media",
|
||||
@@ -3097,6 +3099,7 @@ dependencies = [
|
||||
"r2d2_redis",
|
||||
"rand 0.8.5",
|
||||
"redis_common",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
@@ -3108,6 +3111,7 @@ dependencies = [
|
||||
"tokens",
|
||||
"tokio",
|
||||
"tts_common",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3225,6 +3229,17 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsonpath_lib"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eaa63191d68230cccb81c5aa23abd53ed64d83337cacbb25a7b8c7979523774f"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jwt"
|
||||
version = "0.13.0"
|
||||
@@ -3619,7 +3634,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"serial_test",
|
||||
"serial_test 2.0.0",
|
||||
"sqlx",
|
||||
"tokens",
|
||||
"tokio",
|
||||
@@ -3892,7 +3907,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"serial_test",
|
||||
"serial_test 2.0.0",
|
||||
"sqlx",
|
||||
"tokens",
|
||||
"tokio",
|
||||
@@ -5401,6 +5416,7 @@ version = "1.0.108"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"itoa 1.0.9",
|
||||
"ryu",
|
||||
"serde",
|
||||
@@ -5512,7 +5528,21 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
"parking_lot 0.12.1",
|
||||
"serial_test_derive",
|
||||
"serial_test_derive 2.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serial_test"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "953ad9342b3aaca7cb43c45c097dd008d4907070394bd0751a0aa8817e5a018d"
|
||||
dependencies = [
|
||||
"dashmap",
|
||||
"futures 0.3.29",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"parking_lot 0.12.1",
|
||||
"serial_test_derive 3.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5526,6 +5556,17 @@ dependencies = [
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serial_test_derive"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b93fb4adc70021ac1b47f7d45e8cc4169baaa7ea58483bc5b721d19a26202212"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "server_environment"
|
||||
version = "0.0.1"
|
||||
@@ -6090,6 +6131,7 @@ dependencies = [
|
||||
"sha2 0.9.9",
|
||||
"speculoos",
|
||||
"sqlx",
|
||||
"strum",
|
||||
"symphonia",
|
||||
"time 0.3.30",
|
||||
"tokens",
|
||||
@@ -6112,7 +6154,7 @@ name = "storyteller_root"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"my-workspace-hack",
|
||||
"serial_test",
|
||||
"serial_test 2.0.0",
|
||||
"tempdir",
|
||||
]
|
||||
|
||||
@@ -6195,7 +6237,12 @@ dependencies = [
|
||||
name = "subprocess_common"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"errors",
|
||||
"filesys",
|
||||
"log",
|
||||
"my-workspace-hack",
|
||||
"serial_test 3.0.0",
|
||||
"subprocess",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
+5
-2
@@ -18,6 +18,9 @@ deny = [
|
||||
"clippy::borrow_as_ptr",
|
||||
"clippy::borrow_deref_ref",
|
||||
|
||||
# Clippy async
|
||||
"clippy::await_holding_lock",
|
||||
|
||||
# Clippy - performance
|
||||
"clippy::cmp_owned",
|
||||
"clippy::useless_vec",
|
||||
@@ -43,12 +46,12 @@ deny = [
|
||||
"unused_imports", # These are easy to automatically cull
|
||||
"unused_parens", # Unused parens are ugly
|
||||
"unused_variables", # Don't leave cruft
|
||||
|
||||
#"unused_mut", # Be strict about mutability (TODO)
|
||||
"unused_mut", # Be strict about mutability
|
||||
|
||||
# Possible:
|
||||
# "clippy::ptr_arg",
|
||||
# "clippy::too_many_lines" (note: this is configurable)
|
||||
# "clippy::clone_on_copy", # Don't use clone() on Copy types
|
||||
]
|
||||
|
||||
warn = [
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
update model_weights
|
||||
set
|
||||
mod_deleted_at = NOW()
|
||||
where token IN (
|
||||
'weight_tnhacmxb9qwqrygc3pxvk3ds6',
|
||||
'weight_9g1pghkc0xhfy5n9m36b11vds',
|
||||
'weight_5k0kzkftr4x39xyc9yg5p9c86'
|
||||
);
|
||||
|
||||
@@ -375,7 +375,8 @@ where token IN (
|
||||
'vcm_a47wtfbsjrfc',
|
||||
'vcm_kygenhbg5mgj',
|
||||
'vcm_s8gndv19yt7p',
|
||||
'vcm_ny9pj57w5eyh'
|
||||
'vcm_ny9pj57w5eyh',
|
||||
'vcm_jg4rst3j2d7x'
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
|
||||
-- Inventory non-deleted
|
||||
select
|
||||
m.id,
|
||||
m.token,
|
||||
SUBSTRING(m.title, 1, 35) as title,
|
||||
u.username,
|
||||
SUBSTRING(m.original_download_url, 1, 35) as url,
|
||||
m.updated_at
|
||||
from model_weights as m
|
||||
left join users AS u on
|
||||
u.token = m.creator_user_token
|
||||
where
|
||||
m.user_deleted_at IS NULL
|
||||
and m.mod_deleted_at IS NULL
|
||||
order by m.title asc;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE generic_inference_jobs DROP COLUMN job_type;
|
||||
@@ -0,0 +1,10 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE generic_inference_jobs
|
||||
ADD COLUMN job_type VARCHAR(32) DEFAULT NULL
|
||||
AFTER uuid_idempotency_token;
|
||||
|
||||
ALTER TABLE generic_inference_jobs
|
||||
ADD INDEX index_job_type (job_type);
|
||||
@@ -17,12 +17,27 @@ CREATE TABLE generic_inference_jobs (
|
||||
|
||||
-- ========== INFERENCE DETAILS ==========
|
||||
|
||||
-- The new enum for the type of job, which will eventually replace `inference_category` and `maybe_model_type`.
|
||||
-- This isn't fully supported yet in the inference-job, but we'll start populating it and adding logic around it.
|
||||
-- We'll start this out as nullable, then migrate the old rows with a default column value.
|
||||
job_type VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- NB: This is becoming a problematic field and is becoming conflated with `maybe_model_type`.
|
||||
-- We're using this to handle job dispatching, but the latter is being used to load container
|
||||
-- dependencies at startup (even if it isn't a real model type or a polymorphic foreign key).
|
||||
-- This is pretty gross and horrible.
|
||||
--
|
||||
-- Broad category of inference
|
||||
-- Examples (may not be up to date):
|
||||
-- * text_to_speech
|
||||
-- * voice_conversion
|
||||
inference_category VARCHAR(32) NOT NULL,
|
||||
|
||||
-- NB: See notes on inference_category. This is becoming a problematic field. We're using
|
||||
-- this to load the container spin-up arguments and dependencies, but the former is being
|
||||
-- used to dispatch the job. `inference_category` is the one that should probably go away,
|
||||
-- and this column should be renamed to `inference_job_type`.
|
||||
--
|
||||
-- Potential part of the composite foreign key to the primary model being used, if any.
|
||||
-- This will normally live in `maybe_inference_args`, but in this case, it's useful for
|
||||
-- running easy database analytical queries.
|
||||
@@ -239,6 +254,7 @@ CREATE TABLE generic_inference_jobs (
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (token),
|
||||
UNIQUE KEY (uuid_idempotency_token),
|
||||
KEY index_job_type (job_type),
|
||||
KEY index_inference_category (inference_category),
|
||||
KEY index_maybe_model_type_and_maybe_model_token (maybe_model_type, maybe_model_token),
|
||||
KEY index_maybe_model_type (maybe_model_type),
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -73,6 +73,14 @@ impl MediaFileBucketPath {
|
||||
pub fn get_basename(&self) -> &str {
|
||||
&self.filename
|
||||
}
|
||||
|
||||
pub fn get_optional_prefix(&self) -> Option<&str> {
|
||||
self.optional_prefix.as_deref()
|
||||
}
|
||||
|
||||
pub fn get_optional_extension(&self) -> Option<&str> {
|
||||
self.optional_extension.as_deref()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -12,6 +12,7 @@ const ORIGINAL_FILE_BASENAME : &str = "original_upload.bin";
|
||||
/// The original user upload file.
|
||||
/// It may have derivative files (down samples, crops, etc.) that live alongside it.
|
||||
#[derive(Clone)]
|
||||
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
|
||||
pub struct MediaUploadOriginalFilePath {
|
||||
directory: MediaUploadDirectory,
|
||||
full_object_path: String,
|
||||
@@ -21,11 +22,13 @@ impl PublicPath for MediaUploadOriginalFilePath {}
|
||||
|
||||
impl MediaUploadOriginalFilePath {
|
||||
|
||||
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
|
||||
pub fn generate_new() -> Self {
|
||||
let entropy = crockford_entropy_lower(32);
|
||||
Self::from_object_hash(&entropy)
|
||||
}
|
||||
|
||||
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
|
||||
pub fn from_object_hash(hash: &str) -> Self {
|
||||
// TODO: Path construction could be cleaner.
|
||||
let directory = MediaUploadDirectory::from_object_hash(hash);
|
||||
@@ -36,22 +39,27 @@ impl MediaUploadOriginalFilePath {
|
||||
}
|
||||
}
|
||||
|
||||
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
|
||||
pub fn get_full_object_path_str(&self) -> &str {
|
||||
&self.full_object_path
|
||||
}
|
||||
|
||||
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
|
||||
pub fn to_full_object_pathbuf(&self) -> PathBuf {
|
||||
PathBuf::from(&self.full_object_path)
|
||||
}
|
||||
|
||||
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
|
||||
pub fn get_directory(&self) -> &MediaUploadDirectory {
|
||||
&self.directory
|
||||
}
|
||||
|
||||
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
|
||||
pub fn get_object_hash(&self) -> &str {
|
||||
&self.directory.get_object_hash()
|
||||
}
|
||||
|
||||
#[deprecated(note = "Use media_files records and MediaFileBucketPath instead. media_uploads records are DEPRECATED.")]
|
||||
pub fn get_basename() -> &'static str {
|
||||
ORIGINAL_FILE_BASENAME
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ use strum::EnumIter;
|
||||
/// Another benefit is that we'll surface all of the various types of failure and perhaps eventually
|
||||
/// come to handle some in a cross-cutting way.
|
||||
///
|
||||
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
|
||||
pub enum FrontendFailureCategory {
|
||||
|
||||
@@ -11,7 +11,7 @@ use strum::EnumIter;
|
||||
/// Each "category" of inference is identified by the following enum variants.
|
||||
/// These types are present in the HTTP API and database columns as serialized here.
|
||||
///
|
||||
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize, Default)]
|
||||
pub enum InferenceCategory {
|
||||
@@ -31,8 +31,15 @@ pub enum InferenceCategory {
|
||||
|
||||
#[serde(rename = "image_generation")]
|
||||
ImageGeneration,
|
||||
|
||||
#[serde(rename = "mocap")]
|
||||
Mocap,
|
||||
|
||||
#[serde(rename = "workflow")]
|
||||
Workflow,
|
||||
|
||||
#[serde(rename = "format_conversion")]
|
||||
FormatConversion,
|
||||
}
|
||||
|
||||
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
|
||||
@@ -49,6 +56,8 @@ impl InferenceCategory {
|
||||
Self::VideoFilter => "video_filter",
|
||||
Self::ImageGeneration => "image_generation",
|
||||
Self::Mocap => "mocap",
|
||||
Self::Workflow => "workflow",
|
||||
Self::FormatConversion => "format_conversion",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +69,8 @@ impl InferenceCategory {
|
||||
"video_filter" => Ok(Self::VideoFilter),
|
||||
"image_generation" => Ok(Self::ImageGeneration),
|
||||
"mocap" => Ok(Self::Mocap),
|
||||
"workflow" => Ok(Self::Workflow),
|
||||
"format_conversion" => Ok(Self::FormatConversion),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -74,6 +85,8 @@ impl InferenceCategory {
|
||||
Self::VideoFilter,
|
||||
Self::ImageGeneration,
|
||||
Self::Mocap,
|
||||
Self::Workflow,
|
||||
Self::FormatConversion,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -83,51 +96,92 @@ mod tests {
|
||||
use crate::by_table::generic_inference_jobs::inference_category::InferenceCategory;
|
||||
use crate::test_helpers::assert_serialization;
|
||||
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(InferenceCategory::LipsyncAnimation, "lipsync_animation");
|
||||
assert_serialization(InferenceCategory::TextToSpeech, "text_to_speech");
|
||||
assert_serialization(InferenceCategory::VoiceConversion, "voice_conversion");
|
||||
assert_serialization(InferenceCategory::VideoFilter, "video_filter");
|
||||
assert_serialization(InferenceCategory::ImageGeneration, "image_generation");
|
||||
assert_serialization(InferenceCategory::Mocap, "mocap")
|
||||
mod explicit_checks {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(InferenceCategory::LipsyncAnimation, "lipsync_animation");
|
||||
assert_serialization(InferenceCategory::TextToSpeech, "text_to_speech");
|
||||
assert_serialization(InferenceCategory::VoiceConversion, "voice_conversion");
|
||||
assert_serialization(InferenceCategory::VideoFilter, "video_filter");
|
||||
assert_serialization(InferenceCategory::ImageGeneration, "image_generation");
|
||||
assert_serialization(InferenceCategory::Mocap, "mocap");
|
||||
assert_serialization(InferenceCategory::Workflow, "workflow");
|
||||
assert_serialization(InferenceCategory::FormatConversion, "format_conversion");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_str() {
|
||||
assert_eq!(InferenceCategory::LipsyncAnimation.to_str(), "lipsync_animation");
|
||||
assert_eq!(InferenceCategory::TextToSpeech.to_str(), "text_to_speech");
|
||||
assert_eq!(InferenceCategory::VoiceConversion.to_str(), "voice_conversion");
|
||||
assert_eq!(InferenceCategory::VideoFilter.to_str(), "video_filter");
|
||||
assert_eq!(InferenceCategory::ImageGeneration.to_str(), "image_generation");
|
||||
assert_eq!(InferenceCategory::Mocap.to_str(), "mocap");
|
||||
assert_eq!(InferenceCategory::Workflow.to_str(), "workflow");
|
||||
assert_eq!(InferenceCategory::FormatConversion.to_str(), "format_conversion");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_str() {
|
||||
assert_eq!(InferenceCategory::from_str("lipsync_animation").unwrap(), InferenceCategory::LipsyncAnimation);
|
||||
assert_eq!(InferenceCategory::from_str("text_to_speech").unwrap(), InferenceCategory::TextToSpeech);
|
||||
assert_eq!(InferenceCategory::from_str("voice_conversion").unwrap(), InferenceCategory::VoiceConversion);
|
||||
assert_eq!(InferenceCategory::from_str("video_filter").unwrap(), InferenceCategory::VideoFilter);
|
||||
assert_eq!(InferenceCategory::from_str("image_generation").unwrap(), InferenceCategory::ImageGeneration);
|
||||
assert_eq!(InferenceCategory::from_str("mocap").unwrap(), InferenceCategory::Mocap);
|
||||
assert_eq!(InferenceCategory::from_str("workflow").unwrap(), InferenceCategory::Workflow);
|
||||
assert_eq!(InferenceCategory::from_str("format_conversion").unwrap(), InferenceCategory::FormatConversion);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
// Static check
|
||||
let mut variants = InferenceCategory::all_variants();
|
||||
assert_eq!(variants.len(), 8);
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::LipsyncAnimation));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::TextToSpeech));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::VoiceConversion));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::VideoFilter));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::ImageGeneration));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::Mocap));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::Workflow));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::FormatConversion));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
|
||||
// Generated check
|
||||
use strum::IntoEnumIterator;
|
||||
assert_eq!(InferenceCategory::all_variants().len(), InferenceCategory::iter().len());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_str() {
|
||||
assert_eq!(InferenceCategory::LipsyncAnimation.to_str(), "lipsync_animation");
|
||||
assert_eq!(InferenceCategory::TextToSpeech.to_str(), "text_to_speech");
|
||||
assert_eq!(InferenceCategory::VoiceConversion.to_str(), "voice_conversion");
|
||||
assert_eq!(InferenceCategory::VideoFilter.to_str(), "video_filter");
|
||||
assert_eq!(InferenceCategory::ImageGeneration.to_str(), "image_generation");
|
||||
assert_eq!(InferenceCategory::Mocap.to_str(), "mocap");
|
||||
}
|
||||
mod mechanical_checks {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn from_str() {
|
||||
assert_eq!(InferenceCategory::from_str("lipsync_animation").unwrap(), InferenceCategory::LipsyncAnimation);
|
||||
assert_eq!(InferenceCategory::from_str("text_to_speech").unwrap(), InferenceCategory::TextToSpeech);
|
||||
assert_eq!(InferenceCategory::from_str("voice_conversion").unwrap(), InferenceCategory::VoiceConversion);
|
||||
assert_eq!(InferenceCategory::from_str("video_filter").unwrap(), InferenceCategory::VideoFilter);
|
||||
assert_eq!(InferenceCategory::from_str("image_generation").unwrap(), InferenceCategory::ImageGeneration);
|
||||
assert_eq!(InferenceCategory::from_str("mocap").unwrap(), InferenceCategory::Mocap);
|
||||
}
|
||||
#[test]
|
||||
fn variant_length() {
|
||||
use strum::IntoEnumIterator;
|
||||
assert_eq!(InferenceCategory::all_variants().len(), InferenceCategory::iter().len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
// Static check
|
||||
let mut variants = InferenceCategory::all_variants();
|
||||
assert_eq!(variants.len(), 5);
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::LipsyncAnimation));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::TextToSpeech));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::VoiceConversion));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::VideoFilter));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::ImageGeneration));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::Mocap));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
#[test]
|
||||
fn round_trip() {
|
||||
for variant in InferenceCategory::all_variants() {
|
||||
assert_eq!(variant, InferenceCategory::from_str(variant.to_str()).unwrap());
|
||||
assert_eq!(variant, InferenceCategory::from_str(&format!("{}", variant)).unwrap());
|
||||
assert_eq!(variant, InferenceCategory::from_str(&format!("{:?}", variant)).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
// Generated check
|
||||
use strum::IntoEnumIterator;
|
||||
assert_eq!(InferenceCategory::all_variants().len(), InferenceCategory::iter().len());
|
||||
#[test]
|
||||
fn serialized_length_ok_for_database() {
|
||||
const MAX_LENGTH : usize = 32;
|
||||
for variant in InferenceCategory::all_variants() {
|
||||
let serialized = variant.to_str();
|
||||
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
|
||||
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ use strum::EnumIter;
|
||||
|
||||
/// Used in the `generic_inference_jobs` table in `VARCHAR(32)` field `maybe_input_source_token`.
|
||||
///
|
||||
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
|
||||
pub enum InferenceInputSourceTokenType {
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
#[cfg(test)]
|
||||
use strum::EnumCount;
|
||||
#[cfg(test)]
|
||||
use strum::EnumIter;
|
||||
|
||||
/// Used in the `generic_inference_jobs` table in `VARCHAR(32)` field `job_type`.
|
||||
///
|
||||
/// TODO(bt,2024-02-01): This will replace "inference_category" and "maybe_model_type" for job control and dispatch,
|
||||
/// since those mechanisms are overloaded and inconsistent.
|
||||
///
|
||||
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize, Default)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum InferenceJobType {
|
||||
/// Jobs that run ComfyUI workflows
|
||||
ComfyUi,
|
||||
|
||||
/// A job that turns "FBX" game engine files into "GLTF" files (Bevy-compatible).
|
||||
#[serde(rename = "convert_fbx_gltf")]
|
||||
ConvertFbxToGltf,
|
||||
|
||||
/// Process a video into BVH mocap animation data for game engines
|
||||
MocapNet,
|
||||
|
||||
/// Re-render a video is a video style transfer algorithm. We developed code
|
||||
/// around it, but chose to develop AnimateDiff / ComfyUI support instead.
|
||||
RerenderAVideo,
|
||||
|
||||
/// RVC is a voice conversion model. RVCv2 is the most popular such model currently.
|
||||
#[serde(rename = "rvc_v2")]
|
||||
RvcV2,
|
||||
|
||||
/// SadTalker does image-to-video lip-syncing when given an audio file and image.
|
||||
SadTalker,
|
||||
|
||||
/// so-vits-svc voice conversion. This predates RVCv2.
|
||||
SoVitsSvc,
|
||||
|
||||
/// Stable diffusion image generation
|
||||
StableDiffusion,
|
||||
|
||||
/// StyleTTS2 is a zero shot multi-speaker TTS model.
|
||||
/// This job type should handle both speaker vector encoding and inference.
|
||||
#[serde(rename = "styletts2")]
|
||||
StyleTTS2,
|
||||
|
||||
/// TT2 Text to speech
|
||||
Tacotron2,
|
||||
|
||||
/// A value we may use in the future for historical jobs
|
||||
/// (i.e. when we backfill the database column and make it non-nullable)
|
||||
#[default]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
|
||||
impl_enum_display_and_debug_using_to_str!(InferenceJobType);
|
||||
impl_mysql_enum_coders!(InferenceJobType);
|
||||
|
||||
/// NB: Legacy API for older code.
|
||||
impl InferenceJobType {
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::ComfyUi => "comfy_ui",
|
||||
Self::ConvertFbxToGltf => "convert_fbx_gltf",
|
||||
Self::MocapNet => "mocap_net",
|
||||
Self::RerenderAVideo => "rerender_a_video",
|
||||
Self::RvcV2 => "rvc_v2",
|
||||
Self::SadTalker => "sad_talker",
|
||||
Self::SoVitsSvc => "so_vits_svc",
|
||||
Self::StableDiffusion => "stable_diffusion",
|
||||
Self::StyleTTS2 => "styletts2",
|
||||
Self::Tacotron2 => "tacotron2",
|
||||
Self::Unknown => "unknown",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_str(value: &str) -> Result<Self, String> {
|
||||
match value {
|
||||
"comfy_ui" => Ok(Self::ComfyUi),
|
||||
"convert_fbx_gltf" => Ok(Self::ConvertFbxToGltf),
|
||||
"mocap_net" => Ok(Self::MocapNet),
|
||||
"rerender_a_video" => Ok(Self::RerenderAVideo),
|
||||
"rvc_v2" => Ok(Self::RvcV2),
|
||||
"sad_talker" => Ok(Self::SadTalker),
|
||||
"so_vits_svc" => Ok(Self::SoVitsSvc),
|
||||
"stable_diffusion" => Ok(Self::StableDiffusion),
|
||||
"styletts2" => Ok(Self::StyleTTS2),
|
||||
"tacotron2" => Ok(Self::Tacotron2),
|
||||
"unknown" => Ok(Self::Unknown),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn all_variants() -> BTreeSet<Self> {
|
||||
// NB: BTreeSet is sorted
|
||||
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
|
||||
BTreeSet::from([
|
||||
Self::ComfyUi,
|
||||
Self::ConvertFbxToGltf,
|
||||
Self::MocapNet,
|
||||
Self::RerenderAVideo,
|
||||
Self::RvcV2,
|
||||
Self::SadTalker,
|
||||
Self::SoVitsSvc,
|
||||
Self::StableDiffusion,
|
||||
Self::StyleTTS2,
|
||||
Self::Tacotron2,
|
||||
Self::Unknown,
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::by_table::generic_inference_jobs::inference_job_type::InferenceJobType;
|
||||
use crate::test_helpers::assert_serialization;
|
||||
|
||||
mod explicit_checks {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn default() {
|
||||
assert_eq!(InferenceJobType::default(), InferenceJobType::Unknown);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(InferenceJobType::ComfyUi, "comfy_ui");
|
||||
assert_serialization(InferenceJobType::ConvertFbxToGltf, "convert_fbx_gltf");
|
||||
assert_serialization(InferenceJobType::MocapNet, "mocap_net");
|
||||
assert_serialization(InferenceJobType::RerenderAVideo, "rerender_a_video");
|
||||
assert_serialization(InferenceJobType::RvcV2, "rvc_v2");
|
||||
assert_serialization(InferenceJobType::SadTalker, "sad_talker");
|
||||
assert_serialization(InferenceJobType::SoVitsSvc, "so_vits_svc");
|
||||
assert_serialization(InferenceJobType::StableDiffusion, "stable_diffusion");
|
||||
assert_serialization(InferenceJobType::StyleTTS2, "styletts2");
|
||||
assert_serialization(InferenceJobType::Tacotron2, "tacotron2");
|
||||
assert_serialization(InferenceJobType::Unknown, "unknown");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_str() {
|
||||
assert_eq!(InferenceJobType::ComfyUi.to_str(), "comfy_ui");
|
||||
assert_eq!(InferenceJobType::ConvertFbxToGltf.to_str(), "convert_fbx_gltf");
|
||||
assert_eq!(InferenceJobType::MocapNet.to_str(), "mocap_net");
|
||||
assert_eq!(InferenceJobType::RerenderAVideo.to_str(), "rerender_a_video");
|
||||
assert_eq!(InferenceJobType::RvcV2.to_str(), "rvc_v2");
|
||||
assert_eq!(InferenceJobType::SadTalker.to_str(), "sad_talker");
|
||||
assert_eq!(InferenceJobType::SoVitsSvc.to_str(), "so_vits_svc");
|
||||
assert_eq!(InferenceJobType::StableDiffusion.to_str(), "stable_diffusion");
|
||||
assert_eq!(InferenceJobType::StyleTTS2.to_str(), "styletts2");
|
||||
assert_eq!(InferenceJobType::Tacotron2.to_str(), "tacotron2");
|
||||
assert_eq!(InferenceJobType::Unknown.to_str(), "unknown");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_str() {
|
||||
assert_eq!(InferenceJobType::from_str("comfy_ui").unwrap(), InferenceJobType::ComfyUi);
|
||||
assert_eq!(InferenceJobType::from_str("convert_fbx_gltf").unwrap(), InferenceJobType::ConvertFbxToGltf);
|
||||
assert_eq!(InferenceJobType::from_str("mocap_net").unwrap(), InferenceJobType::MocapNet);
|
||||
assert_eq!(InferenceJobType::from_str("rerender_a_video").unwrap(), InferenceJobType::RerenderAVideo);
|
||||
assert_eq!(InferenceJobType::from_str("rvc_v2").unwrap(), InferenceJobType::RvcV2);
|
||||
assert_eq!(InferenceJobType::from_str("sad_talker").unwrap(), InferenceJobType::SadTalker);
|
||||
assert_eq!(InferenceJobType::from_str("so_vits_svc").unwrap(), InferenceJobType::SoVitsSvc);
|
||||
assert_eq!(InferenceJobType::from_str("stable_diffusion").unwrap(), InferenceJobType::StableDiffusion);
|
||||
assert_eq!(InferenceJobType::from_str("styletts2").unwrap(), InferenceJobType::StyleTTS2);
|
||||
assert_eq!(InferenceJobType::from_str("tacotron2").unwrap(), InferenceJobType::Tacotron2);
|
||||
assert_eq!(InferenceJobType::from_str("unknown").unwrap(), InferenceJobType::Unknown);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
// Static check
|
||||
let mut variants = InferenceJobType::all_variants();
|
||||
assert_eq!(variants.len(), 11);
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::ComfyUi));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::ConvertFbxToGltf));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::MocapNet));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::RerenderAVideo));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::RvcV2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::SadTalker));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::SoVitsSvc));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::StableDiffusion));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::StyleTTS2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::Tacotron2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceJobType::Unknown));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
|
||||
// Generated check
|
||||
use strum::IntoEnumIterator;
|
||||
assert_eq!(InferenceJobType::all_variants().len(), InferenceJobType::iter().len());
|
||||
}
|
||||
}
|
||||
|
||||
mod mechanical_checks {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn variant_length() {
|
||||
use strum::IntoEnumIterator;
|
||||
assert_eq!(InferenceJobType::all_variants().len(), InferenceJobType::iter().len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn round_trip() {
|
||||
for variant in InferenceJobType::all_variants() {
|
||||
assert_eq!(variant, InferenceJobType::from_str(variant.to_str()).unwrap());
|
||||
assert_eq!(variant, InferenceJobType::from_str(&format!("{}", variant)).unwrap());
|
||||
assert_eq!(variant, InferenceJobType::from_str(&format!("{:?}", variant)).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialized_length_ok_for_database() {
|
||||
const MAX_LENGTH : usize = 32;
|
||||
for variant in InferenceJobType::all_variants() {
|
||||
let serialized = variant.to_str();
|
||||
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
|
||||
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ use strum::EnumIter;
|
||||
///
|
||||
/// These types are present in the HTTP API and database columns as serialized here.
|
||||
///
|
||||
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
|
||||
pub enum InferenceModelType {
|
||||
@@ -37,8 +37,13 @@ pub enum InferenceModelType {
|
||||
StableDiffusion,
|
||||
#[serde(rename = "mocap_net")]
|
||||
MocapNet,
|
||||
#[serde(rename = "comfy_ui")]
|
||||
ComfyUi,
|
||||
#[serde(rename = "styletts2")]
|
||||
StyleTTS2,
|
||||
/// A job that turns "FBX" game engine files into "GLTF" files (Bevy-compatible).
|
||||
#[serde(rename = "convert_fbx_gltf")]
|
||||
ConvertFbxToGltf,
|
||||
}
|
||||
|
||||
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
|
||||
@@ -59,6 +64,8 @@ impl InferenceModelType {
|
||||
Self::StableDiffusion => "stable_diffusion",
|
||||
Self::MocapNet => "mocap_net",
|
||||
Self::StyleTTS2 => "styletts2",
|
||||
Self::ComfyUi => "comfy_ui",
|
||||
Self::ConvertFbxToGltf => "convert_fbx_gltf",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,24 +81,28 @@ impl InferenceModelType {
|
||||
"stable_diffusion" => Ok(Self::StableDiffusion),
|
||||
"mocap_net" => Ok(Self::MocapNet),
|
||||
"styletts2" => Ok(Self::StyleTTS2),
|
||||
"comfy_ui" => Ok(Self::ComfyUi),
|
||||
"convert_fbx_gltf" => Ok(Self::ConvertFbxToGltf),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn all_variants() -> BTreeSet<InferenceModelType> {
|
||||
pub fn all_variants() -> BTreeSet<Self> {
|
||||
// NB: BTreeSet is sorted
|
||||
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
|
||||
BTreeSet::from([
|
||||
InferenceModelType::RvcV2,
|
||||
InferenceModelType::SadTalker,
|
||||
InferenceModelType::SoVitsSvc,
|
||||
InferenceModelType::Tacotron2,
|
||||
InferenceModelType::Vits,
|
||||
InferenceModelType::VallEX,
|
||||
InferenceModelType::RerenderAVideo,
|
||||
InferenceModelType::StableDiffusion,
|
||||
InferenceModelType::MocapNet,
|
||||
InferenceModelType::StyleTTS2,
|
||||
Self::RvcV2,
|
||||
Self::SadTalker,
|
||||
Self::SoVitsSvc,
|
||||
Self::Tacotron2,
|
||||
Self::Vits,
|
||||
Self::VallEX,
|
||||
Self::RerenderAVideo,
|
||||
Self::StableDiffusion,
|
||||
Self::MocapNet,
|
||||
Self::StyleTTS2,
|
||||
Self::ComfyUi,
|
||||
Self::ConvertFbxToGltf,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -101,68 +112,108 @@ mod tests {
|
||||
use crate::by_table::generic_inference_jobs::inference_model_type::InferenceModelType;
|
||||
use crate::test_helpers::assert_serialization;
|
||||
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(InferenceModelType::RvcV2, "rvc_v2");
|
||||
assert_serialization(InferenceModelType::SadTalker, "sad_talker");
|
||||
assert_serialization(InferenceModelType::SoVitsSvc, "so_vits_svc");
|
||||
assert_serialization(InferenceModelType::Tacotron2, "tacotron2");
|
||||
assert_serialization(InferenceModelType::Vits, "vits");
|
||||
assert_serialization(InferenceModelType::VallEX, "vall_e_x");
|
||||
assert_serialization(InferenceModelType::RerenderAVideo, "rerender_a_video");
|
||||
assert_serialization(InferenceModelType::StableDiffusion, "stable_diffusion");
|
||||
assert_serialization(InferenceModelType::MocapNet, "mocap_net");
|
||||
assert_serialization(InferenceModelType::StyleTTS2, "styletts2");
|
||||
mod explicit_checks {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(InferenceModelType::RvcV2, "rvc_v2");
|
||||
assert_serialization(InferenceModelType::SadTalker, "sad_talker");
|
||||
assert_serialization(InferenceModelType::SoVitsSvc, "so_vits_svc");
|
||||
assert_serialization(InferenceModelType::Tacotron2, "tacotron2");
|
||||
assert_serialization(InferenceModelType::Vits, "vits");
|
||||
assert_serialization(InferenceModelType::VallEX, "vall_e_x");
|
||||
assert_serialization(InferenceModelType::RerenderAVideo, "rerender_a_video");
|
||||
assert_serialization(InferenceModelType::StableDiffusion, "stable_diffusion");
|
||||
assert_serialization(InferenceModelType::MocapNet, "mocap_net");
|
||||
assert_serialization(InferenceModelType::ComfyUi, "comfy_ui");
|
||||
assert_serialization(InferenceModelType::StyleTTS2, "styletts2");
|
||||
assert_serialization(InferenceModelType::ConvertFbxToGltf, "convert_fbx_gltf");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_str() {
|
||||
assert_eq!(InferenceModelType::RvcV2.to_str(), "rvc_v2");
|
||||
assert_eq!(InferenceModelType::SadTalker.to_str(), "sad_talker");
|
||||
assert_eq!(InferenceModelType::SoVitsSvc.to_str(), "so_vits_svc");
|
||||
assert_eq!(InferenceModelType::Tacotron2.to_str(), "tacotron2");
|
||||
assert_eq!(InferenceModelType::Vits.to_str(), "vits");
|
||||
assert_eq!(InferenceModelType::VallEX.to_str(), "vall_e_x");
|
||||
assert_eq!(InferenceModelType::RerenderAVideo.to_str(), "rerender_a_video");
|
||||
assert_eq!(InferenceModelType::StableDiffusion.to_str(), "stable_diffusion");
|
||||
assert_eq!(InferenceModelType::MocapNet.to_str(), "mocap_net");
|
||||
assert_eq!(InferenceModelType::StyleTTS2.to_str(), "styletts2");
|
||||
assert_eq!(InferenceModelType::ComfyUi.to_str(), "comfy_ui");
|
||||
assert_eq!(InferenceModelType::ConvertFbxToGltf.to_str(), "convert_fbx_gltf");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_str() {
|
||||
assert_eq!(InferenceModelType::from_str("rvc_v2").unwrap(), InferenceModelType::RvcV2);
|
||||
assert_eq!(InferenceModelType::from_str("sad_talker").unwrap(), InferenceModelType::SadTalker);
|
||||
assert_eq!(InferenceModelType::from_str("so_vits_svc").unwrap(), InferenceModelType::SoVitsSvc);
|
||||
assert_eq!(InferenceModelType::from_str("tacotron2").unwrap(), InferenceModelType::Tacotron2);
|
||||
assert_eq!(InferenceModelType::from_str("vits").unwrap(), InferenceModelType::Vits);
|
||||
assert_eq!(InferenceModelType::from_str("vall_e_x").unwrap(), InferenceModelType::VallEX);
|
||||
assert_eq!(InferenceModelType::from_str("rerender_a_video").unwrap(), InferenceModelType::RerenderAVideo);
|
||||
assert_eq!(InferenceModelType::from_str("stable_diffusion").unwrap(), InferenceModelType::StableDiffusion);
|
||||
assert_eq!(InferenceModelType::from_str("mocap_net").unwrap(), InferenceModelType::MocapNet);
|
||||
assert_eq!(InferenceModelType::from_str("styletts2").unwrap(), InferenceModelType::StyleTTS2);
|
||||
assert_eq!(InferenceModelType::from_str("comfy_ui").unwrap(), InferenceModelType::ComfyUi);
|
||||
assert_eq!(InferenceModelType::from_str("convert_fbx_gltf").unwrap(), InferenceModelType::ConvertFbxToGltf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
// Static check
|
||||
let mut variants = InferenceModelType::all_variants();
|
||||
assert_eq!(variants.len(), 12);
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::RvcV2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::SadTalker));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::SoVitsSvc));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::Tacotron2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::Vits));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::VallEX));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::RerenderAVideo));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::StableDiffusion));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::MocapNet));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::ComfyUi));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::StyleTTS2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::ConvertFbxToGltf));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
|
||||
// Generated check
|
||||
use strum::IntoEnumIterator;
|
||||
assert_eq!(InferenceModelType::all_variants().len(), InferenceModelType::iter().len());
|
||||
}
|
||||
}
|
||||
|
||||
mod mechanical_checks {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn to_str() {
|
||||
assert_eq!(InferenceModelType::RvcV2.to_str(), "rvc_v2");
|
||||
assert_eq!(InferenceModelType::SadTalker.to_str(), "sad_talker");
|
||||
assert_eq!(InferenceModelType::SoVitsSvc.to_str(), "so_vits_svc");
|
||||
assert_eq!(InferenceModelType::Tacotron2.to_str(), "tacotron2");
|
||||
assert_eq!(InferenceModelType::Vits.to_str(), "vits");
|
||||
assert_eq!(InferenceModelType::VallEX.to_str(), "vall_e_x");
|
||||
assert_eq!(InferenceModelType::RerenderAVideo.to_str(), "rerender_a_video");
|
||||
assert_eq!(InferenceModelType::StableDiffusion.to_str(), "stable_diffusion");
|
||||
assert_eq!(InferenceModelType::MocapNet.to_str(), "mocap_net");
|
||||
assert_eq!(InferenceModelType::StyleTTS2.to_str(), "styletts2");
|
||||
}
|
||||
#[test]
|
||||
fn variant_length() {
|
||||
use strum::IntoEnumIterator;
|
||||
assert_eq!(InferenceModelType::all_variants().len(), InferenceModelType::iter().len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_str() {
|
||||
assert_eq!(InferenceModelType::from_str("rvc_v2").unwrap(), InferenceModelType::RvcV2);
|
||||
assert_eq!(InferenceModelType::from_str("sad_talker").unwrap(), InferenceModelType::SadTalker);
|
||||
assert_eq!(InferenceModelType::from_str("so_vits_svc").unwrap(), InferenceModelType::SoVitsSvc);
|
||||
assert_eq!(InferenceModelType::from_str("tacotron2").unwrap(), InferenceModelType::Tacotron2);
|
||||
assert_eq!(InferenceModelType::from_str("vits").unwrap(), InferenceModelType::Vits);
|
||||
assert_eq!(InferenceModelType::from_str("vall_e_x").unwrap(), InferenceModelType::VallEX);
|
||||
assert_eq!(InferenceModelType::from_str("rerender_a_video").unwrap(), InferenceModelType::RerenderAVideo);
|
||||
assert_eq!(InferenceModelType::from_str("stable_diffusion").unwrap(), InferenceModelType::StableDiffusion);
|
||||
assert_eq!(InferenceModelType::from_str("mocap_net").unwrap(), InferenceModelType::MocapNet);
|
||||
assert_eq!(InferenceModelType::from_str("styletts2").unwrap(), InferenceModelType::StyleTTS2);
|
||||
}
|
||||
#[test]
|
||||
fn round_trip() {
|
||||
for variant in InferenceModelType::all_variants() {
|
||||
assert_eq!(variant, InferenceModelType::from_str(variant.to_str()).unwrap());
|
||||
assert_eq!(variant, InferenceModelType::from_str(&format!("{}", variant)).unwrap());
|
||||
assert_eq!(variant, InferenceModelType::from_str(&format!("{:?}", variant)).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
// Static check
|
||||
let mut variants = InferenceModelType::all_variants();
|
||||
assert_eq!(variants.len(), 8);
|
||||
assert_eq!(variants.len(), 9);
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::RvcV2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::SadTalker));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::SoVitsSvc));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::Tacotron2));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::Vits));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::VallEX));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::RerenderAVideo));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::StableDiffusion));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::MocapNet));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceModelType::StyleTTS2));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
|
||||
// Generated check
|
||||
use strum::IntoEnumIterator;
|
||||
assert_eq!(InferenceModelType::all_variants().len(), InferenceModelType::iter().len());
|
||||
#[test]
|
||||
fn serialized_length_ok_for_database() {
|
||||
const MAX_LENGTH : usize = 32;
|
||||
for variant in InferenceModelType::all_variants() {
|
||||
let serialized = variant.to_str();
|
||||
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
|
||||
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use strum::EnumIter;
|
||||
///
|
||||
/// These types are present in the HTTP API and database columns as serialized here.
|
||||
///
|
||||
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
/// YOU CAN ADD NEW VALUES, BUT DO NOT CHANGE EXISTING VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
|
||||
pub enum InferenceResultType {
|
||||
@@ -110,7 +110,7 @@ mod tests {
|
||||
fn all_variants() {
|
||||
// Static check
|
||||
let mut variants = InferenceResultType::all_variants();
|
||||
assert_eq!(variants.len(), 4);
|
||||
assert_eq!(variants.len(), 5);
|
||||
assert_eq!(variants.pop_first(), Some(InferenceResultType::MediaFile));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceResultType::TextToSpeech));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceResultType::VoiceConversion));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
pub mod frontend_failure_category;
|
||||
pub mod inference_category;
|
||||
pub mod inference_input_source_token_type;
|
||||
pub mod inference_job_type;
|
||||
pub mod inference_model_type;
|
||||
pub mod inference_result_type;
|
||||
|
||||
@@ -29,6 +29,10 @@ pub enum IdCategory {
|
||||
#[serde(rename = "mocap")]
|
||||
MocapResult,
|
||||
|
||||
// Results from workflows
|
||||
#[serde(rename = "workflow")]
|
||||
WorkflowResult,
|
||||
|
||||
/// Results from tacotron2
|
||||
/// Applies for RVC and SVC
|
||||
#[serde(rename = "tts_result")]
|
||||
@@ -78,6 +82,7 @@ impl IdCategory {
|
||||
Self::ModelWeights => "model_weights",
|
||||
Self::FileUpload => "file_upload",
|
||||
Self::MocapResult => "mocap",
|
||||
Self::WorkflowResult => "workflow",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +99,7 @@ impl IdCategory {
|
||||
"model_weights" => Ok(Self::ModelWeights),
|
||||
"file_upload" => Ok(Self::FileUpload),
|
||||
"mocap" => Ok(Self::MocapResult),
|
||||
"workflow" => Ok(Self::WorkflowResult),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -113,6 +119,7 @@ impl IdCategory {
|
||||
Self::ModelWeights,
|
||||
Self::FileUpload,
|
||||
Self::MocapResult,
|
||||
Self::WorkflowResult,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -138,6 +145,7 @@ mod tests {
|
||||
assert_serialization(IdCategory::ModelWeights, "model_weights");
|
||||
assert_serialization(IdCategory::FileUpload, "file_upload");
|
||||
assert_serialization(IdCategory::MocapResult, "mocap");
|
||||
assert_serialization(IdCategory::WorkflowResult, "workflow");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -153,6 +161,7 @@ mod tests {
|
||||
assert_eq!(IdCategory::ModelWeights.to_str(), "model_weights");
|
||||
assert_eq!(IdCategory::FileUpload.to_str(), "file_upload");
|
||||
assert_eq!(IdCategory::MocapResult.to_str(), "mocap");
|
||||
assert_eq!(IdCategory::WorkflowResult.to_str(), "workflow");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -168,17 +177,19 @@ mod tests {
|
||||
assert_eq!(IdCategory::from_str("model_weights").unwrap(), IdCategory::ModelWeights);
|
||||
assert_eq!(IdCategory::from_str("file_upload").unwrap(), IdCategory::FileUpload);
|
||||
assert_eq!(IdCategory::from_str("mocap").unwrap(), IdCategory::MocapResult);
|
||||
assert_eq!(IdCategory::from_str("workflow").unwrap(), IdCategory::WorkflowResult);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
// Static check
|
||||
let mut variants = IdCategory::all_variants();
|
||||
assert_eq!(variants.len(), 11);
|
||||
assert_eq!(variants.len(), 12);
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::MediaFile));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::LipsyncAnimationResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::VideoFilterResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::MocapResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::WorkflowResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::TtsResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::VoiceConversionResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::ZeroShotTtsResult));
|
||||
|
||||
@@ -39,8 +39,14 @@ pub enum MediaFileOriginModelType {
|
||||
#[serde(rename = "mocap_net")]
|
||||
MocapNet,
|
||||
|
||||
#[serde(rename = "comfy_ui")]
|
||||
ComfyUi,
|
||||
|
||||
#[serde(rename = "styletts2")]
|
||||
StyleTTS2,
|
||||
|
||||
#[serde(rename = "stable_diffusion_1_5")]
|
||||
StableDiffusion15,
|
||||
}
|
||||
|
||||
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
|
||||
@@ -59,7 +65,9 @@ impl MediaFileOriginModelType {
|
||||
Self::VallEX => "vall_e_x",
|
||||
Self::Rerender => "rerender",
|
||||
Self::MocapNet => "mocap_net",
|
||||
Self::ComfyUi => "comfy_ui",
|
||||
Self::StyleTTS2 => "styletts2",
|
||||
Self::StableDiffusion15 => "stable_diffusion_1_5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +80,9 @@ impl MediaFileOriginModelType {
|
||||
"vall_e_x" => Ok(Self::VallEX),
|
||||
"rerender" => Ok(Self::Rerender),
|
||||
"mocap_net" => Ok(Self::MocapNet),
|
||||
"comfy_ui" => Ok(Self::ComfyUi),
|
||||
"styletts2" => Ok(Self::StyleTTS2),
|
||||
"stable_diffusion_1_5" => Ok(Self::StableDiffusion15),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -88,7 +98,9 @@ impl MediaFileOriginModelType {
|
||||
Self::VallEX,
|
||||
Self::Rerender,
|
||||
Self::MocapNet,
|
||||
Self::ComfyUi,
|
||||
Self::StyleTTS2,
|
||||
Self::StableDiffusion15
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -115,7 +127,9 @@ mod tests {
|
||||
assert_eq!(MediaFileOriginModelType::VallEX.to_str(), "vall_e_x");
|
||||
assert_eq!(MediaFileOriginModelType::Rerender.to_str(), "rerender");
|
||||
assert_eq!(MediaFileOriginModelType::MocapNet.to_str(), "mocap_net");
|
||||
assert_eq!(MediaFileOriginModelType::ComfyUi.to_str(), "comfy_ui");
|
||||
assert_eq!(MediaFileOriginModelType::StyleTTS2.to_str(), "styletts2");
|
||||
assert_eq!(MediaFileOriginModelType::StableDiffusion15.to_str(), "stable_diffusion_1_5");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -127,14 +141,16 @@ mod tests {
|
||||
assert_eq!(MediaFileOriginModelType::from_str("vall_e_x").unwrap(), MediaFileOriginModelType::VallEX);
|
||||
assert_eq!(MediaFileOriginModelType::from_str("rerender").unwrap(), MediaFileOriginModelType::Rerender);
|
||||
assert_eq!(MediaFileOriginModelType::from_str("mocap_net").unwrap(), MediaFileOriginModelType::MocapNet);
|
||||
assert_eq!(MediaFileOriginModelType::from_str("comfy_ui").unwrap(), MediaFileOriginModelType::ComfyUi);
|
||||
assert_eq!(MediaFileOriginModelType::from_str("styletts2").unwrap(), MediaFileOriginModelType::StyleTTS2);
|
||||
assert_eq!(MediaFileOriginModelType::from_str("stable_diffusion_1_5").unwrap(), MediaFileOriginModelType::StableDiffusion15);
|
||||
assert!(MediaFileOriginModelType::from_str("foo").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
let mut variants = MediaFileOriginModelType::all_variants();
|
||||
assert_eq!(variants.len(), 8);
|
||||
assert_eq!(variants.len(), 10);
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::RvcV2));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::SadTalker));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::SoVitsSvc));
|
||||
@@ -142,7 +158,9 @@ mod tests {
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::VallEX));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::Rerender));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::MocapNet));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::ComfyUi));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::StyleTTS2));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::StableDiffusion15));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,12 @@ pub enum MediaFileOriginProductCategory {
|
||||
// Mocap
|
||||
#[serde(rename = "mocap")]
|
||||
Mocap,
|
||||
|
||||
#[serde(rename = "image_gen")]
|
||||
ImageGeneration,
|
||||
// Workflow
|
||||
#[serde(rename = "workflow")]
|
||||
Workflow,
|
||||
}
|
||||
|
||||
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
|
||||
@@ -64,6 +70,8 @@ impl MediaFileOriginProductCategory {
|
||||
Self::ZeroShotVoice => "zs_voice",
|
||||
Self::VideoFilter => "video_filter",
|
||||
Self::Mocap => "mocap",
|
||||
Self::ImageGeneration => "image_gen",
|
||||
Self::Workflow => "workflow",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +84,8 @@ impl MediaFileOriginProductCategory {
|
||||
"zs_voice" => Ok(Self::ZeroShotVoice),
|
||||
"video_filter" => Ok(Self::VideoFilter),
|
||||
"mocap" => Ok(Self::Mocap),
|
||||
"image_gen" => Ok(Self::ImageGeneration),
|
||||
"workflow" => Ok(Self::Workflow),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -91,6 +101,8 @@ impl MediaFileOriginProductCategory {
|
||||
Self::VoiceConversion,
|
||||
Self::ZeroShotVoice,
|
||||
Self::Mocap,
|
||||
Self::ImageGeneration,
|
||||
Self::Workflow,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -111,7 +123,9 @@ mod tests {
|
||||
assert_serialization(MediaFileOriginProductCategory::VoiceConversion, "voice_conversion");
|
||||
assert_serialization(MediaFileOriginProductCategory::ZeroShotVoice, "zs_voice");
|
||||
assert_serialization(MediaFileOriginProductCategory::VideoFilter, "video_filter");
|
||||
assert_serialization(MediaFileOriginProductCategory::Mocap, "mocap")
|
||||
assert_serialization(MediaFileOriginProductCategory::Mocap, "mocap");
|
||||
assert_serialization(MediaFileOriginProductCategory::ImageGeneration, "image_gen");
|
||||
assert_serialization(MediaFileOriginProductCategory::Workflow, "workflow");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -123,6 +137,8 @@ mod tests {
|
||||
assert_eq!(MediaFileOriginProductCategory::ZeroShotVoice.to_str(), "zs_voice");
|
||||
assert_eq!(MediaFileOriginProductCategory::VideoFilter.to_str(), "video_filter");
|
||||
assert_eq!(MediaFileOriginProductCategory::Mocap.to_str(), "mocap");
|
||||
assert_eq!(MediaFileOriginProductCategory::ImageGeneration.to_str(), "image_gen");
|
||||
assert_eq!(MediaFileOriginProductCategory::Workflow.to_str(), "workflow");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -134,12 +150,14 @@ mod tests {
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("zs_voice").unwrap(), MediaFileOriginProductCategory::ZeroShotVoice);
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("video_filter").unwrap(), MediaFileOriginProductCategory::VideoFilter);
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("mocap").unwrap(), MediaFileOriginProductCategory::Mocap);
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("image_gen").unwrap(),MediaFileOriginProductCategory::ImageGeneration);
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("workflow").unwrap(), MediaFileOriginProductCategory::Workflow);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
let mut variants = MediaFileOriginProductCategory::all_variants();
|
||||
assert_eq!(variants.len(), 7);
|
||||
assert_eq!(variants.len(), 9);
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::Unknown));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::FaceAnimator));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::TextToSpeech));
|
||||
@@ -147,6 +165,8 @@ mod tests {
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::ZeroShotVoice));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::VideoFilter));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::Mocap));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::ImageGeneration));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::Workflow));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use strum::EnumCount;
|
||||
use strum::EnumIter;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
/// Used in the `media_files` table in a `VARCHAR` field.
|
||||
/// Used in the `media_files` table in a `VARCHAR(16)` field.
|
||||
///
|
||||
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
@@ -23,7 +23,22 @@ pub enum MediaFileType {
|
||||
Video,
|
||||
|
||||
/// Mocap files: BVH, etc.
|
||||
/// NB: In actuality, this is just the BVH file type.
|
||||
/// NB: This is the old type to migrate from.
|
||||
Mocap,
|
||||
|
||||
/// BVH files (for Bevy)
|
||||
/// NB: This is the new type to migrate to.
|
||||
Bvh,
|
||||
|
||||
/// FBX files (for Bevy)
|
||||
Fbx,
|
||||
|
||||
/// glTF binary files (for Bevy)
|
||||
Glb,
|
||||
|
||||
/// glTF files (for Bevy)
|
||||
Gltf,
|
||||
}
|
||||
|
||||
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
|
||||
@@ -39,6 +54,10 @@ impl MediaFileType {
|
||||
Self::Image => "image",
|
||||
Self::Video => "video",
|
||||
Self::Mocap => "mocap",
|
||||
Self::Bvh => "bvh",
|
||||
Self::Fbx => "fbx",
|
||||
Self::Glb => "glb",
|
||||
Self::Gltf => "gltf",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +67,10 @@ impl MediaFileType {
|
||||
"image" => Ok(Self::Image),
|
||||
"video" => Ok(Self::Video),
|
||||
"mocap" => Ok(Self::Mocap),
|
||||
"bvh" => Ok(Self::Bvh),
|
||||
"fbx" => Ok(Self::Fbx),
|
||||
"glb" => Ok(Self::Glb),
|
||||
"gltf" => Ok(Self::Gltf),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -60,6 +83,10 @@ impl MediaFileType {
|
||||
Self::Image,
|
||||
Self::Video,
|
||||
Self::Mocap,
|
||||
Self::Bvh,
|
||||
Self::Fbx,
|
||||
Self::Glb,
|
||||
Self::Gltf,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -78,6 +105,10 @@ mod tests {
|
||||
assert_serialization(MediaFileType::Image, "image");
|
||||
assert_serialization(MediaFileType::Video, "video");
|
||||
assert_serialization(MediaFileType::Mocap, "mocap");
|
||||
assert_serialization(MediaFileType::Bvh, "bvh");
|
||||
assert_serialization(MediaFileType::Fbx, "fbx");
|
||||
assert_serialization(MediaFileType::Glb, "glb");
|
||||
assert_serialization(MediaFileType::Gltf, "gltf");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +120,10 @@ mod tests {
|
||||
assert_eq!(MediaFileType::Audio.to_str(), "audio");
|
||||
assert_eq!(MediaFileType::Image.to_str(), "image");
|
||||
assert_eq!(MediaFileType::Video.to_str(), "video");
|
||||
assert_eq!(MediaFileType::Mocap.to_str(), "mocap");
|
||||
assert_eq!(MediaFileType::Bvh.to_str(), "bvh");
|
||||
assert_eq!(MediaFileType::Fbx.to_str(), "fbx");
|
||||
assert_eq!(MediaFileType::Glb.to_str(), "glb");
|
||||
assert_eq!(MediaFileType::Gltf.to_str(), "gltf");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -98,6 +132,10 @@ mod tests {
|
||||
assert_eq!(MediaFileType::from_str("image").unwrap(), MediaFileType::Image);
|
||||
assert_eq!(MediaFileType::from_str("video").unwrap(), MediaFileType::Video);
|
||||
assert_eq!(MediaFileType::from_str("mocap").unwrap(), MediaFileType::Mocap);
|
||||
assert_eq!(MediaFileType::from_str("bvh").unwrap(), MediaFileType::Bvh);
|
||||
assert_eq!(MediaFileType::from_str("fbx").unwrap(), MediaFileType::Fbx);
|
||||
assert_eq!(MediaFileType::from_str("glb").unwrap(), MediaFileType::Glb);
|
||||
assert_eq!(MediaFileType::from_str("gltf").unwrap(), MediaFileType::Gltf);
|
||||
assert!(MediaFileType::from_str("foo").is_err());
|
||||
}
|
||||
}
|
||||
@@ -108,11 +146,15 @@ mod tests {
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
let mut variants = MediaFileType::all_variants();
|
||||
assert_eq!(variants.len(), 4);
|
||||
assert_eq!(variants.len(), 8);
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileType::Audio));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileType::Image));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileType::Video));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileType::Mocap));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileType::Bvh));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileType::Fbx));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileType::Glb));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileType::Gltf));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
}
|
||||
}
|
||||
@@ -134,5 +176,15 @@ mod tests {
|
||||
assert_eq!(variant, MediaFileType::from_str(&format!("{:?}", variant)).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialized_length_ok_for_database() {
|
||||
const MAX_LENGTH : usize = 16;
|
||||
for variant in MediaFileType::all_variants() {
|
||||
let serialized = variant.to_str();
|
||||
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
|
||||
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ pub enum WeightsCategory {
|
||||
Vocoder,
|
||||
#[serde(rename = "voice_conversion")]
|
||||
VoiceConversion,
|
||||
#[serde(rename = "workflow_config")]
|
||||
WorkflowConfig,
|
||||
}
|
||||
|
||||
impl WeightsCategory {
|
||||
@@ -26,6 +28,7 @@ impl WeightsCategory {
|
||||
Self::TextToSpeech => "text_to_speech",
|
||||
Self::Vocoder => "vocoder",
|
||||
Self::VoiceConversion => "voice_conversion",
|
||||
Self::WorkflowConfig => "workflow_config",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +38,7 @@ impl WeightsCategory {
|
||||
"text_to_speech" => Ok(Self::TextToSpeech),
|
||||
"vocoder" => Ok(Self::Vocoder),
|
||||
"voice_conversion" => Ok(Self::VoiceConversion),
|
||||
"workflow_config" => Ok(Self::WorkflowConfig),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -45,6 +49,7 @@ impl WeightsCategory {
|
||||
Self::TextToSpeech,
|
||||
Self::Vocoder,
|
||||
Self::VoiceConversion,
|
||||
Self::WorkflowConfig,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -62,6 +67,7 @@ mod tests {
|
||||
assert_eq!(WeightsCategory::TextToSpeech.to_str(), "text_to_speech");
|
||||
assert_eq!(WeightsCategory::Vocoder.to_str(), "vocoder");
|
||||
assert_eq!(WeightsCategory::VoiceConversion.to_str(), "voice_conversion");
|
||||
assert_eq!(WeightsCategory::WorkflowConfig.to_str(), "workflow_config");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -70,16 +76,18 @@ mod tests {
|
||||
assert_eq!(WeightsCategory::from_str("text_to_speech").unwrap(), WeightsCategory::TextToSpeech);
|
||||
assert_eq!(WeightsCategory::from_str("vocoder").unwrap(), WeightsCategory::Vocoder);
|
||||
assert_eq!(WeightsCategory::from_str("voice_conversion").unwrap(), WeightsCategory::VoiceConversion);
|
||||
assert_eq!(WeightsCategory::from_str("workflow_config").unwrap(), WeightsCategory::WorkflowConfig);
|
||||
assert!(WeightsCategory::from_str("invalid").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_all_variants() {
|
||||
let variants = WeightsCategory::all_variants();
|
||||
assert_eq!(variants.len(), 4);
|
||||
assert_eq!(variants.len(), 5);
|
||||
assert!(variants.contains(&WeightsCategory::ImageGeneration));
|
||||
assert!(variants.contains(&WeightsCategory::TextToSpeech));
|
||||
assert!(variants.contains(&WeightsCategory::Vocoder));
|
||||
assert!(variants.contains(&WeightsCategory::VoiceConversion));
|
||||
assert!(variants.contains(&WeightsCategory::WorkflowConfig));
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@ pub enum WeightsType {
|
||||
LoRA,
|
||||
#[serde(rename = "vall_e")]
|
||||
VallE,
|
||||
#[serde(rename = "comfy_ui")]
|
||||
ComfyUi,
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +41,7 @@ impl WeightsType {
|
||||
Self::Tacotron2 => "tt2",
|
||||
Self::LoRA => "loRA",
|
||||
Self::VallE => "vall_e",
|
||||
Self::ComfyUi => "comfy_ui",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +55,7 @@ impl WeightsType {
|
||||
"tt2" => Ok(Self::Tacotron2),
|
||||
"loRA" => Ok(Self::LoRA),
|
||||
"vall_e" => Ok(Self::VallE),
|
||||
"comfy_ui" => Ok(Self::ComfyUi),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -65,7 +69,8 @@ impl WeightsType {
|
||||
Self::SoVitsSvc,
|
||||
Self::Tacotron2,
|
||||
Self::LoRA,
|
||||
Self::VallE
|
||||
Self::VallE,
|
||||
Self::ComfyUi,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -88,6 +93,7 @@ mod tests {
|
||||
assert_eq!(WeightsType::Tacotron2.to_str(), "tt2");
|
||||
assert_eq!(WeightsType::LoRA.to_str(), "loRA");
|
||||
assert_eq!(WeightsType::VallE.to_str(), "vall_e");
|
||||
assert_eq!(WeightsType::ComfyUi.to_str(), "comfy_ui");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -100,13 +106,14 @@ mod tests {
|
||||
assert_eq!(WeightsType::from_str("tt2").unwrap(), WeightsType::Tacotron2);
|
||||
assert_eq!(WeightsType::from_str("loRA").unwrap(), WeightsType::LoRA);
|
||||
assert_eq!(WeightsType::from_str("vall_e").unwrap(), WeightsType::VallE);
|
||||
assert_eq!(WeightsType::from_str("comfy_ui").unwrap(), WeightsType::ComfyUi);
|
||||
assert!(WeightsType::from_str("invalid").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_all_variants() {
|
||||
let variants = WeightsType::all_variants();
|
||||
assert_eq!(variants.len(), 8);
|
||||
assert_eq!(variants.len(), 9);
|
||||
assert!(variants.contains(&WeightsType::HifiganTacotron2));
|
||||
assert!(variants.contains(&WeightsType::RvcV2));
|
||||
assert!(variants.contains(&WeightsType::StableDiffusion15));
|
||||
@@ -115,5 +122,6 @@ mod tests {
|
||||
assert!(variants.contains(&WeightsType::Tacotron2));
|
||||
assert!(variants.contains(&WeightsType::LoRA));
|
||||
assert!(variants.contains(&WeightsType::VallE));
|
||||
assert!(variants.contains(&WeightsType::ComfyUi));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,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; // V1
|
||||
use crate::seeding::seed_media_files::seed_media_files;
|
||||
use crate::seeding::seed_model_weights::seed_weights_files; // V2 v3 will come later on when everything is more conslidated and clear.
|
||||
use crate::seeding::model_weights::test_seed_weights_files;
|
||||
use crate::seeding::tts_tacotron2::seed_tts_tacotron2;
|
||||
use crate::seeding::users::seed_user_accounts;
|
||||
use crate::seeding::voice_conversion::seed_voice_conversion;
|
||||
use crate::seeding::model_weights::seed_weights;
|
||||
|
||||
pub mod bucket_clients;
|
||||
|
||||
@@ -53,12 +47,13 @@ pub async fn main() -> AnyhowResult<()> {
|
||||
// maybe_elasticsearch = Some(get_elasticsearch_client());
|
||||
// }
|
||||
|
||||
seed_user_accounts(&pool).await?;
|
||||
seed_media_files(&pool, maybe_bucket_clients.as_ref()).await?;
|
||||
// seed_user_accounts(&pool).await?;
|
||||
// seed_media_files(&pool, maybe_bucket_clients.as_ref()).await?;
|
||||
//seed_zero_shot_tts(&pool, maybe_bucket_clients.as_ref()).await?;
|
||||
seed_voice_conversion(&pool).await?;
|
||||
// seed_voice_conversion(&pool).await?;
|
||||
seed_weights(&pool).await?;
|
||||
seed_tts_tacotron2(&pool, maybe_bucket_clients.as_ref()).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
|
||||
//seed_weights_files(&pool, maybe_bucket_clients.as_ref()).await?;
|
||||
|
||||
@@ -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 media...");
|
||||
|
||||
let user_token = match get_user_token_by_username(HANASHI_USERNAME, mysql_pool).await? {
|
||||
None => {
|
||||
return Err(anyhow!("could not find user hanashi"));
|
||||
}
|
||||
Some(token) => token,
|
||||
};
|
||||
seed_test_videos(mysql_pool, user_token.clone()).await?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -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;
|
||||
@@ -3,13 +3,10 @@ use std::vec;
|
||||
|
||||
use log::info;
|
||||
use sqlx::{MySql, Pool};
|
||||
use cloud_storage::remote_file_manager::remote_cloud_file_manager::RemoteCloudFileClient;
|
||||
|
||||
use cloud_storage::remote_file_manager::remote_cloud_bucket_details::RemoteCloudBucketDetails;
|
||||
|
||||
use cloud_storage::remote_file_manager::weights_descriptor;
|
||||
use cloud_storage::remote_file_manager::weights_descriptor::{WeightsLoRADescriptor, WeightsSD15Descriptor};
|
||||
use easyenv::from_filename;
|
||||
|
||||
use cloud_storage::remote_file_manager::remote_cloud_file_manager::RemoteCloudFileClient;
|
||||
use cloud_storage::remote_file_manager::weights_descriptor::{WeightsLoRADescriptor, WeightsSD15Descriptor, WeightsSD15CkptDescriptor, WeightsWorkflowDescriptor};
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
@@ -17,7 +14,6 @@ use enums::by_table::model_weights::{
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::{anyhow, AnyhowResult};
|
||||
use mysql_queries::queries::model_weights::create::create_weight::{create_weight, CreateModelWeightsArgs};
|
||||
use mysql_queries::queries::users::user::create_account::create_account;
|
||||
use mysql_queries::queries::users::user::get_user_token_by_username::get_user_token_by_username;
|
||||
use storyteller_root::get_seed_tool_data_root;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
@@ -150,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 => {
|
||||
@@ -367,7 +363,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
//cached_user_ratings_positive_count,
|
||||
//cached_user_ratings_negative_count,
|
||||
//maybe_cached_user_ratings_ratio: Some(cached_user_ratings_ratio as f32),
|
||||
version,
|
||||
version: version as u32,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
};
|
||||
|
||||
@@ -600,6 +596,7 @@ Noosphere by skumerz + dalcefoPainting + 饭特稀V08 by zhazhahui345 + GhostMix
|
||||
let sd_15_weights_descriptor = Box::new(WeightsSD15Descriptor {});
|
||||
let lora_descriptor = Box::new(WeightsLoRADescriptor{});
|
||||
let sd_vae_15_weights_descriptor = Box::new(WeightsSD15Descriptor {});
|
||||
|
||||
let mut path_object_SD = get_seed_tool_data_root();
|
||||
path_object_SD.push("models/imagegen/sd15/majicmixFantasy_v30Vae.safetensors");
|
||||
|
||||
@@ -626,15 +623,11 @@ Noosphere by skumerz + dalcefoPainting + 饭特稀V08 by zhazhahui345 + GhostMix
|
||||
maybe_last_update_user_token: Some("Last Update User Token".to_string()),
|
||||
original_download_url: Some("https://civitai.com/models/41865/majicmix-fantasy".to_string()),
|
||||
original_filename: Some("majicmixFantasy_v30Vae.safetensors".to_string()),
|
||||
file_size_bytes: metadata1.file_size_bytes as i32,
|
||||
file_size_bytes: metadata1.file_size_bytes,
|
||||
file_checksum_sha2: metadata1.sha256_checksum.to_string(),
|
||||
public_bucket_hash: metadata1.bucket_details.clone().unwrap().object_hash,
|
||||
maybe_public_bucket_prefix: Some(metadata1.bucket_details.clone().unwrap().prefix),
|
||||
maybe_public_bucket_extension: Some(metadata1.bucket_details.clone().unwrap().suffix),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
};
|
||||
@@ -652,15 +645,11 @@ Noosphere by skumerz + dalcefoPainting + 饭特稀V08 by zhazhahui345 + GhostMix
|
||||
maybe_last_update_user_token: Some("<p> Honkai <p>".to_string()),
|
||||
original_download_url: Some("https://civitai.com/models/95243/mihoyo-collection-honkai-impact-3rd-or-honkai-star-rail-or-genshin-impact-or-zenless-zone-zero".to_string()),
|
||||
original_filename: Some("xiawolei-v100-000019.safetensors".to_string()),
|
||||
file_size_bytes: metadata2.file_size_bytes as i32,
|
||||
file_size_bytes: metadata2.file_size_bytes,
|
||||
file_checksum_sha2: metadata2.sha256_checksum.to_string(),
|
||||
public_bucket_hash: metadata2.bucket_details.clone().unwrap().object_hash.clone(),
|
||||
maybe_public_bucket_prefix: Some(metadata2.bucket_details.clone().unwrap().prefix),
|
||||
maybe_public_bucket_extension: Some(metadata2.bucket_details.clone().unwrap().suffix),
|
||||
cached_user_ratings_total_count: 20,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 2,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 2,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
};
|
||||
@@ -678,15 +667,11 @@ Noosphere by skumerz + dalcefoPainting + 饭特稀V08 by zhazhahui345 + GhostMix
|
||||
maybe_last_update_user_token: Some("Last Update User Token".to_string()),
|
||||
original_download_url: Some("https://civitai.com/models/97653/z-vae".to_string()),
|
||||
original_filename: Some("zVae_v20.safetensors".to_string()),
|
||||
file_size_bytes: metadata3.file_size_bytes as i32,
|
||||
file_size_bytes: metadata3.file_size_bytes,
|
||||
file_checksum_sha2: metadata3.sha256_checksum.to_string(),
|
||||
public_bucket_hash: metadata3.bucket_details.clone().unwrap().object_hash,
|
||||
maybe_public_bucket_prefix: Some(metadata3.bucket_details.clone().unwrap().prefix),
|
||||
maybe_public_bucket_extension: Some(metadata3.bucket_details.clone().unwrap().suffix),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
};
|
||||
@@ -697,6 +682,129 @@ Noosphere by skumerz + dalcefoPainting + 饭特稀V08 by zhazhahui345 + GhostMix
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn seed_workflows_for_testing_inference(mysql_pool: &Pool<MySql>, user_token: UserToken) -> AnyhowResult<()>{
|
||||
let model_weight_token1 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token2 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token3 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token4 = ModelWeightToken::new_from_str("weight_n8sz47gmfw2zx02snrbz88ns9");
|
||||
|
||||
let mut path_to_comfy = get_seed_tool_data_root();
|
||||
path_to_comfy.push("models/workflows/comfyui/yae_video_prod.json");
|
||||
let remote_cloud_file_client = RemoteCloudFileClient::get_remote_cloud_file_client().await?;
|
||||
let comfy_weights_descriptor = Box::new(WeightsWorkflowDescriptor {});
|
||||
let metadata1 = remote_cloud_file_client.upload_file(comfy_weights_descriptor, path_to_comfy.as_path().to_str().unwrap()).await?;
|
||||
|
||||
// let mut path_to_comfy2 = get_seed_tool_data_root();
|
||||
// path_to_comfy2.push("models/workflows/comfyui/majicmixRealistic_v7.safetensors");
|
||||
// let comfy_weights_descriptor2 = Box::new(WeightsSD15Descriptor {});
|
||||
// let metadata2 = remote_cloud_file_client.upload_file(comfy_weights_descriptor2, path_to_comfy2.as_path().to_str().unwrap()).await?;
|
||||
|
||||
// let mut path_to_comfy3 = get_seed_tool_data_root();
|
||||
// path_to_comfy3.push("models/workflows/comfyui/yae_video_test.json");
|
||||
// let comfy_weights_descriptor3 = Box::new(WeightsWorkflowDescriptor {});
|
||||
// let metadata3 = remote_cloud_file_client.upload_file(comfy_weights_descriptor3, path_to_comfy3.as_path().to_str().unwrap()).await?;
|
||||
|
||||
/* let mut path_to_comfy4 = get_seed_tool_data_root();
|
||||
path_to_comfy4.push("models/workflows/comfyui/v3_sd15_mm.ckpt");
|
||||
let comfy_weights_descriptor4 = Box::new(WeightsSD15CkptDescriptor {});
|
||||
let metadata4 = remote_cloud_file_client.upload_file(comfy_weights_descriptor4, path_to_comfy4.as_path().to_str().unwrap()).await?;*/
|
||||
|
||||
let weights1 = CreateModelWeightsArgs {
|
||||
token: &model_weight_token1, // replace with actual ModelWeightToken
|
||||
weights_type: WeightsType::ComfyUi, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::WorkflowConfig, // replace with actual WeightsCategory
|
||||
title: "yae-video-prod".to_string(),
|
||||
maybe_description_markdown: Some("ComfyUI Workflow".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
maybe_last_update_user_token: Some("Last Update User Token".to_string()),
|
||||
original_download_url: Some("https://github.com/comfyanonymous/ComfyUI".to_string()),
|
||||
original_filename: Some("yae_video_prod.json".to_string()),
|
||||
file_size_bytes: metadata1.file_size_bytes,
|
||||
file_checksum_sha2: metadata1.sha256_checksum.to_string(),
|
||||
public_bucket_hash: metadata1.bucket_details.clone().unwrap().object_hash,
|
||||
maybe_public_bucket_prefix: Some(metadata1.bucket_details.clone().unwrap().prefix),
|
||||
maybe_public_bucket_extension: Some(metadata1.bucket_details.clone().unwrap().suffix),
|
||||
version: 1,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
};
|
||||
// let weights2 = CreateModelWeightsArgs {
|
||||
// token: &model_weight_token2, // replace with actual ModelWeightToken
|
||||
// weights_type: WeightsType::ComfyUi, // replace with actual WeightsType
|
||||
// weights_category: WeightsCategory::WorkflowConfig, // replace with actual WeightsCategory
|
||||
// title: "v1-5-pruned-emaonly".to_string(),
|
||||
// maybe_description_markdown: Some("Test model for ComfyUI".to_string()),
|
||||
// maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
|
||||
// creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
// creator_ip_address: "192.168.1.1",
|
||||
// creator_set_visibility: Visibility::Public,
|
||||
// maybe_last_update_user_token: Some("Last Update User Token".to_string()),
|
||||
// original_download_url: Some("https://huggingface.co/runwayml/stable-diffusion-v1-5".to_string()),
|
||||
// original_filename: Some("v1-5-pruned-emaonly.ckpt".to_string()),
|
||||
// file_size_bytes: metadata2.file_size_bytes as i32,
|
||||
// file_checksum_sha2: metadata2.sha256_checksum.to_string(),
|
||||
// public_bucket_hash: metadata2.bucket_details.clone().unwrap().object_hash,
|
||||
// maybe_public_bucket_prefix: Some(metadata2.bucket_details.clone().unwrap().prefix),
|
||||
// maybe_public_bucket_extension: Some(metadata2.bucket_details.clone().unwrap().suffix),
|
||||
// version: 1,
|
||||
// mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
// };
|
||||
|
||||
// let weights3 = CreateModelWeightsArgs {
|
||||
// token: &model_weight_token3, // replace with actual ModelWeightToken
|
||||
// weights_type: WeightsType::ComfyUi, // replace with actual WeightsType
|
||||
// weights_category: WeightsCategory::WorkflowConfig, // replace with actual WeightsCategory
|
||||
// title: "yae-video-test".to_string(),
|
||||
// maybe_description_markdown: Some("Test workflow for ComfyUI".to_string()),
|
||||
// maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
|
||||
// creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
// creator_ip_address: "192.168.1.1",
|
||||
// creator_set_visibility: Visibility::Public,
|
||||
// maybe_last_update_user_token: Some("Last Update User Token".to_string()),
|
||||
// original_download_url: Some("https://github.com/comfyanonymous/ComfyUI".to_string()),
|
||||
// original_filename: Some("yae-video-test.json".to_string()),
|
||||
// file_size_bytes: metadata3.file_size_bytes as i32,
|
||||
// file_checksum_sha2: metadata3.sha256_checksum.to_string(),
|
||||
// public_bucket_hash: metadata3.bucket_details.clone().unwrap().object_hash,
|
||||
// maybe_public_bucket_prefix: Some(metadata3.bucket_details.clone().unwrap().prefix),
|
||||
// maybe_public_bucket_extension: Some(metadata3.bucket_details.clone().unwrap().suffix),
|
||||
// version: 1,
|
||||
// mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
// };
|
||||
|
||||
// let weights4 = CreateModelWeightsArgs {
|
||||
// token: &model_weight_token4, // replace with actual ModelWeightToken
|
||||
// weights_type: WeightsType::ComfyUi, // replace with actual WeightsType
|
||||
// weights_category: WeightsCategory::WorkflowConfig, // replace with actual WeightsCategory
|
||||
// title: "v3_sd15_mm".to_string(),
|
||||
// maybe_description_markdown: Some("ComfyUI motion module".to_string()),
|
||||
// maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
|
||||
// creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
// creator_ip_address: "192.168.1.1",
|
||||
// creator_set_visibility: Visibility::Public,
|
||||
// maybe_last_update_user_token: Some("Last Update User Token".to_string()),
|
||||
// original_download_url: Some("https://huggingface.co/guoyww/animatediff/blob/main/v3_sd15_mm.ckpt".to_string()),
|
||||
// original_filename: Some("v3_sd15_mm.ckpt".to_string()),
|
||||
// file_size_bytes: metadata4.file_size_bytes as i32,
|
||||
// file_checksum_sha2: metadata4.sha256_checksum.to_string(),
|
||||
// public_bucket_hash: metadata4.bucket_details.clone().unwrap().object_hash,
|
||||
// maybe_public_bucket_prefix: Some(metadata4.bucket_details.clone().unwrap().prefix),
|
||||
// maybe_public_bucket_extension: Some(metadata4.bucket_details.clone().unwrap().suffix),
|
||||
// version: 1,
|
||||
// mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
// };
|
||||
|
||||
create_weight(weights1).await?;
|
||||
// create_weight(weights2).await?;
|
||||
// create_weight(weights3).await?;
|
||||
// create_weight(weights4).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn seed_weights_for_user_token(
|
||||
mysql_pool: &Pool<MySql>,
|
||||
user_token: UserToken
|
||||
@@ -1008,11 +1116,12 @@ pub async fn seed_weights(mysql_pool: &Pool<MySql>) -> AnyhowResult<()> {
|
||||
Some(token) => token,
|
||||
};
|
||||
|
||||
//original_seed_weights(mysql_pool,user_token).await?;
|
||||
//seed_weights_for_user_token(mysql_pool, user_token).await?;
|
||||
//seed_weights_for_paging(mysql_pool,user_token).await?;
|
||||
seed_weights_for_testing_inference(mysql_pool,user_token).await?;
|
||||
//println!("TESTING DOWLOAD");
|
||||
//test_seed_weights_files().await?;
|
||||
// original_seed_weights(mysql_pool,user_token).await?;
|
||||
// seed_weights_for_user_token(mysql_pool, user_token).await?;
|
||||
// seed_weights_for_paging(mysql_pool,user_token).await?;
|
||||
// seed_weights_for_testing_inference(mysql_pool,user_token.clone()).await?;
|
||||
// println!("TESTING DOWLOAD");
|
||||
// test_seed_weights_files().await?;
|
||||
seed_workflows_for_testing_inference(mysql_pool,user_token.clone()).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ pub async fn seed_weights_files(
|
||||
maybe_last_update_user_token: None, // Assuming there is no last update user token
|
||||
original_download_url: Some(original_download_url.to_string()),
|
||||
original_filename: Some(original_filename.to_string()),
|
||||
file_size_bytes: file_size_bytes as i32, // Assuming the file size is 0
|
||||
file_size_bytes, // Assuming the file size is 0
|
||||
file_checksum_sha2: sha256_checksum.to_string(), // Assuming the file checksum is an empty string
|
||||
public_bucket_hash: bucket_hash,
|
||||
maybe_public_bucket_prefix: Some(maybe_bucket_prefix.to_string()),
|
||||
|
||||
@@ -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") |
|
||||
|
||||
@@ -14,6 +14,7 @@ use sqlx::mysql::MySqlPoolOptions;
|
||||
use config::shared_constants::DEFAULT_RUST_LOG;
|
||||
use elasticsearch_schema::searches::search_model_weights::search_model_weights;
|
||||
use elasticsearch_schema::searches::search_tts_models::search_tts_models;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::cli_args::{Action, Environment, parse_cli_args};
|
||||
@@ -55,9 +56,10 @@ pub async fn main() -> AnyhowResult<()> {
|
||||
}
|
||||
Action::SearchModelWeights => {
|
||||
info!("Searching model weights...");
|
||||
let results = search_model_weights(&elasticsearch, "zel", Some("en")).await?;
|
||||
//let results = search_model_weights(&elasticsearch, "zel", Some("en"), Some(WeightsType::SoVitsSvc)).await?;
|
||||
let results = search_model_weights(&elasticsearch, "zel", None, Some(WeightsType::RvcV2), None).await?;
|
||||
for result in results {
|
||||
println!("Result: {:?}", result);
|
||||
println!("Result: {:#?}", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -21,6 +21,7 @@ const PAGE_SIZE: u64 = 10;
|
||||
pub async fn migrate_tts_to_weights(deps: &Deps) -> AnyhowResult<()> {
|
||||
|
||||
let mut cursor = 0;
|
||||
let mut counter = 0;
|
||||
|
||||
loop {
|
||||
info!("Querying {PAGE_SIZE} models at cursor = {cursor}");
|
||||
@@ -34,15 +35,16 @@ pub async fn migrate_tts_to_weights(deps: &Deps) -> AnyhowResult<()> {
|
||||
}
|
||||
|
||||
for result in results.iter() {
|
||||
println!("\n\nmigrating over result {:?} : {:?} ...", result.token, result);
|
||||
println!("\n\nmigrating over (counter: {counter}, id: {}, token: {:?}) : {:?} ...", result.id, result.token, result);
|
||||
copy_model_record_and_bucket_files(result, &deps).await?;
|
||||
counter += 1;
|
||||
}
|
||||
|
||||
if let Some(last_id) = results.last().map(|result| result.id) {
|
||||
cursor = last_id as u64;
|
||||
}
|
||||
|
||||
thread::sleep(Duration::from_secs(2));
|
||||
thread::sleep(Duration::from_millis(500));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,7 +2,8 @@ use crate::remote_file_manager::file_descriptor::FileDescriptor;
|
||||
// TODO ASK BRANDON WHAT path should this be?
|
||||
const MEDIA_FILE_DIRECTORY: &str = "/media";
|
||||
|
||||
pub struct MediaImagePngDescriptor {}
|
||||
pub struct MediaImagePngDescriptor;
|
||||
|
||||
impl FileDescriptor for MediaImagePngDescriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
MEDIA_FILE_DIRECTORY
|
||||
@@ -19,3 +20,21 @@ impl FileDescriptor for MediaImagePngDescriptor {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MediaVideoMp4Descriptor;
|
||||
impl FileDescriptor for MediaVideoMp4Descriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
MEDIA_FILE_DIRECTORY
|
||||
}
|
||||
fn get_suffix(&self)->String {
|
||||
"mp4".to_string()
|
||||
}
|
||||
|
||||
fn get_prefix(&self)->String {
|
||||
"video".to_string()
|
||||
}
|
||||
|
||||
fn is_public(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
+22
-1
@@ -1,3 +1,4 @@
|
||||
use crate::remote_file_manager::media_descriptor;
|
||||
use crate::remote_file_manager::weights_descriptor::{self};
|
||||
use super::file_descriptor::FileDescriptor;
|
||||
|
||||
@@ -28,8 +29,14 @@ impl RemoteCloudBucketDetails {
|
||||
|
||||
pub fn file_descriptor_from_bucket_details(&self) -> Box<dyn FileDescriptor> {
|
||||
match self.prefix.as_str() {
|
||||
// Weights
|
||||
"loRA" => Box::new(weights_descriptor::WeightsLoRADescriptor {}),
|
||||
"sd15" => Box::new(weights_descriptor::WeightsSD15Descriptor {}),
|
||||
"sd15" =>
|
||||
match self.suffix.as_str() {
|
||||
"safetensors" => Box::new(weights_descriptor::WeightsSD15Descriptor {}),
|
||||
"ckpt" => Box::new(weights_descriptor::WeightsSD15CkptDescriptor {}),
|
||||
_ => panic!("Unknown suffix: {}",self.suffix)
|
||||
},
|
||||
"sdxl" => Box::new(weights_descriptor::WeightsSDXLDescriptor {}),
|
||||
"valle_prompt" => Box::new(weights_descriptor::WeightsVallePromptDescriptor {}),
|
||||
"rvc" => {
|
||||
@@ -40,6 +47,20 @@ impl RemoteCloudBucketDetails {
|
||||
}
|
||||
},
|
||||
"svc" => Box::new(weights_descriptor::WeightsSVCDescriptor {}),
|
||||
"workflow" => Box::new(weights_descriptor::WeightsWorkflowDescriptor {}),
|
||||
// Media
|
||||
"image" => {
|
||||
match self.suffix.as_str() {
|
||||
"png" => Box::new(media_descriptor::MediaImagePngDescriptor {}),
|
||||
_ => panic!("Unknown suffix: {}",self.suffix)
|
||||
}
|
||||
},
|
||||
"video" => {
|
||||
match self.suffix.as_str() {
|
||||
"mp4" => Box::new(media_descriptor::MediaVideoMp4Descriptor {}),
|
||||
_ => panic!("Unknown suffix: {}",self.suffix)
|
||||
}
|
||||
},
|
||||
_ => panic!("Unknown prefix: {}", self.prefix)
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -1,4 +1,5 @@
|
||||
use anyhow::anyhow;
|
||||
|
||||
use errors::AnyhowResult;
|
||||
use filesys::file_read_bytes::file_read_bytes;
|
||||
use filesys::file_size::file_size;
|
||||
@@ -12,7 +13,6 @@ use crate::remote_file_manager::remote_cloud_bucket_details::RemoteCloudBucketDe
|
||||
use super::file_descriptor::FileDescriptor;
|
||||
use super::file_meta_data::FileMetaData;
|
||||
|
||||
|
||||
pub struct RemoteCloudFileClient {
|
||||
bucket_orchestration_client: Box<dyn BucketOrchestrationCore>
|
||||
}
|
||||
@@ -38,12 +38,12 @@ impl RemoteCloudFileClient {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Where the to_system_file_path is let sd_checkpoint_path = work_temp_dir.path().join("sd_checkpoint.safetensors"); path and file name and extension
|
||||
pub async fn download_file(&self, remote_cloud_bucket_details:RemoteCloudBucketDetails, to_system_file_path:String) -> AnyhowResult<()> {
|
||||
let file_descriptor = remote_cloud_bucket_details.file_descriptor_from_bucket_details();
|
||||
let file_bucket_directory = FileBucketDirectory::from_existing_bucket_details(remote_cloud_bucket_details);
|
||||
let full_remote_cloud_file_path = file_bucket_directory.get_full_remote_cloud_file_path().to_string();
|
||||
let is_public = file_descriptor.is_public().clone();
|
||||
let is_public = file_descriptor.is_public();
|
||||
|
||||
self.bucket_orchestration_client.download_file_to_disk(full_remote_cloud_file_path, to_system_file_path, is_public).await?;
|
||||
Ok(())
|
||||
@@ -68,8 +68,8 @@ impl RemoteCloudFileClient {
|
||||
|
||||
result.bucket_details = Some(RemoteCloudBucketDetails {
|
||||
object_hash: directory.get_file_object_hash().to_string(),
|
||||
suffix:suffix,
|
||||
prefix:prefix,
|
||||
suffix,
|
||||
prefix,
|
||||
});
|
||||
|
||||
println!("Uploading media file to bucket path: {:?}",directory.get_full_remote_cloud_file_path());
|
||||
@@ -85,7 +85,7 @@ impl RemoteCloudFileClient {
|
||||
}
|
||||
|
||||
// Retrieve the metadata from the file
|
||||
fn get_file_meta_data(system_file_path:&str) -> AnyhowResult<FileMetaData> {
|
||||
pub fn get_file_meta_data(system_file_path:&str) -> AnyhowResult<FileMetaData> {
|
||||
let file_size_bytes = file_size(system_file_path.clone())?;
|
||||
let sha256_checksum = sha256_hash_file(system_file_path.clone())?;
|
||||
|
||||
@@ -105,6 +105,7 @@ impl RemoteCloudFileClient {
|
||||
mod tests {
|
||||
use async_trait::async_trait;
|
||||
use env_logger;
|
||||
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::remote_file_manager::bucket_orchestration::BucketOrchestrationCore;
|
||||
|
||||
@@ -50,6 +50,30 @@ impl FileDescriptor for WeightsSD15Descriptor {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WeightsSD15CkptDescriptor;
|
||||
|
||||
impl FileDescriptor for WeightsSD15CkptDescriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
// this will be the type of file peroid is handled by the file formatter
|
||||
// e.g safetensors bin jpg
|
||||
fn get_suffix(&self)->String {
|
||||
"ckpt".to_string()
|
||||
}
|
||||
// This will be the prefix of the media type or the weights type.
|
||||
// name of the weights or the name of the media type
|
||||
// vall-e_prompt, SD15, sd15, sdxl when implmenting add to the end
|
||||
fn get_prefix(&self)->String {
|
||||
"sd15".to_string()
|
||||
}
|
||||
|
||||
// This will be ensure that the right bucket is picked
|
||||
fn is_public(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub struct WeightsSDXLDescriptor;
|
||||
|
||||
@@ -169,4 +193,24 @@ impl FileDescriptor for crate::remote_file_manager::weights_descriptor::WeightsV
|
||||
fn is_public(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WeightsWorkflowDescriptor;
|
||||
|
||||
impl FileDescriptor for WeightsWorkflowDescriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
|
||||
fn get_suffix(&self) -> String {
|
||||
"json".to_string()
|
||||
}
|
||||
|
||||
fn get_prefix(&self) -> String {
|
||||
"workflow".to_string()
|
||||
}
|
||||
|
||||
fn is_public(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,6 @@ impl GoogleDriveDownloadCommand {
|
||||
.unwrap_or("/tmp")
|
||||
.to_string();
|
||||
|
||||
let temp_filename = random_crockford_token(10);
|
||||
let temp_filename = format!("{}/{}", temp_dir_path, file_name);
|
||||
|
||||
info!("Downloading {} to: {}", download_url, temp_filename);
|
||||
|
||||
@@ -30,7 +30,7 @@ impl TtlKeyCounter {
|
||||
Ok(0)
|
||||
}
|
||||
Some(count) => {
|
||||
let return_count = count.clone();
|
||||
let return_count = *count;
|
||||
*count = count.saturating_add(1);
|
||||
Ok(return_count)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,10 @@ pub enum EnvError {
|
||||
reason: String
|
||||
},
|
||||
/// The required environment variable wasn't present.
|
||||
RequiredNotPresent,
|
||||
RequiredNotPresent {
|
||||
/// The name of the missing environment variable.
|
||||
name: String
|
||||
},
|
||||
}
|
||||
|
||||
impl Display for EnvError {
|
||||
@@ -21,7 +24,19 @@ impl Display for EnvError {
|
||||
let reason = match self {
|
||||
EnvError::NotUnicode => "EnvError::NotUnicode",
|
||||
EnvError::ParseError { .. } => "EnvError::ParseError",
|
||||
EnvError::RequiredNotPresent => "EnvError::RequiredNotPresent",
|
||||
EnvError::RequiredNotPresent { name } =>
|
||||
return write!(f, r#"
|
||||
EnvError::RequiredNotPresent: the following environment variable was not present:
|
||||
|
||||
---> {:?}
|
||||
|
||||
In development, setting it in the environment config files: .env, .env-secrets,
|
||||
cargo/service/../{{app_name}}/config/{{app_name}}.development.env, etc.
|
||||
|
||||
If it looks like it might be a secret, ask for help in our company Discord.
|
||||
|
||||
In production, make sure these environment variables are set in Kubernetes.
|
||||
"#, name),
|
||||
};
|
||||
write!(f, "{:?}", reason)
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ pub fn get_env_bool_required(env_name: &str) -> Result<bool, EnvError> {
|
||||
.and_then(|maybe| match maybe {
|
||||
None => {
|
||||
warn!("Env var '{}' not supplied.", env_name);
|
||||
Err(EnvError::RequiredNotPresent)
|
||||
Err(EnvError::RequiredNotPresent { name: env_name.to_string() })
|
||||
},
|
||||
Some(val) => Ok(val),
|
||||
})
|
||||
|
||||
@@ -12,7 +12,7 @@ pub fn get_env_duration_seconds_required(env_name: &str) -> Result<Duration, Env
|
||||
.and_then(|maybe| match maybe {
|
||||
None => {
|
||||
warn!("Env var '{}' not supplied.", env_name);
|
||||
Err(EnvError::RequiredNotPresent)
|
||||
Err(EnvError::RequiredNotPresent { name: env_name.to_string() })
|
||||
},
|
||||
Some(val) => Ok(val),
|
||||
})
|
||||
|
||||
@@ -15,7 +15,7 @@ pub fn get_env_pathbuf_required(env_name: &str) -> Result<PathBuf, EnvError> {
|
||||
.and_then(|maybe| match maybe {
|
||||
None => {
|
||||
warn!("Env var '{}' not supplied.", env_name);
|
||||
Err(EnvError::RequiredNotPresent)
|
||||
Err(EnvError::RequiredNotPresent { name: env_name.to_string() })
|
||||
},
|
||||
Some(val) => Ok(val),
|
||||
})
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn get_env_string_required(env_name: &str) -> Result<String, EnvError> {
|
||||
Some(s) => Ok(s.to_string()),
|
||||
None => {
|
||||
warn!("Required env var '{}' not supplied.", env_name);
|
||||
Err(EnvError::RequiredNotPresent)
|
||||
Err(EnvError::RequiredNotPresent { name: env_name.to_string() })
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ chrono = { version = "0.4.22", features = ["serde"] }
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
serde_json = "1.0.108"
|
||||
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
|
||||
regex = "1.10.2"
|
||||
|
||||
[dev-dependencies]
|
||||
# None yet
|
||||
# None yet
|
||||
@@ -1,22 +1,125 @@
|
||||
use elasticsearch::{Elasticsearch, SearchParts};
|
||||
use log::error;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use errors::AnyhowResult;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use errors::{anyhow, AnyhowResult};
|
||||
|
||||
use crate::documents::model_weight_document::{MODEL_WEIGHT_INDEX, ModelWeightDocument};
|
||||
|
||||
pub struct SearchModelWeightsQuery<'a> {
|
||||
pub search_term: &'a str,
|
||||
pub maybe_language_subtag: Option<&'a str>,
|
||||
pub maybe_weights_type: Option<WeightsType>,
|
||||
pub maybe_weights_category: Option<WeightsCategory>,
|
||||
}
|
||||
|
||||
impl <'a>SearchModelWeightsQuery<'a> {
|
||||
|
||||
fn base_query(&self) -> Value {
|
||||
json!({
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"fuzzy": {
|
||||
"title": {
|
||||
"value": self.search_term,
|
||||
"fuzziness": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"title": {
|
||||
"query": self.search_term,
|
||||
"boost": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"multi_match": {
|
||||
"query": self.search_term,
|
||||
"type": "bool_prefix",
|
||||
"fields": [
|
||||
"title",
|
||||
"title._2gram",
|
||||
"title._3gram"
|
||||
],
|
||||
"boost": 50
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn query(&self) -> AnyhowResult<Value> {
|
||||
let mut search_json = self.base_query();
|
||||
|
||||
let must_clause = search_json.pointer_mut("/query/bool/must")
|
||||
.map(|pointer| pointer.as_array_mut())
|
||||
.flatten()
|
||||
.ok_or_else(|| anyhow!("could not get pointer to must clause"))?;
|
||||
|
||||
if let Some(maybe_language_subtag) = &self.maybe_language_subtag {
|
||||
must_clause.push(json!(
|
||||
{
|
||||
"match": {
|
||||
"maybe_ietf_primary_language_subtag": maybe_language_subtag
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(weights_type) = &self.maybe_weights_type {
|
||||
must_clause.push(json!(
|
||||
{
|
||||
"match": {
|
||||
"weights_type": weights_type.to_string(),
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(weights_category) = &self.maybe_weights_category {
|
||||
must_clause.push(json!(
|
||||
{
|
||||
"match": {
|
||||
"weights_category": weights_category.to_string(),
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
Ok(search_json)
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn search_model_weights(
|
||||
client: &Elasticsearch,
|
||||
search_term: &str,
|
||||
maybe_language_subtag: Option<&str>,
|
||||
maybe_weights_type: Option<WeightsType>,
|
||||
maybe_weights_category: Option<WeightsCategory>,
|
||||
) -> AnyhowResult<Vec<ModelWeightDocument>> {
|
||||
|
||||
let search_json = match maybe_language_subtag {
|
||||
None => query_model_weights(search_term),
|
||||
Some(language) => query_model_weights_with_required_language(search_term, language)
|
||||
let query = SearchModelWeightsQuery {
|
||||
search_term,
|
||||
maybe_language_subtag,
|
||||
maybe_weights_type,
|
||||
maybe_weights_category,
|
||||
};
|
||||
|
||||
let search_json = query.query()?;
|
||||
|
||||
let search_response = client
|
||||
.search(SearchParts::Index(&[MODEL_WEIGHT_INDEX]))
|
||||
.body(search_json)
|
||||
@@ -44,11 +147,7 @@ pub async fn search_model_weights(
|
||||
let maybe_object = hit.get_mut("_source")
|
||||
.map(|source| source.take());
|
||||
if let Some(value) = maybe_object {
|
||||
let document = serde_json::from_value::<ModelWeightDocument>(value)
|
||||
.map_err(|err| {
|
||||
error!("Error: {:?}", &err);
|
||||
err
|
||||
})?;
|
||||
let document = serde_json::from_value::<ModelWeightDocument>(value)?;
|
||||
documents.push(document);
|
||||
}
|
||||
}
|
||||
@@ -59,97 +158,164 @@ pub async fn search_model_weights(
|
||||
Ok(documents)
|
||||
}
|
||||
|
||||
fn query_model_weights(search_term: &str) -> Value {
|
||||
json!({
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"fuzzy": {
|
||||
"title": {
|
||||
"value": search_term,
|
||||
"fuzziness": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"title": {
|
||||
"query": search_term,
|
||||
"boost": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"multi_match": {
|
||||
"query": search_term,
|
||||
"type": "bool_prefix",
|
||||
"fields": [
|
||||
"title",
|
||||
"title._2gram",
|
||||
"title._3gram"
|
||||
],
|
||||
"boost": 50
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use regex::Regex;
|
||||
|
||||
fn query_model_weights_with_required_language(search_term: &str, language_tag: &str) -> Value {
|
||||
json!({
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"match": {
|
||||
"maybe_ietf_primary_language_subtag": language_tag
|
||||
}
|
||||
},
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"fuzzy": {
|
||||
"title": {
|
||||
"value": search_term,
|
||||
"fuzziness": 2
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::searches::search_model_weights::SearchModelWeightsQuery;
|
||||
|
||||
fn query_to_json_string(query: SearchModelWeightsQuery<'_>) -> AnyhowResult<String> {
|
||||
let json = query.query()?;
|
||||
let json = serde_json::to_string(&json)?;
|
||||
Ok(json)
|
||||
}
|
||||
|
||||
fn compact_json(json: &str) -> String {
|
||||
let regex = Regex::new("\\s+").expect("regex should parse");
|
||||
let json = regex.replace_all(&json, "");
|
||||
json.to_string()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_search_only_keyword() {
|
||||
let query = SearchModelWeightsQuery {
|
||||
search_term: "FOO_BAR_BAZ",
|
||||
maybe_language_subtag: None,
|
||||
maybe_weights_type: None,
|
||||
maybe_weights_category: None,
|
||||
};
|
||||
|
||||
let json = query_to_json_string(query).unwrap();
|
||||
|
||||
// NB: Keys in emitted JSON are sorted.
|
||||
let expected_json = r#"
|
||||
{
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"fuzzy": {
|
||||
"title": {
|
||||
"fuzziness": 2,
|
||||
"value": "FOO_BAR_BAZ"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"title": {
|
||||
"boost": 1,
|
||||
"query": "FOO_BAR_BAZ"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"multi_match": {
|
||||
"boost": 50,
|
||||
"fields": [
|
||||
"title",
|
||||
"title._2gram",
|
||||
"title._3gram"
|
||||
],
|
||||
"query": "FOO_BAR_BAZ",
|
||||
"type": "bool_prefix"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"title": {
|
||||
"query": search_term,
|
||||
"boost": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"multi_match": {
|
||||
"query": search_term,
|
||||
"type": "bool_prefix",
|
||||
"fields": [
|
||||
"title",
|
||||
"title._2gram",
|
||||
"title._3gram"
|
||||
],
|
||||
"boost": 50
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
"#;
|
||||
|
||||
let expected_json = compact_json(&expected_json);
|
||||
|
||||
assert_eq!(&json, &expected_json);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn search_with_language_and_weights() {
|
||||
let query = SearchModelWeightsQuery {
|
||||
search_term: "FOO_BAR_BAZ",
|
||||
maybe_language_subtag: Some("en"),
|
||||
maybe_weights_type: Some(WeightsType::SoVitsSvc),
|
||||
maybe_weights_category: Some(WeightsCategory::Vocoder),
|
||||
};
|
||||
|
||||
let json = query_to_json_string(query).unwrap();
|
||||
|
||||
// NB: Keys in emitted JSON are sorted.
|
||||
let expected_json = r#"
|
||||
{
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"fuzzy": {
|
||||
"title": {
|
||||
"fuzziness": 2,
|
||||
"value": "FOO_BAR_BAZ"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"title": {
|
||||
"boost": 1,
|
||||
"query": "FOO_BAR_BAZ"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"multi_match": {
|
||||
"boost": 50,
|
||||
"fields": [
|
||||
"title",
|
||||
"title._2gram",
|
||||
"title._3gram"
|
||||
],
|
||||
"query": "FOO_BAR_BAZ",
|
||||
"type": "bool_prefix"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"maybe_ietf_primary_language_subtag": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"weights_type": "so_vits_svc"
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"weights_category": "vocoder"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
"#;
|
||||
|
||||
let expected_json = compact_json(&expected_json);
|
||||
|
||||
assert_eq!(&json, &expected_json);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
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, ModelWeightForLegacyTtsEnqueue};
|
||||
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_enqueue_inference_migration(
|
||||
token: &str,
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
can_see_deleted: bool,
|
||||
) -> AnyhowResult<Option<TtsModelForEnqueueInferenceMigrationWrapper>> {
|
||||
// NB: This is temporary migration code as we switch from the `tts_models` table to the `model_weights` table.
|
||||
let use_weights_table = token.starts_with(ModelWeightToken::token_prefix());
|
||||
|
||||
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| TtsModelForEnqueueInferenceMigrationWrapper::ModelWeight(model)))
|
||||
|
||||
} else {
|
||||
|
||||
let maybe_model = get_tts_model_by_token_using_connection(
|
||||
&token,
|
||||
true,
|
||||
mysql_connection
|
||||
).await?;
|
||||
|
||||
Ok(maybe_model.map(|model| TtsModelForEnqueueInferenceMigrationWrapper::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 TtsModelForEnqueueInferenceMigrationWrapper {
|
||||
/// Old type from the `tts_models` table, on the way out
|
||||
LegacyTts(TtsModelRecord),
|
||||
/// New type, replacing the `tts_models` table.
|
||||
ModelWeight(ModelWeightForLegacyTtsEnqueue),
|
||||
}
|
||||
|
||||
impl TtsModelForEnqueueInferenceMigrationWrapper {
|
||||
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,200 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
use buckets::public::weight_files::bucket_file_path::WeightFileBucketPath;
|
||||
use cloud_storage::bucket_path_unifier::BucketPathUnifier;
|
||||
use enums::by_table::tts_models::tts_model_type::TtsModelType;
|
||||
use mysql_queries::queries::model_weights::get::get_weight_for_legacy_tts_inference::{get_weight_for_legacy_tts_inference, ModelWeightForLegacyTtsInference};
|
||||
use mysql_queries::queries::tts::tts_models::get_tts_model_for_inference_improved::{CustomVocoderFields, get_tts_model_for_inference_improved, TtsModelForInferenceError, TtsModelForInferenceRecord};
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
/// Get TTS model
|
||||
/// This is for the inference inference job.
|
||||
pub async fn get_tts_model_for_run_inference_migration(
|
||||
tts_model_token: &str,
|
||||
mysql_pool: &MySqlPool,
|
||||
) -> Result<Option<TtsModelForRunInferenceMigrationWrapper>, TtsModelForInferenceError> {
|
||||
// NB: This is temporary migration code as we switch from the `tts_models` table to the `model_weights` table.
|
||||
if tts_model_token.starts_with(ModelWeightToken::token_prefix()) {
|
||||
let token = ModelWeightToken::new_from_str(tts_model_token);
|
||||
|
||||
let maybe_model = get_weight_for_legacy_tts_inference(
|
||||
&token,
|
||||
mysql_pool
|
||||
).await?;
|
||||
|
||||
Ok(maybe_model.map(|model| TtsModelForRunInferenceMigrationWrapper::ModelWeight(model)))
|
||||
} else {
|
||||
|
||||
let maybe_model = get_tts_model_for_inference_improved(
|
||||
mysql_pool,
|
||||
&tts_model_token,
|
||||
).await?;
|
||||
|
||||
Ok(maybe_model.map(|model| TtsModelForRunInferenceMigrationWrapper::LegacyTts(model)))
|
||||
}
|
||||
}
|
||||
|
||||
/// Migration wrapper type.
|
||||
/// 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)]
|
||||
pub enum TtsModelForRunInferenceMigrationWrapper {
|
||||
/// Old type from the `tts_models` table, on the way out
|
||||
LegacyTts(TtsModelForInferenceRecord),
|
||||
/// New type, replacing the `tts_models` table.
|
||||
ModelWeight(ModelWeightForLegacyTtsInference),
|
||||
}
|
||||
|
||||
impl TtsModelForRunInferenceMigrationWrapper {
|
||||
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 creator_user_token(&self) -> &UserToken {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.creator_user_token,
|
||||
Self::ModelWeight(ref model) => &model.creator_user_token,
|
||||
}
|
||||
}
|
||||
|
||||
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 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,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mod_deleted_at(&self) -> Option<&DateTime<Utc>> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.mod_deleted_at.as_ref(),
|
||||
Self::ModelWeight(ref model) => model.mod_deleted_at.as_ref(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn user_deleted_at(&self) -> Option<&DateTime<Utc>> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.user_deleted_at.as_ref(),
|
||||
Self::ModelWeight(ref model) => model.user_deleted_at.as_ref(),
|
||||
}
|
||||
}
|
||||
|
||||
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 maybe_default_pretrained_vocoder(&self) -> Option<&str> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.maybe_default_pretrained_vocoder.as_deref(),
|
||||
Self::ModelWeight(ref model) => model.maybe_default_pretrained_vocoder.as_deref(),
|
||||
}
|
||||
}
|
||||
|
||||
/* 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(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn use_default_mel_multiply_factor(&self) -> bool {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.use_default_mel_multiply_factor,
|
||||
Self::ModelWeight(ref model) => model.use_default_mel_multiply_factor,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn maybe_custom_mel_multiply_factor(&self) -> Option<f64> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.maybe_custom_mel_multiply_factor,
|
||||
Self::ModelWeight(ref model) => model.maybe_custom_mel_multiply_factor,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn maybe_custom_vocoder(&self) -> Option<&CustomVocoderFields> {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => model.maybe_custom_vocoder.as_ref(),
|
||||
Self::ModelWeight(ref model) => model.maybe_custom_vocoder.as_ref(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Which bucket to download the weights from
|
||||
pub fn is_private_bucket(&self) -> bool {
|
||||
match self {
|
||||
Self::LegacyTts(ref _model) => true,
|
||||
Self::ModelWeight(ref _model) => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Path to the weights in the bucket
|
||||
/// The old and new schemes are quite different.
|
||||
pub fn bucket_object_path(&self, bucket_path_unifier: &BucketPathUnifier) -> PathBuf {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => bucket_path_unifier.tts_synthesizer_path(&model.private_bucket_hash),
|
||||
Self::ModelWeight(ref model) => {
|
||||
let path = WeightFileBucketPath::from_object_hash(
|
||||
&model.public_bucket_hash,
|
||||
model.maybe_public_bucket_prefix.as_deref(),
|
||||
model.maybe_public_bucket_extension.as_deref());
|
||||
|
||||
PathBuf::from(path.get_full_object_path_str())
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NB: Just for vits, which we never supported anyway
|
||||
pub fn vits_traced_synthesizer_object_path(&self, bucket_path_unifier: &BucketPathUnifier) -> PathBuf {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => bucket_path_unifier.tts_traced_synthesizer_path(&model.private_bucket_hash),
|
||||
Self::ModelWeight(ref _model) => PathBuf::from("VITS_UNSUPPORTED_FOR_MODEL_WEIGHTS"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<TtsModelInfoMigrationWrapper>> {
|
||||
// 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| TtsModelInfoMigrationWrapper::ModelWeight(model)))
|
||||
|
||||
} else {
|
||||
let maybe_model = get_tts_model_by_token_using_connection(
|
||||
&token,
|
||||
true,
|
||||
mysql_connection
|
||||
).await?;
|
||||
|
||||
Ok(maybe_model.map(|model| TtsModelInfoMigrationWrapper::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 TtsModelInfoMigrationWrapper {
|
||||
/// Old type from the `tts_models` table, on the way out
|
||||
LegacyTts(TtsModelRecord),
|
||||
/// New type, replacing the `tts_models` table.
|
||||
ModelWeight(ModelWeightForLegacyTtsInfo),
|
||||
}
|
||||
|
||||
impl TtsModelInfoMigrationWrapper {
|
||||
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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,14 +13,14 @@ use mysql_queries::queries::tts::tts_models::list_tts_models::{list_tts_models_w
|
||||
pub async fn list_tts_models_for_migration(
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
use_weights_table: bool,
|
||||
) -> AnyhowResult<Vec<TtsModelForList>> {
|
||||
) -> AnyhowResult<Vec<TtsModelForListMigrationWrapper>> {
|
||||
// NB: This is temporary migration code as we switch from the `tts_models` table to the `model_weights` table.
|
||||
if use_weights_table {
|
||||
let models = list_model_weights_for_text_to_speech(
|
||||
mysql_connection).await?;
|
||||
|
||||
Ok(models.into_iter()
|
||||
.map(|model| TtsModelForList::ModelWeight(model))
|
||||
.map(|model| TtsModelForListMigrationWrapper::ModelWeight(model))
|
||||
.collect())
|
||||
|
||||
} else {
|
||||
@@ -28,7 +28,7 @@ pub async fn list_tts_models_for_migration(
|
||||
mysql_connection, None, false).await?;
|
||||
|
||||
Ok(models.into_iter()
|
||||
.map(|model| TtsModelForList::LegacyTts(model))
|
||||
.map(|model| TtsModelForListMigrationWrapper::LegacyTts(model))
|
||||
.collect())
|
||||
}
|
||||
}
|
||||
@@ -36,120 +36,120 @@ pub async fn list_tts_models_for_migration(
|
||||
/// 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)]
|
||||
pub enum TtsModelForList {
|
||||
pub enum TtsModelForListMigrationWrapper {
|
||||
/// Old type from the `tts_models` table, on the way out
|
||||
LegacyTts(TtsModelRecordForList),
|
||||
/// New type, replacing the `tts_models` table.
|
||||
ModelWeight(ModelWeightForTts),
|
||||
}
|
||||
|
||||
impl TtsModelForList {
|
||||
impl TtsModelForListMigrationWrapper {
|
||||
pub fn token(&self) -> &str {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => model.model_token.as_str(),
|
||||
TtsModelForList::ModelWeight(ref model) => model.token.as_str(),
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => model.model_token.as_str(),
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => model.token.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &str {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => &model.title,
|
||||
TtsModelForList::ModelWeight(ref model) => &model.title,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => &model.title,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => &model.title,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ietf_language_tag(&self) -> &str {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => &model.ietf_language_tag,
|
||||
TtsModelForList::ModelWeight(ref model) => &model.ietf_language_tag,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => &model.ietf_language_tag,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => &model.ietf_language_tag,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ietf_primary_language_subtag(&self) -> &str {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => &model.ietf_primary_language_subtag,
|
||||
TtsModelForList::ModelWeight(ref model) => &model.ietf_primary_language_subtag,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => &model.ietf_primary_language_subtag,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => &model.ietf_primary_language_subtag,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_user_token(&self) -> &str {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => &model.creator_user_token,
|
||||
TtsModelForList::ModelWeight(ref model) => model.creator_user_token.as_str(),
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => &model.creator_user_token,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => model.creator_user_token.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_username(&self) -> &str {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => &model.creator_username,
|
||||
TtsModelForList::ModelWeight(ref model) => &model.creator_username,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => &model.creator_username,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => &model.creator_username,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_display_name(&self) -> &str {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => &model.creator_display_name,
|
||||
TtsModelForList::ModelWeight(ref model) => &model.creator_display_name,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => &model.creator_display_name,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => &model.creator_display_name,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_gravatar_hash(&self) -> &str {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => &model.creator_gravatar_hash,
|
||||
TtsModelForList::ModelWeight(ref model) => &model.creator_gravatar_hash,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => &model.creator_gravatar_hash,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => &model.creator_gravatar_hash,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn creator_set_visibility(&self) -> Visibility{
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => model.creator_set_visibility,
|
||||
TtsModelForList::ModelWeight(ref model) => model.creator_set_visibility,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => model.creator_set_visibility,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => model.creator_set_visibility,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn created_at(&self) -> &DateTime<Utc> {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => &model.created_at,
|
||||
TtsModelForList::ModelWeight(ref model) => &model.created_at,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => &model.created_at,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => &model.created_at,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn updated_at(&self) -> &DateTime<Utc> {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => &model.updated_at,
|
||||
TtsModelForList::ModelWeight(ref model) => &model.updated_at,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => &model.updated_at,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref model) => &model.updated_at,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn is_front_page_featured(&self) -> bool {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => model.is_front_page_featured,
|
||||
TtsModelForList::ModelWeight(ref _model) => false,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => model.is_front_page_featured,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref _model) => false,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn user_ratings_positive_count(&self) -> u32 {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => model.user_ratings_positive_count,
|
||||
TtsModelForList::ModelWeight(ref _model) => 0,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => model.user_ratings_positive_count,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref _model) => 0,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn user_ratings_negative_count(&self) -> u32 {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => model.user_ratings_negative_count,
|
||||
TtsModelForList::ModelWeight(ref _model) => 0,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => model.user_ratings_negative_count,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref _model) => 0,
|
||||
}
|
||||
}
|
||||
|
||||
// Not supported in the new table
|
||||
pub fn user_ratings_total_count(&self) -> u32 {
|
||||
match self {
|
||||
TtsModelForList::LegacyTts(ref model) => model.user_ratings_total_count,
|
||||
TtsModelForList::ModelWeight(ref _model) => 0,
|
||||
TtsModelForListMigrationWrapper::LegacyTts(ref model) => model.user_ratings_total_count,
|
||||
TtsModelForListMigrationWrapper::ModelWeight(ref _model) => 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
pub mod get_tts_model_for_enqueue_inference_migration;
|
||||
pub mod get_tts_model_for_run_inference_migration;
|
||||
pub mod get_tts_model_info_migration;
|
||||
pub mod list_tts_models_for_migration;
|
||||
@@ -67,6 +67,7 @@ impl VcModelForList {
|
||||
WeightsType::Tacotron2 => None,
|
||||
WeightsType::LoRA => None,
|
||||
WeightsType::VallE => None,
|
||||
WeightsType::ComfyUi => None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@ impl VcModel {
|
||||
WeightsType::Tacotron2 => VcModelType::Invalid,
|
||||
WeightsType::LoRA => VcModelType::Invalid,
|
||||
WeightsType::VallE => VcModelType::Invalid,
|
||||
WeightsType::ComfyUi => VcModelType::Invalid,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ impl VcModelLite {
|
||||
WeightsType::HifiganTacotron2 => None, // NB: Not used directly in inference. Included by other models.
|
||||
WeightsType::LoRA => None, // NB: not used directly in inference. Included in other models.
|
||||
WeightsType::VallE => None, // TODO(bt,2023-12-18): Does this mean speaker weights?
|
||||
WeightsType::ComfyUi => None, // NB: not used directly in inference. Included in other models.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +98,7 @@ impl VcModelLite {
|
||||
WeightsType::HifiganTacotron2 => None, // NB: Not used directly in inference. Included by other models.
|
||||
WeightsType::LoRA => None, // NB: not used directly in inference. Included in other models.
|
||||
WeightsType::VallE => None, // TODO(bt,2023-12-18): Does this mean speaker weights?
|
||||
WeightsType::ComfyUi => None, // NB: not used directly in inference. Included in other models.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-9
@@ -1,11 +1,12 @@
|
||||
use enums::by_table::generic_inference_jobs::inference_category::InferenceCategory;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::payloads::generic_inference_args::image_generation_payload::StableDiffusionArgs;
|
||||
use crate::payloads::generic_inference_args::lipsync_payload::LipsyncArgs;
|
||||
use crate::payloads::generic_inference_args::mocap_payload::MocapArgs;
|
||||
use crate::payloads::generic_inference_args::tts_payload::TTSArgs;
|
||||
use crate::payloads::generic_inference_args::videofilter_payload::RerenderArgs;
|
||||
use crate::payloads::generic_inference_args::image_generation_payload::StableDiffusionArgs;
|
||||
use crate::payloads::generic_inference_args::workflow_payload::WorkflowArgs;
|
||||
|
||||
/// Used to encode extra state for the `generic_inference_jobs` table.
|
||||
/// This should act somewhat like a serialized protobuf stored inside a record.
|
||||
@@ -49,6 +50,14 @@ pub enum InferenceCategoryAbbreviated {
|
||||
#[serde(rename = "mc")] // NB: DO NOT CHANGE. It could break live jobs. Renamed to be fewer bytes.
|
||||
#[serde(alias = "mocap")]
|
||||
Mocap,
|
||||
|
||||
#[serde(rename = "wf")] // NB: DO NOT CHANGE. It could break live jobs. Renamed to be fewer bytes.
|
||||
#[serde(alias = "workflow")]
|
||||
Workflow,
|
||||
|
||||
#[serde(rename = "fc")] // NB: DO NOT CHANGE. It could break live jobs. Renamed to be fewer bytes.
|
||||
#[serde(alias = "format_conversion")]
|
||||
FormatConversion,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
|
||||
@@ -106,7 +115,10 @@ pub enum PolymorphicInferenceArgs {
|
||||
Ig(StableDiffusionArgs),
|
||||
|
||||
// Mocap (Short name to save space when serializing.)
|
||||
Mc(MocapArgs)
|
||||
Mc(MocapArgs),
|
||||
|
||||
// ComfyUI (Short name to save space when serializing.)
|
||||
Cu(WorkflowArgs)
|
||||
}
|
||||
|
||||
impl GenericInferenceArgs {
|
||||
@@ -129,6 +141,8 @@ impl InferenceCategoryAbbreviated {
|
||||
InferenceCategory::VideoFilter => Self::VideoFilter,
|
||||
InferenceCategory::ImageGeneration => Self::ImageGeneration,
|
||||
InferenceCategory::Mocap => Self::Mocap,
|
||||
InferenceCategory::Workflow => Self::Workflow,
|
||||
InferenceCategory::FormatConversion => Self::FormatConversion,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,17 +154,20 @@ impl InferenceCategoryAbbreviated {
|
||||
Self::VideoFilter => InferenceCategory::VideoFilter,
|
||||
Self::ImageGeneration =>InferenceCategory::ImageGeneration,
|
||||
Self::Mocap => InferenceCategory::Mocap,
|
||||
Self::Workflow => InferenceCategory::Workflow,
|
||||
Self::FormatConversion => InferenceCategory::FormatConversion,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use tokens::tokens::{media_files::MediaFileToken, model_weights::ModelWeightToken};
|
||||
|
||||
use crate::payloads::generic_inference_args::generic_inference_args::{FundamentalFrequencyMethodForJob, GenericInferenceArgs, InferenceCategoryAbbreviated, PolymorphicInferenceArgs};
|
||||
use crate::payloads::generic_inference_args::image_generation_payload::StableDiffusionArgs;
|
||||
use crate::payloads::generic_inference_args::lipsync_payload::{LipsyncAnimationAudioSource, LipsyncAnimationImageSource, LipsyncArgs};
|
||||
use crate::payloads::generic_inference_args::tts_payload::TTSArgs;
|
||||
use crate::payloads::generic_inference_args::image_generation_payload::StableDiffusionArgs;
|
||||
use tokens::tokens::{model_weights::ModelWeightToken, media_files::MediaFileToken};
|
||||
|
||||
#[test]
|
||||
fn typical_lipsync_animation_args_serialize() {
|
||||
@@ -213,12 +230,14 @@ mod tests {
|
||||
let lora_upload_path = "lora_upload_path".to_string();
|
||||
let checkpoint = "checkpoint".to_string();
|
||||
let type_of_inference = "type_of_inference".to_string();
|
||||
let version: u32 = 0;
|
||||
|
||||
let args = GenericInferenceArgs {
|
||||
inference_category: Some(InferenceCategoryAbbreviated::ImageGeneration),
|
||||
args: Some(PolymorphicInferenceArgs::Ig(StableDiffusionArgs {
|
||||
maybe_sd_model_token: Some(sd_model_token),
|
||||
maybe_lora_model_token: Some(lora_model_token),
|
||||
maybe_sampler: Some("sampler".as_ref()),
|
||||
maybe_sampler: Some("sampler".to_string()),
|
||||
maybe_height: Some(512),
|
||||
maybe_width: Some(512),
|
||||
maybe_cfg_scale: Some(7),
|
||||
@@ -229,14 +248,15 @@ mod tests {
|
||||
maybe_seed: Some(seed),
|
||||
maybe_upload_path: Some(upload_path),
|
||||
maybe_lora_upload_path: Some(lora_upload_path),
|
||||
type_of_inference: type_of_inference,
|
||||
description: Some("Option".as_ref()),
|
||||
title: Some("Model Name".as_ref())
|
||||
type_of_inference,
|
||||
maybe_description: Some("Option".to_string()),
|
||||
maybe_name: Some("Model Name".to_string()),
|
||||
maybe_version: Some(version),
|
||||
})),
|
||||
};
|
||||
|
||||
let json = serde_json::ser::to_string(&args).unwrap();
|
||||
assert_eq!(json, r#"{"cat":"ig","args":{"Ig":{"vs":"video_media_token","is":"image_media_token","sd":"sd_model_token","lm":"lora_model_token","p":"prompt","ap":"a_prompt","np":"n_prompt","se":1,"mu":"upload_path","lu":"lora_upload_path"}}}"#.to_string());
|
||||
assert_eq!(json, r#"{"cat":"ig","args":{"Ig":{"sd":"sd_model_token","lm":"lora_model_token","w":512,"h":512,"s":"sampler","p":"prompt","np":"n_prompt","se":1,"mu":"upload_path","cf":7,"lu":"lora_upload_path","sa":25,"bc":1,"t":"type_of_inference","de":"Option","na":"Model Name","ve":0}}}"#.to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+12
-8
@@ -1,4 +1,4 @@
|
||||
use tokens::tokens::{model_weights::ModelWeightToken, media_files::MediaFileToken};
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
/// Video sources can be one of several:
|
||||
/// - F: media_files (todo)
|
||||
@@ -31,11 +31,11 @@ pub struct StableDiffusionArgs {
|
||||
|
||||
#[serde(rename = "w")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_width: Option<i32>,
|
||||
pub maybe_width: Option<u32>,
|
||||
|
||||
#[serde(rename = "h")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_height: Option<i32>,
|
||||
pub maybe_height: Option<u32>,
|
||||
|
||||
#[serde(rename = "s")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -59,7 +59,7 @@ pub struct StableDiffusionArgs {
|
||||
|
||||
#[serde(rename = "cf")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_cfg_scale: Option<i32>,
|
||||
pub maybe_cfg_scale: Option<u32>,
|
||||
|
||||
#[serde(rename = "lu")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -67,10 +67,10 @@ pub struct StableDiffusionArgs {
|
||||
|
||||
#[serde(rename = "sa")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_number_of_samples: Option<i32>,
|
||||
pub maybe_number_of_samples: Option<u32>,
|
||||
|
||||
#[serde(rename = "bc")]
|
||||
pub maybe_batch_count: Option<i32>,
|
||||
pub maybe_batch_count: Option<u32>,
|
||||
|
||||
#[serde(rename = "t")]
|
||||
pub type_of_inference: String,
|
||||
@@ -78,11 +78,15 @@ pub struct StableDiffusionArgs {
|
||||
// loRA / checkpoint description
|
||||
#[serde(rename = "de")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
pub maybe_description: Option<String>,
|
||||
// loRA / checkpoint name and description
|
||||
#[serde(rename = "na")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<String>
|
||||
pub maybe_name: Option<String>,
|
||||
|
||||
#[serde(rename = "ve")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_version: Option<u32>
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,3 +4,4 @@ pub mod tts_payload;
|
||||
pub mod videofilter_payload;
|
||||
pub mod image_generation_payload;
|
||||
pub mod mocap_payload;
|
||||
pub mod workflow_payload;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
use std::collections::HashMap;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(untagged)]
|
||||
pub enum NewValue {
|
||||
String(String),
|
||||
Float(f32),
|
||||
Int(i32),
|
||||
Bool(bool),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||
pub struct WorkflowArgs {
|
||||
#[serde(rename = "sd")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_sd_model: Option<ModelWeightToken>,
|
||||
|
||||
#[serde(rename = "lora")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_lora_model: Option<ModelWeightToken>,
|
||||
|
||||
#[serde(rename = "workflow_config")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_workflow_config: Option<ModelWeightToken>,
|
||||
|
||||
#[serde(rename = "json_modifications")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_json_modifications: Option<HashMap<String, NewValue>>,
|
||||
|
||||
#[serde(rename = "in")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_input_file: Option<MediaFileToken>,
|
||||
|
||||
#[serde(rename = "out")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_output_path: Option<String>,
|
||||
}
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
use anyhow::anyhow;
|
||||
use log::error;
|
||||
use sqlx::{Executor, MySql, QueryBuilder, Transaction};
|
||||
use sqlx::{MySql, QueryBuilder, Transaction};
|
||||
|
||||
use composite_identifiers::by_table::batch_generations::batch_generation_entity::BatchGenerationEntity;
|
||||
use errors::AnyhowResult;
|
||||
@@ -61,11 +61,12 @@ pub async fn insert_batch_generation_records<'a, 'b>(args: InsertBatchArgs<'a, '
|
||||
#[ignore]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use sqlx::mysql::MySqlPoolOptions;
|
||||
|
||||
use composite_identifiers::by_table::batch_generations::batch_generation_entity::BatchGenerationEntity;
|
||||
use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
|
||||
use crate::queries::batch_generations::insert_batch_generation_records::{insert_batch_generation_records, InsertBatchArgs};
|
||||
|
||||
async fn setup() -> sqlx::Pool<sqlx::MySql> {
|
||||
|
||||
+57
-135
@@ -88,18 +88,10 @@ pub async fn list_available_generic_inference_jobs(
|
||||
)
|
||||
-> AnyhowResult<Vec<AvailableInferenceJob>>
|
||||
{
|
||||
let model_types = args.maybe_scope_by_model_type
|
||||
.map(|types| types.clone())
|
||||
.unwrap_or(InferenceModelType::all_variants()); // NB: All model types
|
||||
|
||||
let inference_categories = args.maybe_scope_by_job_category
|
||||
.map(|types| types.clone())
|
||||
.unwrap_or(InferenceCategory::all_variants()); // NB: All categories
|
||||
|
||||
let query = if args.sort_by_priority {
|
||||
list_sorted_by_priority(args, model_types, inference_categories).await
|
||||
list_sorted_by_priority(args).await
|
||||
} else {
|
||||
list_sorted_by_id(args, model_types, inference_categories).await
|
||||
list_sorted_by_id(args).await
|
||||
};
|
||||
|
||||
let job_records = query?;
|
||||
@@ -156,16 +148,43 @@ pub async fn list_available_generic_inference_jobs(
|
||||
Ok(job_records)
|
||||
}
|
||||
|
||||
async fn list_sorted_by_id(args: ListAvailableGenericInferenceJobArgs<'_>, model_types: BTreeSet<InferenceModelType>, inference_categories: BTreeSet<InferenceCategory>) -> Result<Vec<AvailableInferenceJobRawInternal>, sqlx::Error> {
|
||||
async fn list_sorted_by_id(args: ListAvailableGenericInferenceJobArgs<'_>) -> Result<Vec<AvailableInferenceJobRawInternal>, sqlx::Error> {
|
||||
// NB: Can't be type checked because of WHERE IN clause with dynamic contents
|
||||
let mut query = core_query(&args);
|
||||
|
||||
// Also had to remove the following typing:
|
||||
//id as `id: crate::queries::generic_inference::job::_keys::GenericInferenceJobId`,
|
||||
//token AS `inference_job_token: tokens::jobs::inference::InferenceJobToken`,
|
||||
//inference_type as `inference_type: enums::workers::generic_inference_type::GenericInferenceType`,
|
||||
//creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
//status as `status: crate::column_types::job_status::JobStatus`,
|
||||
query.push_str(r#"
|
||||
ORDER BY id ASC
|
||||
LIMIT ?
|
||||
"#);
|
||||
|
||||
let query = sqlx::query_as::<_, AvailableInferenceJobRawInternal>(&query)
|
||||
.bind(args.is_debug_worker)
|
||||
.bind(args.num_records);
|
||||
|
||||
query.fetch_all(args.mysql_pool)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn list_sorted_by_priority(args: ListAvailableGenericInferenceJobArgs<'_>) -> Result<Vec<AvailableInferenceJobRawInternal>, sqlx::Error> {
|
||||
// NB: Can't be type checked because of WHERE IN clause with dynamic contents
|
||||
let mut query = core_query(&args);
|
||||
|
||||
query.push_str(r#"
|
||||
ORDER BY priority_level DESC, id ASC
|
||||
LIMIT ?
|
||||
"#);
|
||||
|
||||
let query = sqlx::query_as::<_, AvailableInferenceJobRawInternal>(&query)
|
||||
.bind(args.is_debug_worker)
|
||||
.bind(args.num_records);
|
||||
|
||||
query.fetch_all(args.mysql_pool)
|
||||
.await
|
||||
}
|
||||
|
||||
// TODO(bt,2024-01-25): Make QueryBuilder
|
||||
fn core_query(args: &ListAvailableGenericInferenceJobArgs<'_>) -> String {
|
||||
// NB: Can't be type checked because of WHERE IN clause with dynamic contents
|
||||
let mut query = r#"
|
||||
SELECT
|
||||
id,
|
||||
@@ -207,24 +226,9 @@ SELECT
|
||||
retry_at,
|
||||
NOW() as database_clock
|
||||
|
||||
FROM generic_inference_jobs"#.to_string();
|
||||
FROM generic_inference_jobs
|
||||
|
||||
query.push_str(&format!(r#"
|
||||
WHERE
|
||||
(
|
||||
maybe_model_type IN ({})
|
||||
)
|
||||
"#, model_type_predicate(&model_types)));
|
||||
|
||||
query.push_str(&format!(r#"
|
||||
and
|
||||
(
|
||||
inference_category IN ({})
|
||||
)
|
||||
"#, inference_category_predicate(&inference_categories)));
|
||||
|
||||
query.push_str(r#"
|
||||
AND
|
||||
WHERE
|
||||
(
|
||||
status IN ("pending", "attempt_failed")
|
||||
)
|
||||
@@ -238,111 +242,29 @@ FROM generic_inference_jobs"#.to_string();
|
||||
(
|
||||
is_debug_request = ?
|
||||
)
|
||||
ORDER BY id ASC
|
||||
LIMIT ?
|
||||
"#);
|
||||
"#.to_string();
|
||||
|
||||
let query = sqlx::query_as::<_, AvailableInferenceJobRawInternal>(&query)
|
||||
.bind(args.is_debug_worker)
|
||||
.bind(args.num_records);
|
||||
if let Some(model_types) = args.maybe_scope_by_model_type {
|
||||
query.push_str(&format!(r#"
|
||||
AND
|
||||
(
|
||||
maybe_model_type IN ({})
|
||||
)
|
||||
"#, model_type_predicate(model_types)));
|
||||
}
|
||||
|
||||
query.fetch_all(args.mysql_pool)
|
||||
.await
|
||||
if let Some(inference_categories) = args.maybe_scope_by_job_category {
|
||||
query.push_str(&format!(r#"
|
||||
AND
|
||||
(
|
||||
inference_category IN ({})
|
||||
)
|
||||
"#, inference_category_predicate(&inference_categories)));
|
||||
}
|
||||
|
||||
query
|
||||
}
|
||||
|
||||
async fn list_sorted_by_priority(args: ListAvailableGenericInferenceJobArgs<'_>, model_types: BTreeSet<InferenceModelType>, inference_categories: BTreeSet<InferenceCategory>) -> Result<Vec<AvailableInferenceJobRawInternal>, sqlx::Error> {
|
||||
// NB: Can't be type checked because of WHERE IN clause with dynamic contents
|
||||
|
||||
// Also had to remove the following typing:
|
||||
//id as `id: crate::queries::generic_inference::job::_keys::GenericInferenceJobId`,
|
||||
//token AS `inference_job_token: tokens::jobs::inference::InferenceJobToken`,
|
||||
//inference_category as `inference_category: enums::workers::generic_inference_type::GenericInferenceType`,
|
||||
//creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
//status as `status: crate::column_types::job_status::JobStatus`,
|
||||
|
||||
let mut query = r#"
|
||||
SELECT
|
||||
id,
|
||||
token as inference_job_token,
|
||||
uuid_idempotency_token,
|
||||
|
||||
inference_category,
|
||||
maybe_model_type,
|
||||
maybe_model_token,
|
||||
|
||||
maybe_input_source_token,
|
||||
maybe_input_source_token_type,
|
||||
|
||||
maybe_inference_args,
|
||||
maybe_raw_inference_text,
|
||||
|
||||
maybe_creator_user_token,
|
||||
maybe_creator_anonymous_visitor_token,
|
||||
creator_ip_address,
|
||||
creator_set_visibility,
|
||||
|
||||
status,
|
||||
attempt_count,
|
||||
|
||||
priority_level,
|
||||
is_keepalive_required,
|
||||
|
||||
is_from_premium_user,
|
||||
is_from_api_user,
|
||||
is_for_twitch,
|
||||
|
||||
max_duration_seconds,
|
||||
|
||||
is_debug_request,
|
||||
maybe_routing_tag,
|
||||
|
||||
created_at,
|
||||
updated_at,
|
||||
retry_at,
|
||||
NOW() as database_clock
|
||||
|
||||
FROM generic_inference_jobs"#.to_string();
|
||||
|
||||
query.push_str(&format!(r#"
|
||||
WHERE
|
||||
(
|
||||
maybe_model_type IN ({})
|
||||
)
|
||||
"#, model_type_predicate(&model_types)));
|
||||
|
||||
query.push_str(&format!(r#"
|
||||
and
|
||||
(
|
||||
inference_category IN ({})
|
||||
)
|
||||
"#, inference_category_predicate(&inference_categories)));
|
||||
|
||||
query.push_str(r#"
|
||||
AND
|
||||
(
|
||||
status IN ("pending", "attempt_failed")
|
||||
)
|
||||
AND
|
||||
(
|
||||
retry_at IS NULL
|
||||
OR
|
||||
retry_at < CURRENT_TIMESTAMP
|
||||
)
|
||||
AND
|
||||
(
|
||||
is_debug_request = ?
|
||||
)
|
||||
ORDER BY priority_level DESC, id ASC
|
||||
LIMIT ?
|
||||
"#);
|
||||
|
||||
let query = sqlx::query_as::<_, AvailableInferenceJobRawInternal>(&query)
|
||||
.bind(args.is_debug_worker)
|
||||
.bind(args.num_records);
|
||||
|
||||
query.fetch_all(args.mysql_pool)
|
||||
.await
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(sqlx::FromRow)]
|
||||
|
||||
+5
-1
@@ -181,6 +181,8 @@ fn raw_record_to_public_result(record: RawGenericInferenceJobStatus) -> GenericI
|
||||
InferenceCategory::VideoFilter => Some("Video Filter"),
|
||||
InferenceCategory::ImageGeneration => Some("Image Generation"),
|
||||
InferenceCategory::Mocap => Some("Mocap"),
|
||||
InferenceCategory::Workflow => Some("Workflow"),
|
||||
InferenceCategory::FormatConversion => Some("format conversion"),
|
||||
};
|
||||
|
||||
// NB: A bit of a hack. We store TTS results with a full path.
|
||||
@@ -192,6 +194,8 @@ fn raw_record_to_public_result(record: RawGenericInferenceJobStatus) -> GenericI
|
||||
InferenceCategory::VideoFilter => (true, record.maybe_media_file_public_bucket_directory_hash.as_deref()),
|
||||
InferenceCategory::ImageGeneration => (true, record.maybe_media_file_public_bucket_directory_hash.as_deref()),
|
||||
InferenceCategory::Mocap => (true, record.maybe_media_file_public_bucket_directory_hash.as_deref()),
|
||||
InferenceCategory::Workflow => (true, record.maybe_media_file_public_bucket_directory_hash.as_deref()),
|
||||
InferenceCategory::FormatConversion => (true, record.maybe_media_file_public_bucket_directory_hash.as_deref()),
|
||||
};
|
||||
|
||||
// NB: We've moved voice conversion out of their own table and into media_files
|
||||
@@ -219,7 +223,7 @@ fn raw_record_to_public_result(record: RawGenericInferenceJobStatus) -> GenericI
|
||||
maybe_media_file_public_bucket_prefix: record.maybe_media_file_public_bucket_prefix.clone(),
|
||||
maybe_media_file_public_bucket_extension: record.maybe_media_file_public_bucket_extension.clone(),
|
||||
public_bucket_location_is_hash: bucket_path_is_hash,
|
||||
maybe_successfully_completed_at: record.maybe_successfully_completed_at.clone(),
|
||||
maybe_successfully_completed_at: record.maybe_successfully_completed_at,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
+10
@@ -3,6 +3,7 @@ use sqlx::MySqlPool;
|
||||
|
||||
use enums::by_table::generic_inference_jobs::inference_category::InferenceCategory;
|
||||
use enums::by_table::generic_inference_jobs::inference_input_source_token_type::InferenceInputSourceTokenType;
|
||||
use enums::by_table::generic_inference_jobs::inference_job_type::InferenceJobType;
|
||||
use enums::by_table::generic_inference_jobs::inference_model_type::InferenceModelType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
@@ -15,6 +16,11 @@ use crate::payloads::generic_inference_args::generic_inference_args::GenericInfe
|
||||
pub struct InsertGenericInferenceArgs<'a> {
|
||||
pub uuid_idempotency_token: &'a str,
|
||||
|
||||
// NB: This will eventually take the place of "inference category" and "maybe model type", since the latter two are
|
||||
// used entirely inconsistently for job dispatching (especially "inference category"). This should always be 1:1 with
|
||||
// a concrete job type.
|
||||
pub job_type: InferenceJobType,
|
||||
|
||||
pub inference_category: InferenceCategory,
|
||||
pub maybe_model_type: Option<InferenceModelType>,
|
||||
pub maybe_model_token: Option<&'a str>,
|
||||
@@ -68,6 +74,8 @@ SET
|
||||
token = ?,
|
||||
uuid_idempotency_token = ?,
|
||||
|
||||
job_type = ?,
|
||||
|
||||
inference_category = ?,
|
||||
maybe_model_type = ?,
|
||||
maybe_model_token = ?,
|
||||
@@ -97,6 +105,8 @@ SET
|
||||
job_token.as_str(),
|
||||
args.uuid_idempotency_token,
|
||||
|
||||
args.job_type.to_str(),
|
||||
|
||||
args.inference_category.to_str(),
|
||||
|
||||
args.maybe_model_type.map(|t| t.to_str()),
|
||||
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
use anyhow::anyhow;
|
||||
use sqlx;
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
use enums::by_table::generic_synthetic_ids::id_category::IdCategory;
|
||||
use enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory;
|
||||
use enums::by_table::media_files::media_file_origin_model_type::MediaFileOriginModelType;
|
||||
use enums::by_table::media_files::media_file_origin_product_category::MediaFileOriginProductCategory;
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
use crate::queries::generic_inference::job::list_available_generic_inference_jobs::AvailableInferenceJob;
|
||||
use crate::queries::generic_synthetic_ids::transactional_increment_generic_synthetic_id::transactional_increment_generic_synthetic_id;
|
||||
|
||||
pub struct InsertArgs<'a> {
|
||||
pub pool: &'a MySqlPool,
|
||||
pub job: &'a AvailableInferenceJob,
|
||||
|
||||
pub maybe_mime_type: Option<&'a str>,
|
||||
pub file_size_bytes: u64,
|
||||
pub sha256_checksum: &'a str,
|
||||
// TODO: Media duration.
|
||||
//pub duration_millis: u64,
|
||||
|
||||
pub public_bucket_directory_hash: &'a str,
|
||||
pub maybe_public_bucket_prefix: Option<&'a str>,
|
||||
pub maybe_public_bucket_extension: Option<&'a str>,
|
||||
|
||||
pub is_on_prem: bool,
|
||||
pub worker_hostname: &'a str,
|
||||
pub worker_cluster: &'a str,
|
||||
pub media_file_type: MediaFileType,
|
||||
}
|
||||
|
||||
pub async fn insert_media_file_from_comfy_ui(args: InsertArgs<'_>) -> AnyhowResult<(MediaFileToken, u64)>
|
||||
{
|
||||
let result_token = MediaFileToken::generate();
|
||||
|
||||
let mut maybe_creator_file_synthetic_id : Option<u64> = None;
|
||||
let mut maybe_creator_category_synthetic_id : Option<u64> = None;
|
||||
|
||||
let mut transaction = args.pool.begin().await?;
|
||||
|
||||
if let Some(creator_user_token) = args.job.maybe_creator_user_token.as_deref() {
|
||||
let user_token = UserToken::new_from_str(creator_user_token);
|
||||
|
||||
let next_media_file_id = transactional_increment_generic_synthetic_id(
|
||||
&user_token,
|
||||
IdCategory::MediaFile,
|
||||
&mut transaction
|
||||
).await?;
|
||||
|
||||
let next_comfy_ui_id = transactional_increment_generic_synthetic_id(
|
||||
&user_token,
|
||||
IdCategory::WorkflowResult,
|
||||
&mut transaction
|
||||
).await?;
|
||||
|
||||
maybe_creator_file_synthetic_id = Some(next_media_file_id);
|
||||
maybe_creator_category_synthetic_id = Some(next_comfy_ui_id);
|
||||
}
|
||||
|
||||
const ORIGIN_CATEGORY : MediaFileOriginCategory = MediaFileOriginCategory::Inference;
|
||||
const ORIGIN_PRODUCT_CATEGORY : MediaFileOriginProductCategory = MediaFileOriginProductCategory::Workflow;
|
||||
const ORIGIN_MODEL_TYPE : MediaFileOriginModelType = MediaFileOriginModelType::ComfyUi;
|
||||
|
||||
let record_id = {
|
||||
let query_result = sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO media_files
|
||||
SET
|
||||
token = ?,
|
||||
|
||||
origin_category = ?,
|
||||
origin_product_category = ?,
|
||||
maybe_origin_model_type = ?,
|
||||
|
||||
media_type = ?,
|
||||
maybe_mime_type = ?,
|
||||
file_size_bytes = ?,
|
||||
|
||||
checksum_sha2 = ?,
|
||||
|
||||
public_bucket_directory_hash = ?,
|
||||
maybe_public_bucket_prefix = ?,
|
||||
maybe_public_bucket_extension = ?,
|
||||
|
||||
maybe_creator_user_token = ?,
|
||||
maybe_creator_anonymous_visitor_token = ?,
|
||||
creator_ip_address = ?,
|
||||
|
||||
creator_set_visibility = ?,
|
||||
|
||||
maybe_creator_file_synthetic_id = ?,
|
||||
maybe_creator_category_synthetic_id = ?,
|
||||
|
||||
is_generated_on_prem = ?,
|
||||
generated_by_worker = ?,
|
||||
generated_by_cluster = ?
|
||||
|
||||
"#,
|
||||
result_token.as_str(),
|
||||
|
||||
ORIGIN_CATEGORY.to_str(),
|
||||
ORIGIN_PRODUCT_CATEGORY.to_str(),
|
||||
ORIGIN_MODEL_TYPE.to_str(),
|
||||
|
||||
args.media_file_type.to_str(),
|
||||
args.maybe_mime_type,
|
||||
args.file_size_bytes,
|
||||
|
||||
args.sha256_checksum,
|
||||
|
||||
args.public_bucket_directory_hash,
|
||||
args.maybe_public_bucket_prefix,
|
||||
args.maybe_public_bucket_extension,
|
||||
|
||||
args.job.maybe_creator_user_token,
|
||||
args.job.maybe_creator_anonymous_visitor_token,
|
||||
args.job.creator_ip_address,
|
||||
|
||||
args.job.creator_set_visibility.to_str(),
|
||||
|
||||
maybe_creator_file_synthetic_id,
|
||||
maybe_creator_category_synthetic_id,
|
||||
|
||||
args.is_on_prem,
|
||||
args.worker_hostname,
|
||||
args.worker_cluster
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await;
|
||||
|
||||
let record_id = match query_result {
|
||||
Ok(res) => {
|
||||
res.last_insert_id()
|
||||
},
|
||||
Err(err) => {
|
||||
// TODO: handle better
|
||||
//transaction.rollback().await?;
|
||||
return Err(anyhow!("Mysql error: {:?}", err));
|
||||
}
|
||||
};
|
||||
|
||||
record_id
|
||||
};
|
||||
|
||||
transaction.commit().await?;
|
||||
|
||||
Ok((result_token, record_id))
|
||||
}
|
||||
+112
-98
@@ -9,164 +9,178 @@ use enums::by_table::media_files::media_file_origin_product_category::MediaFileO
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::weight_model_weight;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
use crate::queries::generic_inference::job::list_available_generic_inference_jobs::AvailableInferenceJob;
|
||||
use crate::queries::generic_synthetic_ids::transactional_increment_generic_synthetic_id::transactional_increment_generic_synthetic_id;
|
||||
|
||||
// thought about this it seems like this can be a bit more geneneric instead of having this we can ...
|
||||
pub struct InsertArgs<'a> {
|
||||
pub pool: &'a MySqlPool,
|
||||
pub job: &'a AvailableInferenceJob,
|
||||
|
||||
pub maybe_mime_type: Option<&'a str>,
|
||||
pub file_size_bytes: u64,
|
||||
pub sha256_checksum: &'a str,
|
||||
pub media_type: MediaFileType,
|
||||
|
||||
// Origin and categorization
|
||||
pub origin_category: MediaFileOriginCategory,
|
||||
pub origin_product_category: MediaFileOriginProductCategory,
|
||||
pub maybe_origin_model_type: Option<MediaFileOriginModelType>,
|
||||
pub maybe_origin_model_token: Option<ModelWeightToken>,
|
||||
pub maybe_origin_filename: Option<String>,
|
||||
|
||||
// Generation flags and media details
|
||||
pub is_batch_generated: bool, // Assuming you set this in your application logic
|
||||
|
||||
pub maybe_mime_type: Option<&'a str>,
|
||||
|
||||
pub file_size_bytes: u64,
|
||||
pub maybe_duration_millis: Option<u64>,
|
||||
pub maybe_audio_encoding: Option<&'a str>,
|
||||
pub maybe_video_encoding: Option<&'a str>,
|
||||
pub maybe_frame_width: Option<u32>,
|
||||
pub maybe_frame_height: Option<u32>,
|
||||
pub checksum_sha2: &'a str,
|
||||
|
||||
// Storage details
|
||||
pub public_bucket_directory_hash: &'a str,
|
||||
pub maybe_public_bucket_prefix: Option<&'a str>,
|
||||
pub maybe_public_bucket_extension: Option<&'a str>,
|
||||
pub extra_file_modification_info: Option<&'a str>, // Assuming TEXT type can be represented by &str
|
||||
|
||||
pub is_on_prem: bool,
|
||||
pub maybe_creator_file_synthetic_id_category: IdCategory,
|
||||
pub maybe_creator_category_synthetic_id_category: IdCategory,
|
||||
|
||||
pub worker_hostname: &'a str,
|
||||
pub worker_cluster: &'a str,
|
||||
|
||||
pub maybe_creator_user_token: Option<&'a UserToken>,
|
||||
pub maybe_creator_anonymous_visitor_token: Option<&'a AnonymousVisitorTrackingToken>,
|
||||
pub creator_ip_address: &'a str,
|
||||
pub creator_set_visibility: Visibility,
|
||||
pub upload_type: UploadType,
|
||||
pub media_file_type: MediaFileType,
|
||||
pub duration_millis: u64,
|
||||
|
||||
pub media_file_origin: MediaFileOriginProductCategory,
|
||||
pub media_file_origin_product_category: MediaFileOriginProductCategory,
|
||||
pub media_file_origin_model_type: Mediafile,
|
||||
pub maybe_origin_filename: String,
|
||||
pub maybe_origin_model_token:WeightsModelToken
|
||||
// Modification and generation info
|
||||
pub maybe_mod_user_token: Option<&'a UserToken>,
|
||||
pub is_generated_on_prem: bool,
|
||||
pub generated_by_worker: Option<&'a str>,
|
||||
pub generated_by_cluster: Option<&'a str>,
|
||||
}
|
||||
|
||||
pub async fn insert_media_file_generic(
|
||||
args: InsertArgs<'_>
|
||||
) -> AnyhowResult<(MediaFileToken, u64)>
|
||||
{
|
||||
|
||||
let result_token = MediaFileToken::generate();
|
||||
|
||||
let mut maybe_creator_file_synthetic_id : Option<u64> = None;
|
||||
let mut maybe_creator_category_synthetic_id : Option<u64> = None;
|
||||
|
||||
let mut transaction = args.pool.begin().await?;
|
||||
|
||||
|
||||
// create a user token
|
||||
if let Some(creator_user_token) = args.job.maybe_creator_user_token.as_deref() {
|
||||
let user_token = UserToken::new_from_str(creator_user_token);
|
||||
|
||||
|
||||
let next_media_file_id = transactional_increment_generic_synthetic_id(
|
||||
&user_token,
|
||||
IdCategory::MediaFile,
|
||||
args.maybe_creator_file_synthetic_id_category,
|
||||
&mut transaction
|
||||
).await?;
|
||||
|
||||
let next_lipsync_id = transactional_increment_generic_synthetic_id(
|
||||
let category_id = transactional_increment_generic_synthetic_id(
|
||||
&user_token,
|
||||
IdCategory::ZeroShotTtsResult,
|
||||
args.maybe_creator_category_synthetic_id_category,
|
||||
&mut transaction
|
||||
).await?;
|
||||
|
||||
maybe_creator_file_synthetic_id = Some(next_media_file_id);
|
||||
maybe_creator_category_synthetic_id = Some(next_lipsync_id);
|
||||
maybe_creator_category_synthetic_id = Some(category_id);
|
||||
}
|
||||
|
||||
// TODO: Ask if it make sense to use ONE function to do the insert * I agree it does .... use insert media file generic and eventually remove all this.
|
||||
// Since fill this out apart of the funtion this seems like the only thing to change.
|
||||
const ORIGIN_CATEGORY : MediaFileOriginCategory = MediaFileOriginCategory::Inference;
|
||||
const ORIGIN_PRODUCT_CATEGORY : MediaFileOriginProductCategory = MediaFileOriginProductCategory::ZeroShotVoice;
|
||||
const ORIGIN_MODEL_TYPE : MediaFileOriginModelType = MediaFileOriginModelType::VallEX;
|
||||
const MEDIA_TYPE : MediaFileType = MediaFileType::Audio;
|
||||
let query_result = sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO media_files
|
||||
SET
|
||||
token = ?,
|
||||
media_type = ?,
|
||||
|
||||
let record_id = {
|
||||
let query_result = sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO media_files
|
||||
SET
|
||||
token = ?,
|
||||
origin_category = ?,
|
||||
origin_product_category = ?,
|
||||
maybe_origin_model_type = ?,
|
||||
maybe_origin_model_token = ?,
|
||||
maybe_origin_filename = ?,
|
||||
|
||||
origin_category = ?,
|
||||
origin_product_category = ?,
|
||||
maybe_origin_model_type = ?,
|
||||
is_batch_generated = ?,
|
||||
|
||||
media_type = ?,
|
||||
maybe_mime_type = ?,
|
||||
file_size_bytes = ?,
|
||||
maybe_mime_type = ?,
|
||||
file_size_bytes = ?,
|
||||
maybe_duration_millis = ?,
|
||||
maybe_audio_encoding = ?,
|
||||
maybe_video_encoding = ?,
|
||||
maybe_frame_width = ?,
|
||||
maybe_frame_height = ?,
|
||||
checksum_sha2 = ?,
|
||||
|
||||
checksum_sha2 = ?,
|
||||
public_bucket_directory_hash = ?,
|
||||
maybe_public_bucket_prefix = ?,
|
||||
maybe_public_bucket_extension = ?,
|
||||
extra_file_modification_info = ?,
|
||||
|
||||
public_bucket_directory_hash = ?,
|
||||
maybe_public_bucket_prefix = ?,
|
||||
maybe_public_bucket_extension = ?,
|
||||
maybe_creator_user_token = ?,
|
||||
maybe_creator_anonymous_visitor_token = ?,
|
||||
|
||||
maybe_creator_user_token = ?,
|
||||
maybe_creator_anonymous_visitor_token = ?,
|
||||
creator_ip_address = ?,
|
||||
creator_ip_address = ?,
|
||||
creator_set_visibility = ?,
|
||||
|
||||
creator_set_visibility = ?,
|
||||
maybe_creator_file_synthetic_id = ?,
|
||||
maybe_creator_category_synthetic_id = ?,
|
||||
|
||||
maybe_creator_file_synthetic_id = ?,
|
||||
maybe_creator_category_synthetic_id = ?,
|
||||
maybe_mod_user_token = ?,
|
||||
is_generated_on_prem = ?,
|
||||
generated_by_worker = ?,
|
||||
generated_by_cluster = ?
|
||||
"#,
|
||||
result_token,
|
||||
args.media_type.to_str(),
|
||||
|
||||
is_generated_on_prem = ?,
|
||||
generated_by_worker = ?,
|
||||
generated_by_cluster = ?
|
||||
args.origin_category.to_str(),
|
||||
args.origin_product_category.to_str(),
|
||||
args.maybe_origin_model_type.map(|e| e.to_str()),
|
||||
args.maybe_origin_model_token.map(|e| e.to_string()),
|
||||
args.maybe_origin_filename,
|
||||
|
||||
"#,
|
||||
result_token.as_str(),
|
||||
args.is_batch_generated,
|
||||
|
||||
ORIGIN_CATEGORY.to_str(),
|
||||
ORIGIN_PRODUCT_CATEGORY.to_str(),
|
||||
ORIGIN_MODEL_TYPE.to_str(),
|
||||
args.maybe_mime_type,
|
||||
args.file_size_bytes,
|
||||
args.maybe_duration_millis,
|
||||
args.maybe_audio_encoding,
|
||||
args.maybe_video_encoding,
|
||||
args.maybe_frame_width,
|
||||
args.maybe_frame_height,
|
||||
args.checksum_sha2,
|
||||
|
||||
MEDIA_TYPE.to_str(),
|
||||
args.maybe_mime_type,
|
||||
args.file_size_bytes,
|
||||
args.public_bucket_directory_hash,
|
||||
args.maybe_public_bucket_prefix,
|
||||
args.maybe_public_bucket_extension,
|
||||
args.extra_file_modification_info,
|
||||
|
||||
args.sha256_checksum,
|
||||
args.job.maybe_creator_user_token.as_deref(),
|
||||
args.job.maybe_creator_anonymous_visitor_token.as_deref(),
|
||||
|
||||
args.public_bucket_directory_hash,
|
||||
args.maybe_public_bucket_prefix,
|
||||
args.maybe_public_bucket_extension,
|
||||
args.job.creator_ip_address,
|
||||
args.job.creator_set_visibility.to_str(),
|
||||
|
||||
args.job.maybe_creator_user_token,
|
||||
args.job.maybe_creator_anonymous_visitor_token,
|
||||
args.job.creator_ip_address,
|
||||
maybe_creator_file_synthetic_id,
|
||||
maybe_creator_category_synthetic_id,
|
||||
|
||||
args.job.creator_set_visibility.to_str(),
|
||||
args.maybe_mod_user_token,
|
||||
args.is_generated_on_prem,
|
||||
args.generated_by_worker,
|
||||
args.generated_by_cluster
|
||||
).execute(&mut *transaction).await;
|
||||
|
||||
maybe_creator_file_synthetic_id,
|
||||
maybe_creator_category_synthetic_id,
|
||||
|
||||
args.is_on_prem,
|
||||
args.worker_hostname,
|
||||
args.worker_cluster
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await;
|
||||
|
||||
let record_id = match query_result {
|
||||
Ok(res) => {
|
||||
res.last_insert_id()
|
||||
},
|
||||
Err(err) => {
|
||||
// TODO: handle better
|
||||
//transaction.rollback().await?;
|
||||
return Err(anyhow!("Mysql error: {:?}", err));
|
||||
}
|
||||
};
|
||||
|
||||
record_id
|
||||
let record_id = match query_result {
|
||||
Ok(res) => res.last_insert_id(),
|
||||
Err(err) => {
|
||||
// TODO: handle better
|
||||
//transaction.rollback().await?;
|
||||
return Err(anyhow!("Mysql error: {:?}", err));
|
||||
}
|
||||
};
|
||||
|
||||
transaction.commit().await?;
|
||||
|
||||
Ok((result_token, record_id))
|
||||
}
|
||||
@@ -6,3 +6,5 @@ pub mod insert_media_file_from_tacotron2;
|
||||
pub mod insert_media_file_from_voice_conversion;
|
||||
pub mod insert_media_file_from_zero_shot_tts;
|
||||
pub mod insert_media_file_from_mocapnet;
|
||||
pub mod insert_media_file_generic;
|
||||
pub mod insert_media_file_from_comfy_ui;
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
// NB: Incrementally getting rid of build warnings...
|
||||
#![forbid(unused_imports)]
|
||||
#![forbid(unused_mut)]
|
||||
#![forbid(unused_variables)]
|
||||
|
||||
use anyhow::anyhow;
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct MediaFileForInference {
|
||||
pub token: MediaFileToken,
|
||||
|
||||
pub media_type: MediaFileType,
|
||||
|
||||
pub maybe_creator_user_token: Option<UserToken>,
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub public_bucket_directory_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct MediaFileRaw {
|
||||
pub token: MediaFileToken,
|
||||
|
||||
pub media_type: MediaFileType,
|
||||
|
||||
pub maybe_creator_user_token: Option<UserToken>,
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub public_bucket_directory_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn get_media_file_for_inference(
|
||||
media_file_token: &MediaFileToken,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<Option<MediaFileForInference>> {
|
||||
|
||||
let record = select_record(media_file_token, mysql_pool).await;
|
||||
|
||||
let record = match record {
|
||||
Ok(record) => record,
|
||||
Err(ref err) => {
|
||||
return match err {
|
||||
sqlx::Error::RowNotFound => Ok(None),
|
||||
_ => Err(anyhow!("database error: {:?}", err)),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Ok(Some(MediaFileForInference {
|
||||
token: record.token,
|
||||
media_type: record.media_type,
|
||||
maybe_creator_user_token: record.maybe_creator_user_token,
|
||||
creator_set_visibility: record.creator_set_visibility,
|
||||
public_bucket_directory_hash: record.public_bucket_directory_hash,
|
||||
maybe_public_bucket_prefix: record.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: record.maybe_public_bucket_extension,
|
||||
}))
|
||||
}
|
||||
|
||||
async fn select_record(
|
||||
media_file_token: &MediaFileToken,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> Result<MediaFileRaw, sqlx::Error> {
|
||||
sqlx::query_as!(
|
||||
MediaFileRaw,
|
||||
r#"
|
||||
SELECT
|
||||
m.token as `token: tokens::tokens::media_files::MediaFileToken`,
|
||||
|
||||
m.media_type as `media_type: enums::by_table::media_files::media_file_type::MediaFileType`,
|
||||
|
||||
m.maybe_creator_user_token as `maybe_creator_user_token: tokens::tokens::users::UserToken`,
|
||||
m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
|
||||
m.public_bucket_directory_hash,
|
||||
m.maybe_public_bucket_prefix,
|
||||
m.maybe_public_bucket_extension
|
||||
|
||||
FROM media_files AS m
|
||||
WHERE
|
||||
m.token = ?
|
||||
"#,
|
||||
media_file_token
|
||||
)
|
||||
.fetch_one(mysql_pool)
|
||||
.await
|
||||
}
|
||||
@@ -212,8 +212,17 @@ LEFT OUTER JOIN entity_stats
|
||||
}
|
||||
|
||||
match view_as {
|
||||
ViewAs::Moderator => {}
|
||||
ViewAs::Author | ViewAs::AnotherUser => {
|
||||
ViewAs::Moderator | ViewAs::Author => {
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
} else {
|
||||
query_builder.push(" AND ");
|
||||
}
|
||||
// NB(bt): Actually, mods don't want to see deleted files. We'll improve the moderator UI later.
|
||||
query_builder.push(" m.user_deleted_at IS NULL AND m.mod_deleted_at IS NULL ");
|
||||
}
|
||||
ViewAs::AnotherUser => {
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
|
||||
@@ -202,10 +202,10 @@ LEFT OUTER JOIN entity_stats
|
||||
}
|
||||
|
||||
match view_as {
|
||||
ViewAs::Author => {
|
||||
ViewAs::Author | ViewAs::Moderator => {
|
||||
// NB(bt): Actually, mods don't want to see deleted files. We'll improve the moderator UI later.
|
||||
query_builder.push(" AND m.user_deleted_at IS NULL AND m.mod_deleted_at IS NULL ");
|
||||
}
|
||||
ViewAs::Moderator => {}
|
||||
ViewAs::AnotherUser => {
|
||||
query_builder.push(" AND m.user_deleted_at IS NULL AND m.mod_deleted_at IS NULL ");
|
||||
// FIXME: Binding shouldn't require to_str().
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
pub mod create;
|
||||
pub mod delete_media_file;
|
||||
pub mod get_media_file;
|
||||
pub mod get_media_file_for_inference;
|
||||
pub mod list;
|
||||
pub mod update_media_file;
|
||||
|
||||
@@ -21,21 +21,17 @@ pub struct CreateModelWeightsArgs<'a> {
|
||||
pub maybe_last_update_user_token: Option<String>,
|
||||
pub original_download_url: Option<String>,
|
||||
pub original_filename: Option<String>,
|
||||
pub file_size_bytes: i32,
|
||||
pub file_size_bytes: u64,
|
||||
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 cached_user_ratings_total_count: u32,
|
||||
//pub cached_user_ratings_positive_count: u32,
|
||||
//pub cached_user_ratings_negative_count: u32,
|
||||
//pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
pub version: i32,
|
||||
pub version: u32,
|
||||
pub mysql_pool: &'a MySqlPool,
|
||||
}
|
||||
|
||||
pub async fn create_weight(args: CreateModelWeightsArgs<'_>) -> AnyhowResult<ModelWeightToken> {
|
||||
let model_weights_token = ModelWeightToken::generate();
|
||||
|
||||
let transaction = args.mysql_pool.begin().await?;
|
||||
let query_result = sqlx
|
||||
::query!(
|
||||
@@ -78,16 +74,12 @@ pub async fn create_weight(args: CreateModelWeightsArgs<'_>) -> AnyhowResult<Mod
|
||||
args.public_bucket_hash,
|
||||
args.maybe_public_bucket_prefix,
|
||||
args.maybe_public_bucket_extension,
|
||||
//args.cached_user_ratings_total_count,
|
||||
//args.cached_user_ratings_positive_count,
|
||||
//args.cached_user_ratings_negative_count,
|
||||
//args.maybe_cached_user_ratings_ratio,
|
||||
args.version
|
||||
)
|
||||
.execute(args.mysql_pool).await;
|
||||
|
||||
match query_result {
|
||||
Ok(_) => { Ok(model_weights_token) }
|
||||
Ok(_) => { Ok(args.token.clone()) }
|
||||
Err(err) => {
|
||||
transaction.rollback().await?;
|
||||
warn!("Transaction failure: {:?}", err);
|
||||
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
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 ModelWeightForLegacyTtsEnqueue {
|
||||
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<ModelWeightForLegacyTtsEnqueue>> {
|
||||
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<ModelWeightForLegacyTtsEnqueue>> {
|
||||
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));
|
||||
}
|
||||
};
|
||||
|
||||
Ok(Some(ModelWeightForLegacyTtsEnqueue {
|
||||
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>>,
|
||||
}
|
||||
+296
@@ -0,0 +1,296 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use log::error;
|
||||
use sqlx::{MySql, MySqlPool};
|
||||
use sqlx::pool::PoolConnection;
|
||||
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums::common::vocoder_type::VocoderType;
|
||||
use tokens::tokens::{model_weights::ModelWeightToken, users::UserToken};
|
||||
|
||||
use crate::helpers::boolean_converters::nullable_i8_to_bool_default_false;
|
||||
use crate::queries::tts::tts_models::get_tts_model_for_inference_improved::{CustomVocoderFields, TtsModelForInferenceError};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ModelWeightForLegacyTtsInference {
|
||||
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<String>,
|
||||
pub maybe_text_pipeline_type: Option<String>,
|
||||
|
||||
// Joined custom vocoder fields
|
||||
pub maybe_custom_vocoder: Option<CustomVocoderFields>,
|
||||
|
||||
pub use_default_mel_multiply_factor: bool,
|
||||
pub maybe_custom_mel_multiply_factor: Option<f64>,
|
||||
|
||||
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_inference(
|
||||
weight_token: &ModelWeightToken,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> Result<Option<ModelWeightForLegacyTtsInference>, TtsModelForInferenceError> {
|
||||
let mut connection = mysql_pool.acquire()
|
||||
.await
|
||||
.map_err(|err| {
|
||||
error!("Error acquiring db connection from pool: {:?}", err);
|
||||
TtsModelForInferenceError::DatabaseError {
|
||||
reason: format!("Mysql connection error: {:?}", err)
|
||||
}
|
||||
})?;
|
||||
|
||||
get_weight_for_legacy_tts_inference_with_connection(weight_token, &mut connection).await
|
||||
}
|
||||
|
||||
pub async fn get_weight_for_legacy_tts_inference_with_connection(
|
||||
weight_token: &ModelWeightToken,
|
||||
mysql_connection: &mut PoolConnection<MySql>
|
||||
) -> Result<Option<ModelWeightForLegacyTtsInference>, TtsModelForInferenceError> {
|
||||
let maybe_result = select_include_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(TtsModelForInferenceError::DatabaseError {
|
||||
reason: format!("Mysql error: {:?}", err)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if record.mod_deleted_at.is_some() || record.user_deleted_at.is_some() {
|
||||
return Err(TtsModelForInferenceError::ModelDeleted);
|
||||
}
|
||||
|
||||
Ok(Some(ModelWeightForLegacyTtsInference {
|
||||
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,
|
||||
maybe_custom_vocoder: match record.maybe_custom_vocoder_token {
|
||||
// NB: We're relying on a single field's presence to infer that the others vocoder fields
|
||||
// are also there. If for some reason they aren't, fail open.
|
||||
None => None,
|
||||
Some(vocoder_token) => Some(CustomVocoderFields {
|
||||
vocoder_token,
|
||||
vocoder_type: record.maybe_custom_vocoder_type.ok_or(
|
||||
TtsModelForInferenceError::DatabaseError { reason: "custom_vocoder_type field error".to_string() })?,
|
||||
vocoder_title: record.maybe_custom_vocoder_title.ok_or(
|
||||
TtsModelForInferenceError::DatabaseError { reason: "custom_vocoder_title field error".to_string() })?,
|
||||
vocoder_private_bucket_hash: record.maybe_custom_vocoder_private_bucket_hash.ok_or(
|
||||
TtsModelForInferenceError::DatabaseError { reason: "vocoder_private_bucket_hash field error".to_string() })?,
|
||||
})
|
||||
},
|
||||
use_default_mel_multiply_factor: nullable_i8_to_bool_default_false(record.use_default_mel_multiply_factor),
|
||||
maybe_custom_mel_multiply_factor: record.maybe_custom_mel_multiply_factor,
|
||||
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,
|
||||
w_extension.text_pipeline_type as maybe_text_pipeline_type,
|
||||
w_extension.use_default_mel_multiply_factor,
|
||||
w_extension.maybe_custom_mel_multiply_factor,
|
||||
|
||||
w_extension.maybe_custom_vocoder_token,
|
||||
|
||||
vocoder.vocoder_type as `maybe_custom_vocoder_type: enums::common::vocoder_type::VocoderType`,
|
||||
vocoder.title as maybe_custom_vocoder_title,
|
||||
vocoder.private_bucket_hash as maybe_custom_vocoder_private_bucket_hash,
|
||||
|
||||
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
|
||||
|
||||
LEFT OUTER JOIN vocoder_models AS vocoder
|
||||
ON vocoder.token = w_extension.maybe_custom_vocoder_token
|
||||
|
||||
WHERE
|
||||
wt.token = ?
|
||||
"#,
|
||||
weight_token.as_str()
|
||||
)
|
||||
.fetch_one(&mut **mysql_connection).await
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct RawWeight {
|
||||
token: ModelWeightToken,
|
||||
title: String,
|
||||
weights_type: WeightsType,
|
||||
weights_category: WeightsCategory,
|
||||
maybe_description_markdown: Option<String>,
|
||||
maybe_description_rendered_html: Option<String>,
|
||||
|
||||
creator_user_token: UserToken,
|
||||
creator_username: String,
|
||||
creator_display_name: String,
|
||||
creator_gravatar_hash: String,
|
||||
|
||||
creator_ip_address: String,
|
||||
creator_set_visibility: Visibility,
|
||||
maybe_last_update_user_token: Option<UserToken>,
|
||||
original_download_url: Option<String>,
|
||||
original_filename: Option<String>,
|
||||
file_size_bytes: i32,
|
||||
file_checksum_sha2: String,
|
||||
public_bucket_hash: String,
|
||||
maybe_public_bucket_prefix: Option<String>,
|
||||
maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
maybe_ratings_positive_count: Option<u32>,
|
||||
maybe_ratings_negative_count: Option<u32>,
|
||||
maybe_bookmark_count: Option<u32>,
|
||||
|
||||
maybe_ietf_language_tag: Option<String>,
|
||||
maybe_ietf_primary_language_subtag: Option<String>,
|
||||
maybe_default_pretrained_vocoder: Option<String>,
|
||||
maybe_text_pipeline_type: Option<String>,
|
||||
|
||||
// Joined custom vocoder fields
|
||||
maybe_custom_vocoder_token: Option<String>,
|
||||
maybe_custom_vocoder_type: Option<VocoderType>,
|
||||
maybe_custom_vocoder_title: Option<String>,
|
||||
maybe_custom_vocoder_private_bucket_hash: Option<String>,
|
||||
|
||||
use_default_mel_multiply_factor: Option<i8>, // bool; note this was *not* optional before, but is because of our join
|
||||
maybe_custom_mel_multiply_factor: Option<f64>,
|
||||
|
||||
version: i32,
|
||||
created_at: DateTime<Utc>,
|
||||
updated_at: DateTime<Utc>,
|
||||
user_deleted_at: Option<DateTime<Utc>>,
|
||||
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,4 @@
|
||||
pub mod get_weight;
|
||||
pub mod get_weight_for_legacy_tts_enqueue;
|
||||
pub mod get_weight_for_legacy_tts_inference;
|
||||
pub mod get_weight_for_legacy_tts_info;
|
||||
@@ -207,10 +207,10 @@ LEFT OUTER JOIN entity_stats
|
||||
query_builder.push_bind(username);
|
||||
|
||||
match view_as {
|
||||
ViewAs::Author => {
|
||||
ViewAs::Author | ViewAs::Moderator => {
|
||||
// NB(bt): Actually, mods don't want to see deleted models. We'll improve the moderator UI later.
|
||||
query_builder.push(" AND mw.user_deleted_at IS NULL AND mw.mod_deleted_at IS NULL ");
|
||||
}
|
||||
ViewAs::Moderator => {}
|
||||
ViewAs::AnotherUser => {
|
||||
query_builder.push(" AND mw.user_deleted_at IS NULL AND mw.mod_deleted_at IS NULL ");
|
||||
query_builder.push(" AND mw.creator_set_visibility = ");
|
||||
|
||||
+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;
|
||||
@@ -293,8 +293,6 @@ mod tests {
|
||||
maybe_scoped_weight_type: None,
|
||||
maybe_scoped_weight_category: None,
|
||||
mysql_pool: &pool,
|
||||
maybe_scoped_weight_type: None,
|
||||
maybe_scoped_weight_category: None,
|
||||
}).await?;
|
||||
for weight in weights_by_username.records.iter() {
|
||||
// print weight
|
||||
|
||||
+7
-5
@@ -29,9 +29,11 @@ pub struct WholeTtsModelRecord {
|
||||
|
||||
pub text_preprocessing_algorithm: Option<String>,
|
||||
|
||||
// Weird mel multiplication hack
|
||||
pub use_default_mel_multiply_factor: bool,
|
||||
pub maybe_custom_mel_multiply_factor: Option<f64>,
|
||||
pub maybe_custom_mel_multiply_factor: Option<f64>, // 10
|
||||
|
||||
// Vocoder
|
||||
pub maybe_default_pretrained_vocoder: Option<String>,
|
||||
pub maybe_custom_vocoder_token: Option<VocoderModelToken>,
|
||||
|
||||
@@ -44,7 +46,7 @@ pub struct WholeTtsModelRecord {
|
||||
|
||||
pub voice_name: Option<String>,
|
||||
pub actor_name: Option<String>,
|
||||
pub characteristic: Option<String>,
|
||||
pub characteristic: Option<String>, // 20
|
||||
pub version_string: Option<String>,
|
||||
|
||||
pub is_front_page_featured: bool,
|
||||
@@ -59,7 +61,7 @@ pub struct WholeTtsModelRecord {
|
||||
pub creator_user_token: UserToken,
|
||||
|
||||
pub creator_ip_address_creation: String,
|
||||
pub creator_ip_address_last_update: String,
|
||||
pub creator_ip_address_last_update: String, // 30
|
||||
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
@@ -74,7 +76,7 @@ pub struct WholeTtsModelRecord {
|
||||
|
||||
pub is_public_listing_approved: Option<bool>,
|
||||
pub is_locked_from_user_modification: bool,
|
||||
pub is_locked_from_use: bool,
|
||||
pub is_locked_from_use: bool, // 40
|
||||
|
||||
pub maybe_mod_comments: Option<String>,
|
||||
pub maybe_mod_user_token: Option<UserToken>,
|
||||
@@ -87,7 +89,7 @@ pub struct WholeTtsModelRecord {
|
||||
pub updated_at: DateTime<Utc>,
|
||||
|
||||
pub user_deleted_at: Option<DateTime<Utc>>,
|
||||
pub mod_deleted_at: Option<DateTime<Utc>>,
|
||||
pub mod_deleted_at: Option<DateTime<Utc>>, // 48 fields total
|
||||
}
|
||||
|
||||
pub async fn list_whole_tts_models_using_cursor(
|
||||
|
||||
@@ -64,7 +64,7 @@ pub async fn insert_tts_result<P: AsRef<Path>>(
|
||||
maybe_creator_user_token = tts_job.maybe_creator_user_token.clone();
|
||||
tts_model_token = tts_job.model_token.clone();
|
||||
creator_ip_address = tts_job.creator_ip_address.clone();
|
||||
creator_set_visibility = tts_job.creator_set_visibility.clone();
|
||||
creator_set_visibility = tts_job.creator_set_visibility;
|
||||
}
|
||||
JobType::GenericInferenceJob(generic_job) => {
|
||||
raw_inference_text = generic_job.maybe_raw_inference_text.as_deref()
|
||||
@@ -75,7 +75,7 @@ pub async fn insert_tts_result<P: AsRef<Path>>(
|
||||
.unwrap_or("")
|
||||
.to_string();
|
||||
creator_ip_address = generic_job.creator_ip_address.clone();
|
||||
creator_set_visibility = generic_job.creator_set_visibility.clone();
|
||||
creator_set_visibility = generic_job.creator_set_visibility;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -149,7 +149,11 @@ impl RawUserBookmarkRecord {
|
||||
MediaFileType::Audio => Some("audio media file".to_string()),
|
||||
MediaFileType::Image => Some("image media file".to_string()),
|
||||
MediaFileType::Video => Some("video media file".to_string()),
|
||||
MediaFileType::Mocap => Some("mocap da file".to_string()),
|
||||
MediaFileType::Mocap => Some("mocap file".to_string()),
|
||||
MediaFileType::Bvh => Some("3d file".to_string()),
|
||||
MediaFileType::Fbx => Some("3d file".to_string()),
|
||||
MediaFileType::Glb => Some("3d file".to_string()),
|
||||
MediaFileType::Gltf => Some("3d file".to_string()),
|
||||
}),
|
||||
UserBookmarkEntityType::VoiceConversionModel => self.maybe_descriptive_text_voice_conversion_model_title,
|
||||
UserBookmarkEntityType::ZsVoice => self.maybe_descriptive_text_zs_voice_title,
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ impl ListW2lResultsQueryBuilder {
|
||||
maybe_creator_user_token: r.maybe_creator_user_token.clone(),
|
||||
maybe_creator_username: r.maybe_creator_username.clone(),
|
||||
maybe_creator_display_name: r.maybe_creator_display_name.clone(),
|
||||
maybe_creator_result_id: r.maybe_creator_result_id.map(|v| v as u64).clone(),
|
||||
maybe_creator_result_id: r.maybe_creator_result_id.map(|v| v as u64),
|
||||
file_size_bytes: if r.file_size_bytes > 0 { r.file_size_bytes as u32 } else { 0 },
|
||||
frame_width: if r.frame_width > 0 { r.frame_width as u32 } else { 0 },
|
||||
frame_height: if r.frame_height > 0 { r.frame_height as u32 } else { 0 },
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -14,11 +14,21 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
|
||||
# External
|
||||
# Internal
|
||||
errors = { path = "../errors" }
|
||||
filesys = { path = "../files/filesys" }
|
||||
|
||||
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
|
||||
|
||||
# External
|
||||
log = "0.4.14"
|
||||
subprocess = "0.2.9"
|
||||
|
||||
# Serialization
|
||||
#serde = "1.0.125"
|
||||
#serde_derive = "1.0.125"
|
||||
#serde_json = "1.0.64"
|
||||
#toml = "0.5.8"
|
||||
|
||||
[dev-dependencies]
|
||||
serial_test = "3.0.0"
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ impl CommandExitStatus {
|
||||
mod tests {
|
||||
use subprocess::ExitStatus;
|
||||
|
||||
use crate::job::job_loop::command_exit_status::CommandExitStatus;
|
||||
use crate::command_exit_status::CommandExitStatus;
|
||||
|
||||
#[test]
|
||||
fn is_success() {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user