mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-30 23:35:54 -04:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25b90c07ce | ||
|
|
2f971dda60 |
@@ -3,7 +3,6 @@
|
||||
.env
|
||||
.env-aichatbot-secrets
|
||||
.env-elasticsearch-secrets
|
||||
.env-migration-tool-secrets
|
||||
.env-secrets
|
||||
_develop/tools/.secrets
|
||||
_develop/tools/db_secrets.toml
|
||||
@@ -18,9 +17,6 @@ secrets.toml
|
||||
secrets.yaml
|
||||
twitch_secrets.toml
|
||||
|
||||
# Old env secrets
|
||||
.*-secrets
|
||||
|
||||
# New env secrets (per-app)
|
||||
*-secrets.env
|
||||
|
||||
|
||||
+6
-17
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n f.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,\n f.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,\n f.entity_token,\n f.user_token as `user_token: tokens::tokens::users::UserToken`,\n u.username,\n u.display_name as user_display_name,\n u.email_gravatar_hash as user_gravatar_hash,\n f.created_at,\n f.updated_at,\n f.deleted_at,\n\n media_files.media_type as `maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n media_files.origin_product_category as `maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory`,\n\n model_weights.title as maybe_descriptive_text_model_weight_title,\n tts_models.title as maybe_descriptive_text_tts_model_title,\n tts_results.raw_inference_text as maybe_descriptive_text_tts_result_inference_text,\n users.display_name as maybe_descriptive_text_user_display_name,\n voice_conversion_models.title as maybe_descriptive_text_voice_conversion_model_title,\n zs_voices.title as maybe_descriptive_text_zs_voice_title\n\nFROM\n user_bookmarks AS f\nJOIN users AS u\n ON f.user_token = u.token\n\nLEFT OUTER JOIN model_weights ON model_weights.token = f.entity_token\nLEFT OUTER JOIN media_files ON media_files.token = f.entity_token\nLEFT OUTER JOIN tts_models ON tts_models.token = f.entity_token\nLEFT OUTER JOIN tts_results ON tts_results.token = f.entity_token\nLEFT OUTER JOIN users ON users.token = f.entity_token\nLEFT OUTER JOIN voice_conversion_models ON voice_conversion_models.token = f.entity_token\nLEFT OUTER JOIN zs_voices ON zs_voices.token = f.entity_token\n\nWHERE\n u.username = ?\n AND f.entity_type = ?\n AND f.deleted_at IS NULL\nORDER BY f.id DESC\nLIMIT 50\n ",
|
||||
"query": "\nSELECT\n f.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,\n f.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,\n f.entity_token,\n f.user_token as `user_token: tokens::tokens::users::UserToken`,\n u.username,\n u.display_name as user_display_name,\n u.email_gravatar_hash as user_gravatar_hash,\n f.created_at,\n f.updated_at,\n f.deleted_at,\n\n media_files.media_type as `maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n media_files.origin_product_category as `maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory`,\n\n tts_models.title as maybe_descriptive_text_tts_model_title,\n tts_results.raw_inference_text as maybe_descriptive_text_tts_result_inference_text,\n users.display_name as maybe_descriptive_text_user_display_name,\n voice_conversion_models.title as maybe_descriptive_text_voice_conversion_model_title,\n zs_voices.title as maybe_descriptive_text_zs_voice_title\n\nFROM\n user_bookmarks AS f\nJOIN users AS u\n ON f.user_token = u.token\n\nLEFT OUTER JOIN media_files ON media_files.token = f.entity_token\nLEFT OUTER JOIN tts_models ON tts_models.token = f.entity_token\nLEFT OUTER JOIN tts_results ON tts_results.token = f.entity_token\nLEFT OUTER JOIN users ON users.token = f.entity_token\nLEFT OUTER JOIN voice_conversion_models ON voice_conversion_models.token = f.entity_token\nLEFT OUTER JOIN zs_voices ON zs_voices.token = f.entity_token\n\nWHERE\n u.username = ?\n AND f.entity_type = ?\n AND f.deleted_at IS NULL\nORDER BY f.id DESC\nLIMIT 50\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -125,16 +125,6 @@
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "maybe_descriptive_text_model_weight_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "maybe_descriptive_text_tts_model_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -144,7 +134,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"ordinal": 13,
|
||||
"name": "maybe_descriptive_text_tts_result_inference_text",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
@@ -154,7 +144,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"ordinal": 14,
|
||||
"name": "maybe_descriptive_text_user_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -164,7 +154,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"ordinal": 15,
|
||||
"name": "maybe_descriptive_text_voice_conversion_model_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -174,7 +164,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"ordinal": 16,
|
||||
"name": "maybe_descriptive_text_zs_voice_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -204,9 +194,8 @@
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "3a7ac7f979ac270dad1070031d0d663d0eb3d969365f6b2fd048ca41c5c455b2"
|
||||
"hash": "d9c00b3c78ed6ec31b281c7ea5fb1efd0cfa6b20899151f9e7f1a122c1f7a70e"
|
||||
}
|
||||
+6
-17
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n f.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,\n f.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,\n f.entity_token,\n f.user_token as `user_token: tokens::tokens::users::UserToken`,\n u.username,\n u.display_name as user_display_name,\n u.email_gravatar_hash as user_gravatar_hash,\n f.created_at,\n f.updated_at,\n f.deleted_at,\n\n media_files.media_type as `maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n media_files.origin_product_category as `maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory`,\n\n model_weights.title as maybe_descriptive_text_model_weight_title,\n tts_models.title as maybe_descriptive_text_tts_model_title,\n tts_results.raw_inference_text as maybe_descriptive_text_tts_result_inference_text,\n users.display_name as maybe_descriptive_text_user_display_name,\n voice_conversion_models.title as maybe_descriptive_text_voice_conversion_model_title,\n zs_voices.title as maybe_descriptive_text_zs_voice_title\n\nFROM\n user_bookmarks AS f\nJOIN users AS u\n ON f.user_token = u.token\n\nLEFT OUTER JOIN model_weights ON model_weights.token = f.entity_token\nLEFT OUTER JOIN media_files ON media_files.token = f.entity_token\nLEFT OUTER JOIN tts_models ON tts_models.token = f.entity_token\nLEFT OUTER JOIN tts_results ON tts_results.token = f.entity_token\nLEFT OUTER JOIN users ON users.token = f.entity_token\nLEFT OUTER JOIN voice_conversion_models ON voice_conversion_models.token = f.entity_token\nLEFT OUTER JOIN zs_voices ON zs_voices.token = f.entity_token\n\nWHERE\n u.username = ?\n AND f.deleted_at IS NULL\nORDER BY f.id DESC\nLIMIT 50\n ",
|
||||
"query": "\nSELECT\n f.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,\n f.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,\n f.entity_token,\n f.user_token as `user_token: tokens::tokens::users::UserToken`,\n u.username,\n u.display_name as user_display_name,\n u.email_gravatar_hash as user_gravatar_hash,\n f.created_at,\n f.updated_at,\n f.deleted_at,\n\n media_files.media_type as `maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n media_files.origin_product_category as `maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory`,\n\n tts_models.title as maybe_descriptive_text_tts_model_title,\n tts_results.raw_inference_text as maybe_descriptive_text_tts_result_inference_text,\n users.display_name as maybe_descriptive_text_user_display_name,\n voice_conversion_models.title as maybe_descriptive_text_voice_conversion_model_title,\n zs_voices.title as maybe_descriptive_text_zs_voice_title\n\nFROM\n user_bookmarks AS f\nJOIN users AS u\n ON f.user_token = u.token\n\nLEFT OUTER JOIN media_files ON media_files.token = f.entity_token\nLEFT OUTER JOIN tts_models ON tts_models.token = f.entity_token\nLEFT OUTER JOIN tts_results ON tts_results.token = f.entity_token\nLEFT OUTER JOIN users ON users.token = f.entity_token\nLEFT OUTER JOIN voice_conversion_models ON voice_conversion_models.token = f.entity_token\nLEFT OUTER JOIN zs_voices ON zs_voices.token = f.entity_token\n\nWHERE\n u.username = ?\n AND f.deleted_at IS NULL\nORDER BY f.id DESC\nLIMIT 50\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -125,16 +125,6 @@
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "maybe_descriptive_text_model_weight_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "maybe_descriptive_text_tts_model_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -144,7 +134,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"ordinal": 13,
|
||||
"name": "maybe_descriptive_text_tts_result_inference_text",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
@@ -154,7 +144,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"ordinal": 14,
|
||||
"name": "maybe_descriptive_text_user_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -164,7 +154,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"ordinal": 15,
|
||||
"name": "maybe_descriptive_text_voice_conversion_model_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -174,7 +164,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"ordinal": 16,
|
||||
"name": "maybe_descriptive_text_zs_voice_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -204,9 +194,8 @@
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "707af35ee4ab4519f28e6d69982944666e6c7c0f24b5da79dde828ffdb2c8302"
|
||||
"hash": "eea9531d5261833b93baadee8b99449362c074fc2397e23ecd175b6a0425b16b"
|
||||
}
|
||||
Generated
+80
-51
@@ -483,6 +483,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.4"
|
||||
@@ -596,9 +605,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-stripe"
|
||||
version = "0.26.0"
|
||||
version = "0.25.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19a0b12cb3b2df9abfaa381632e4d55b2aede9063034daaa0d0145413719a7e1"
|
||||
checksum = "e1b39347f478f57a40cbaf82cbaebb4a350acc757cda30fc7ff88707a11d1d81"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"futures-util",
|
||||
@@ -675,6 +684,17 @@ dependencies = [
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.19",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
@@ -793,7 +813,6 @@ dependencies = [
|
||||
"tokio",
|
||||
"toml 0.5.11",
|
||||
"url_config",
|
||||
"user_traits_component",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1079,6 +1098,21 @@ dependencies = [
|
||||
"inout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.34.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
"bitflags 1.3.2",
|
||||
"strsim 0.8.0",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.4.8"
|
||||
@@ -1098,7 +1132,7 @@ dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"strsim",
|
||||
"strsim 0.10.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1495,7 +1529,7 @@ dependencies = [
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"strsim 0.10.0",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
@@ -1509,7 +1543,7 @@ dependencies = [
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"strsim 0.10.0",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
@@ -1523,7 +1557,7 @@ dependencies = [
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"strsim 0.10.0",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
@@ -1703,7 +1737,7 @@ name = "dev-database-seed"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"buckets",
|
||||
"clap",
|
||||
"clap 2.34.0",
|
||||
"cloud_storage",
|
||||
"config",
|
||||
"easyenv",
|
||||
@@ -1717,7 +1751,6 @@ dependencies = [
|
||||
"mimetypes",
|
||||
"my-workspace-hack",
|
||||
"mysql_queries",
|
||||
"rand 0.8.5",
|
||||
"sqlx",
|
||||
"storyteller_root",
|
||||
"tokens",
|
||||
@@ -1729,7 +1762,7 @@ name = "dev-upload-media-file"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"buckets",
|
||||
"clap",
|
||||
"clap 2.34.0",
|
||||
"cloud_storage",
|
||||
"config",
|
||||
"easyenv",
|
||||
@@ -2012,7 +2045,7 @@ name = "elasticsearch-cli"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"buckets",
|
||||
"clap",
|
||||
"clap 2.34.0",
|
||||
"config",
|
||||
"easyenv",
|
||||
"elasticsearch",
|
||||
@@ -2068,6 +2101,7 @@ dependencies = [
|
||||
"bootstrap",
|
||||
"buckets",
|
||||
"chrono",
|
||||
"clap 2.34.0",
|
||||
"cloud_storage",
|
||||
"concurrency",
|
||||
"config",
|
||||
@@ -2631,6 +2665,15 @@ dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.3"
|
||||
@@ -3033,7 +3076,7 @@ version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"hermit-abi 0.3.3",
|
||||
"rustix",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
@@ -3336,7 +3379,7 @@ dependencies = [
|
||||
name = "lru-delete-models"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap 4.4.8",
|
||||
"errors",
|
||||
"logging",
|
||||
"my-workspace-hack",
|
||||
@@ -3480,29 +3523,6 @@ dependencies = [
|
||||
"my-workspace-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "migration-tool"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"buckets",
|
||||
"clap",
|
||||
"config",
|
||||
"easyenv",
|
||||
"enums",
|
||||
"errors",
|
||||
"log",
|
||||
"my-workspace-hack",
|
||||
"mysql_queries",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sqlx",
|
||||
"storyteller_root",
|
||||
"strum",
|
||||
"tokens",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.3.17"
|
||||
@@ -3952,7 +3972,7 @@ version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"hermit-abi 0.3.3",
|
||||
"libc",
|
||||
]
|
||||
|
||||
@@ -5104,7 +5124,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
name = "scrape_test"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap 2.34.0",
|
||||
"errors",
|
||||
"my-workspace-hack",
|
||||
"tokio",
|
||||
@@ -5933,7 +5953,6 @@ dependencies = [
|
||||
"twitch_oauth2",
|
||||
"url_config",
|
||||
"user_input_common",
|
||||
"user_traits_component",
|
||||
"users_component",
|
||||
"utoipa",
|
||||
"utoipa-swagger-ui",
|
||||
@@ -5986,6 +6005,12 @@ dependencies = [
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
@@ -6305,6 +6330,15 @@ dependencies = [
|
||||
"my-workspace-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||
dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.50"
|
||||
@@ -6407,7 +6441,6 @@ name = "tokens"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"my-workspace-hack",
|
||||
"once_cell",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
@@ -6729,6 +6762,7 @@ version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"clap 2.34.0",
|
||||
"cloud_storage",
|
||||
"collections",
|
||||
"config",
|
||||
@@ -7030,16 +7064,6 @@ dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "user_traits_component"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"errors",
|
||||
"mockall",
|
||||
"my-workspace-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "users_component"
|
||||
version = "0.0.1"
|
||||
@@ -7083,7 +7107,6 @@ dependencies = [
|
||||
"tokens",
|
||||
"toml 0.5.11",
|
||||
"user_input_common",
|
||||
"user_traits_component",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7160,6 +7183,12 @@ version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version-sync"
|
||||
version = "0.9.5"
|
||||
|
||||
+4
-6
@@ -10,14 +10,13 @@ members = [
|
||||
"crates/_types/tokens",
|
||||
|
||||
# CLI tools for operations, etc.
|
||||
"crates/cli/database-backup",
|
||||
"crates/cli/database-cleanup",
|
||||
"crates/cli/dev-database-seed",
|
||||
"crates/cli/dev-upload-media-file",
|
||||
"crates/cli/database_backup",
|
||||
"crates/cli/database_cleanup",
|
||||
"crates/cli/dev_database_seed",
|
||||
"crates/cli/dev_upload_media_file",
|
||||
"crates/cli/elasticsearch-cli",
|
||||
"crates/cli/kubectl-pod-cleanup",
|
||||
"crates/cli/lru-delete-models",
|
||||
"crates/cli/migration-tool",
|
||||
"crates/cli/scrape_test",
|
||||
|
||||
# Shared libraries
|
||||
@@ -84,7 +83,6 @@ members = [
|
||||
# Service Plugins: complete subsystems that can be plugged into services (users, billing, etc.)
|
||||
"crates/service/plugins/billing",
|
||||
"crates/service/plugins/inference_workloads",
|
||||
"crates/service/plugins/user_traits_component",
|
||||
"crates/service/plugins/users",
|
||||
|
||||
# Vendored code
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Re-home Nessu's models
|
||||
update tts_models set creator_user_token = "user_7z1h6sykg4r62" where creator_user_token = "U:C00NRSW1AE8T4" limit 5;
|
||||
@@ -13,9 +13,6 @@ where token IN (
|
||||
'vcm_502wkt2pca3y'
|
||||
);
|
||||
|
||||
-- Re-home Nessu's models
|
||||
update voice_conversion_models set creator_user_token = "user_7z1h6sykg4r62" where creator_user_token = "U:C00NRSW1AE8T4" limit 5;
|
||||
|
||||
-- Remove broken models
|
||||
update voice_conversion_models
|
||||
set
|
||||
@@ -374,21 +371,11 @@ where token IN (
|
||||
'vcm_xy97xcgnk9y6',
|
||||
'vcm_a47wtfbsjrfc',
|
||||
'vcm_kygenhbg5mgj',
|
||||
'vcm_s8gndv19yt7p',
|
||||
'vcm_ny9pj57w5eyh'
|
||||
);
|
||||
|
||||
|
||||
update voice_conversion_models
|
||||
set
|
||||
mod_deleted_at = NOW(),
|
||||
maybe_mod_comments = 'abuse'
|
||||
where token IN (
|
||||
'vcm_qajyd528p8kw',
|
||||
'vcm_f5pcdecmzcc5'
|
||||
'vcm_s8gndv19yt7p'
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights DROP COLUMN maybe_migration_old_model_token;
|
||||
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
ADD COLUMN maybe_migration_old_model_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER cached_user_ratings_last_updated_at;
|
||||
|
||||
ALTER TABLE model_weights
|
||||
ADD UNIQUE INDEX unique_index_maybe_migration_old_model_token (maybe_migration_old_model_token);
|
||||
@@ -1,6 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE voice_conversion_models
|
||||
DROP COLUMN maybe_migration_new_model_weights_token;
|
||||
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE voice_conversion_models
|
||||
ADD COLUMN maybe_migration_new_model_weights_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER maybe_mod_comments;
|
||||
|
||||
ALTER TABLE voice_conversion_models
|
||||
ADD UNIQUE INDEX unique_index_maybe_migration_new_model_weights_token (maybe_migration_new_model_weights_token);
|
||||
@@ -1,5 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE tts_models DROP COLUMN maybe_migration_new_model_weights_token;
|
||||
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE tts_models
|
||||
ADD COLUMN maybe_migration_new_model_weights_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER maybe_mod_user_token;
|
||||
|
||||
ALTER TABLE tts_models
|
||||
ADD UNIQUE INDEX unique_index_maybe_migration_new_model_weights_token (maybe_migration_new_model_weights_token);
|
||||
@@ -1,5 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE vocoder_models DROP COLUMN maybe_migration_new_model_weights_token;
|
||||
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE vocoder_models
|
||||
ADD COLUMN maybe_migration_new_model_weights_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER maybe_mod_user_token;
|
||||
|
||||
ALTER TABLE vocoder_models
|
||||
ADD UNIQUE INDEX unique_index_maybe_migration_new_model_weights_token (maybe_migration_new_model_weights_token);
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights DROP COLUMN maybe_avatar_media_file_token;
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
ADD COLUMN maybe_avatar_media_file_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER maybe_thumbnail_token;
|
||||
|
||||
ALTER TABLE model_weights
|
||||
ADD INDEX index_maybe_avatar_media_file_token (maybe_avatar_media_file_token);
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights DROP COLUMN maybe_cover_media_file_token;
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
ADD COLUMN maybe_cover_media_file_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER maybe_avatar_media_file_token;
|
||||
|
||||
ALTER TABLE model_weights
|
||||
ADD INDEX index_maybe_cover_media_file_token (maybe_cover_media_file_token);
|
||||
@@ -1,5 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE users DROP COLUMN maybe_avatar_media_file_token;
|
||||
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE users
|
||||
ADD COLUMN maybe_avatar_media_file_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER ip_address_last_update;
|
||||
|
||||
ALTER TABLE users
|
||||
ADD INDEX index_maybe_avatar_media_file_token (maybe_avatar_media_file_token);
|
||||
@@ -1,5 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE users DROP COLUMN maybe_cover_media_file_token;
|
||||
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE users
|
||||
ADD COLUMN maybe_cover_media_file_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER maybe_avatar_media_file_token;
|
||||
|
||||
ALTER TABLE users
|
||||
ADD INDEX index_maybe_cover_media_file_token (maybe_cover_media_file_token);
|
||||
@@ -1,5 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
DROP TABLE model_weights_preview_samples;
|
||||
@@ -1,47 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
CREATE TABLE model_weights_preview_samples (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- ========== WEIGHTS CLASSIFICATION ==========
|
||||
|
||||
-- Foreign key to model weights.
|
||||
-- This is in a composite index with media_file_token to make sure a media file only applies
|
||||
-- to a given model once.
|
||||
model_weight_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- Foreign key to media files
|
||||
-- This is in a composite index with model_weight_token to make sure a media file only applies
|
||||
-- to a given model once.
|
||||
media_file_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- Information about who set the sample
|
||||
-- * automation
|
||||
-- * author
|
||||
-- * community
|
||||
set_by VARCHAR(16) NOT NULL,
|
||||
|
||||
-- Incremented with every update.
|
||||
version INT NOT NULL DEFAULT 0,
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- If this is removed by a mod.
|
||||
-- It completely disappears from the system.
|
||||
user_deleted_at TIMESTAMP NULL,
|
||||
mod_deleted_at TIMESTAMP NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (model_weight_token, media_file_token),
|
||||
|
||||
KEY index_model_weight_token (model_weight_token),
|
||||
KEY index_media_file_token (media_file_token)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
@@ -1,9 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- I'm doing this to visually align these tables and sort them together, because there will likely be other model_weights_* tables.
|
||||
RENAME TABLE model_weights_extension_image_generation_details TO model_weights_image_generation_details;
|
||||
RENAME TABLE model_weights_extension_tts_details TO model_weights_tts_details;
|
||||
RENAME TABLE model_weights_extension_vocoder_details TO model_weights_vocoder_details;
|
||||
RENAME TABLE model_weights_extension_voice_conversion_details TO model_weights_voice_conversion_details;
|
||||
@@ -1,9 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- I'm doing this to visually align these tables and sort them together, because there will likely be other model_weights_* tables.
|
||||
RENAME TABLE model_weights_image_generation_details TO model_weights_extension_image_generation_details;
|
||||
RENAME TABLE model_weights_tts_details TO model_weights_extension_tts_details;
|
||||
RENAME TABLE model_weights_vocoder_details TO model_weights_extension_vocoder_details;
|
||||
RENAME TABLE model_weights_voice_conversion_details TO model_weights_extension_voice_conversion_details;
|
||||
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
DROP INDEX index_weights_type ON model_weights;
|
||||
DROP INDEX index_weights_category ON model_weights;
|
||||
DROP INDEX fk_creator_user_token ON model_weights;
|
||||
DROP INDEX index_creator_set_visibility ON model_weights;
|
||||
DROP INDEX fk_maybe_avatar_media_file_token ON model_weights;
|
||||
DROP INDEX fk_maybe_cover_media_file_token ON model_weights;
|
||||
@@ -1,10 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
CREATE INDEX index_weights_type ON model_weights (weights_type);
|
||||
CREATE INDEX index_weights_category ON model_weights (weights_category);
|
||||
CREATE INDEX fk_creator_user_token ON model_weights (creator_user_token);
|
||||
CREATE INDEX index_creator_set_visibility ON model_weights (creator_set_visibility);
|
||||
CREATE INDEX fk_maybe_avatar_media_file_token ON model_weights (maybe_avatar_media_file_token);
|
||||
CREATE INDEX fk_maybe_cover_media_file_token ON model_weights (maybe_cover_media_file_token);
|
||||
@@ -1,6 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
DROP INDEX fk_maybe_avatar_media_file_token ON users;
|
||||
DROP INDEX fk_maybe_cover_media_file_token ON users;
|
||||
@@ -1,6 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
CREATE INDEX fk_maybe_avatar_media_file_token ON users (maybe_avatar_media_file_token);
|
||||
CREATE INDEX fk_maybe_cover_media_file_token ON users (maybe_cover_media_file_token);
|
||||
@@ -1,200 +0,0 @@
|
||||
-- NB: This is a manually squashed view of all the CREATE and ALTER statements,
|
||||
-- with comments attached to the fields for centralized documentation.
|
||||
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Every type of fine tuned model that users can upload.
|
||||
CREATE TABLE model_weights (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- Effective "primary key" (PUBLIC)
|
||||
token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- ========== WEIGHTS CLASSIFICATION ==========
|
||||
|
||||
-- The exact type of weights
|
||||
-- Currently supported values:
|
||||
-- * 'hifigan_tt2' - hifigan for Tacotron2; TTS vocoder
|
||||
-- * 'rvc_v2' - RVC (v2); voice conversion
|
||||
-- * 'sd_1.5' - Stable Diffusion 1.5; image generation
|
||||
-- * 'sdxl' - Stable Diffusion XL; image generation
|
||||
-- * 'so_vits_svc' - SVC; voice conversion
|
||||
-- * 'tt2' - Tacotron2; TTS
|
||||
weights_type VARCHAR(32) NOT NULL,
|
||||
|
||||
-- The broader category of the weights
|
||||
-- Currently supported values:
|
||||
-- * 'image_generation' (SD1.5, SDXL)
|
||||
-- * 'text_to_speech' (TT2)
|
||||
-- * 'vocoder' (Hifigan)
|
||||
-- * 'voice_conversion' (RVCv2, SVC)
|
||||
weights_category VARCHAR(32) NOT NULL,
|
||||
|
||||
|
||||
-- ========== MODEL DESCRIPTION ==========
|
||||
|
||||
-- The "name" of the model, which might be complicated.
|
||||
title VARCHAR(255) NOT NULL,
|
||||
|
||||
-- TODO(bt, 2023-12-14): Delete the `maybe_thumbnail_token` column later.
|
||||
-- We're using other columns instead.
|
||||
maybe_thumbnail_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- The "avatar" image is a media file of type image that serves as a
|
||||
-- small avatar or profile picture icon.
|
||||
maybe_avatar_media_file_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- The "cover" image is a media file of type image that covers the
|
||||
-- top of the page.
|
||||
maybe_cover_media_file_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- The description of the model in markdown.
|
||||
description_markdown TEXT NOT NULL,
|
||||
|
||||
-- Generated HTML (not user-editable).
|
||||
description_rendered_html TEXT NOT NULL,
|
||||
|
||||
|
||||
-- ========== CREATOR DETAILS ==========
|
||||
|
||||
-- The person that created the model.
|
||||
creator_user_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- For abuse tracking.
|
||||
-- Wide enough for IPv4/6.
|
||||
-- IP address of creator at time of creation.
|
||||
creator_ip_address VARCHAR(40) NOT NULL,
|
||||
|
||||
-- (THIS MIGHT NOT BE USED)
|
||||
-- NB: DO NOT SORT!
|
||||
-- THIS MUST MATCH THE RESPECTIVE JOBS TABLE.
|
||||
creator_set_visibility ENUM(
|
||||
'public',
|
||||
'hidden',
|
||||
'private'
|
||||
) NOT NULL DEFAULT 'public',
|
||||
|
||||
-- The synthetic id associated with this model.
|
||||
-- These ids are incremented on a per-user basis to help users
|
||||
-- sequence their own work. They serve no other purpose.
|
||||
-- "weights" synthetic ids are incremented over all media files
|
||||
-- creator_weights_synthetic_id BIGINT(20) DEFAULT NULL,
|
||||
|
||||
-- "weights_type" synthetic ids are incremented over a given weight type
|
||||
-- creator_weights_type_synthetic_id BIGINT(20) DEFAULT NULL,
|
||||
|
||||
-- The last user to edit the model. This could be the creator or a moderator.
|
||||
-- Check the future audit logs table for more info.
|
||||
maybe_last_update_user_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
|
||||
-- ========== IMMUTABLE PROVENANCE AND METADATA ==========
|
||||
|
||||
-- Where the file was originally downloaded (if it was downloaded)
|
||||
original_download_url VARCHAR(512) DEFAULT NULL,
|
||||
|
||||
-- The filename that was used at upload time (if available)
|
||||
original_filename VARCHAR(255) DEFAULT NULL,
|
||||
|
||||
-- File characteristics
|
||||
file_size_bytes INT(10) NOT NULL DEFAULT 0,
|
||||
|
||||
-- Checksum of the original weights file
|
||||
-- SHA2 hash [SHA2 = CHAR(64), SHA1 = CHAR(40), MD5 = CHAR(32)]
|
||||
-- Note that SHA2 is a hash family (SHA-228, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256, ...)
|
||||
-- and produces different lengths output depending on the choice of algorithm.
|
||||
file_checksum_sha2 CHAR(64) NOT NULL,
|
||||
|
||||
-- ========== BUCKET STORAGE ==========
|
||||
|
||||
-- The hash for the bucket directory that contains the original upload
|
||||
-- as well as any associated other files.
|
||||
-- The bucket filename for the primary file (not including the directory path) is given by:
|
||||
-- `[{maybe_private_bucket_prefix}]{private_bucket_hash}[{maybe_private_bucket_extension}]`
|
||||
private_bucket_hash VARCHAR(32) NOT NULL,
|
||||
|
||||
-- An optional prefix on the bucket filename.
|
||||
-- If present, this will be prepended to the beginning of the bucket filename to access the file.
|
||||
-- The bucket filename for the primary file (not including the directory path) is given by:
|
||||
-- `[{maybe_private_bucket_prefix}]{private_directory_hash}[{maybe_private_bucket_extension}]`
|
||||
maybe_private_bucket_prefix VARCHAR(16) DEFAULT NULL,
|
||||
|
||||
-- An optional appended extension on the bucket filename.
|
||||
-- If present, this will be appended to the end of the bucket filename to access the file.
|
||||
-- To allow for flexibility, this extension typically will contain a leading period if
|
||||
-- the file needs it (eg ".mp4" rather than "mp4")!
|
||||
-- The bucket filename for the primary file (not including the directory path) is given by:
|
||||
-- `[{maybe_private_bucket_prefix}]{private_directory_hash}[{maybe_private_bucket_extension}]`
|
||||
maybe_private_bucket_extension VARCHAR(16) DEFAULT NULL,
|
||||
|
||||
|
||||
-- ========== MODERATION DETAILS ==========
|
||||
|
||||
-- Mods may have to approve of vc models for them to show up in a public index.
|
||||
-- Models can be used by the author (or other parties that know the URL) before
|
||||
-- they're approved, but unapproved models won't show up in public indices.
|
||||
-- This is independent of other visibility controls (is_mod_disabled, deleted_at,
|
||||
-- and creator_set_visibility)
|
||||
-- is_public_listing_approved BOOLEAN DEFAULT NULL,
|
||||
|
||||
-- Extremely popular models may be locked from deletion or modification by users.
|
||||
-- is_locked_from_user_modification BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
|
||||
|
||||
-- ========== RATING AND RANKING ==========
|
||||
|
||||
-- User ratings are cached on the model, but are *not* a source of truth.
|
||||
-- Total count only includes "positive" and "negative" votes, not neutral ones.
|
||||
cached_user_ratings_total_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total positive
|
||||
cached_user_ratings_positive_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total negative
|
||||
cached_user_ratings_negative_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- User ratings are cached on the model, but are *not* a source of truth.
|
||||
-- Total count only includes "positive" and "negative" votes, not neutral ones.
|
||||
maybe_cached_user_ratings_ratio FLOAT,
|
||||
|
||||
-- When the cached ratings were last calculated and updated.
|
||||
cached_user_ratings_last_updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
|
||||
-- ========== MIGRATION DETAILS ==========
|
||||
|
||||
-- If migrated from another table, this is the token of the original model.
|
||||
maybe_migration_old_model_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
|
||||
-- ========== VECTOR CLOCK ==========
|
||||
|
||||
-- Incremented with every update.
|
||||
version INT NOT NULL DEFAULT 0,
|
||||
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- If this is removed by a mod.
|
||||
-- It completely disappears from the system.
|
||||
user_deleted_at TIMESTAMP NULL,
|
||||
mod_deleted_at TIMESTAMP NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (token),
|
||||
|
||||
KEY index_weights_type (weights_type),
|
||||
KEY index_weights_category (weights_category),
|
||||
KEY fk_creator_user_token (creator_user_token),
|
||||
KEY index_creator_set_visibility (creator_set_visibility),
|
||||
KEY fk_maybe_avatar_media_file_token (maybe_avatar_media_file_token),
|
||||
KEY fk_maybe_cover_media_file_token (maybe_cover_media_file_token)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Every type of fine tuned model that users can upload.
|
||||
CREATE TABLE model_weights_extension_image_generation_details (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- Simultaneous primary and foreign key.
|
||||
-- This should match a single record in the `model_weights` table.
|
||||
-- This turns this table into a polymorphic extension table.
|
||||
model_weights_token VARCHAR(32) NOT NULL,
|
||||
|
||||
|
||||
-- ========== IMAGE GENERATION MODEL METADATA ==========
|
||||
|
||||
-- RVC (v2) specific - whether the model has an index file associated with it
|
||||
-- These files improve the quality of the results.
|
||||
vc_has_index_file BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
|
||||
-- ========== VECTOR CLOCK ==========
|
||||
|
||||
-- Incremented with every update.
|
||||
version INT NOT NULL DEFAULT 0,
|
||||
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- If this is removed by a mod.
|
||||
-- It completely disappears from the system.
|
||||
user_deleted_at TIMESTAMP NULL,
|
||||
mod_deleted_at TIMESTAMP NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (model_weights_token)
|
||||
-- TODO:
|
||||
-- KEY index_model_type (model_type),
|
||||
-- KEY fk_maybe_vocoder_token (maybe_vocoder_token),
|
||||
-- KEY fk_creator_user_token (creator_user_token),
|
||||
-- KEY index_creator_set_visibility (creator_set_visibility),
|
||||
-- KEY index_private_bucket_hash (private_bucket_hash),
|
||||
-- KEY index_is_public_listing_approved (is_public_listing_approved),
|
||||
-- KEY index_is_locked_from_user_modification (is_locked_from_user_modification)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
@@ -1,73 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Extra metadata on tts models
|
||||
CREATE TABLE model_weights_extension_tts_details (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- Simultaneous primary and foreign key.
|
||||
-- This should match a single record in the `model_weights` table.
|
||||
-- This turns this table into a polymorphic extension table.
|
||||
model_weights_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- ========== TTS MODEL METADATA ==========
|
||||
|
||||
-- The full IETF BCP47 language tag (eg. en, en-US, es-419, ja-JP, pt, etc.)
|
||||
-- (Not that it matters apart from categorization, since voice conversion is universal.)
|
||||
ietf_language_tag VARCHAR(64) NOT NULL DEFAULT 'en',
|
||||
|
||||
-- The IETF BCP47 language tag's primary language subtag (eg. "es-419" becomes "es")
|
||||
-- (Not that it matters apart from categorization, since voice conversion is universal.)
|
||||
ietf_primary_language_subtag VARCHAR(12) NOT NULL DEFAULT 'en',
|
||||
|
||||
-- This is for Tacotron2, specifically.
|
||||
-- The name of the type of pipeline to use, eg "legacy_fakeyou", "legacy_vocodes", "english_v1", etc.
|
||||
-- New pipelines may be added at any point in the future and the source of truth for them will mostly
|
||||
-- live in the `storyteller-ml` repository.
|
||||
-- Older models and brand new models will have this field set to null, and we'll infer which value to
|
||||
-- lazily backfill based on the creation date and language setting.
|
||||
-- tts_text_pipeline_type VARCHAR(64) DEFAULT NULL,
|
||||
|
||||
-- If true, multiply the mel outputs before being vocoded by a globally default constant.
|
||||
use_default_mel_multiply_factor BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
|
||||
-- If not null, multiply the mel outputs before being vocoded by this value.
|
||||
-- This is used instead of the default if `tts_use_default_mel_multiply_factor` is
|
||||
-- set (ie. `tts_use_default_mel_multiply_factor` is ignored and this custom value is used instead)
|
||||
maybe_custom_mel_multiply_factor DOUBLE DEFAULT NULL,
|
||||
|
||||
-- If set, use a different pretrained vocoder.
|
||||
-- If not set, use the website default. (Currently HifiGan-SS)
|
||||
maybe_default_pretrained_vocoder VARCHAR(64) DEFAULT NULL,
|
||||
|
||||
-- If set, we'll use a custom vocoder (from table vocoder_models) instead of a default vocoder.
|
||||
-- If not set, we'll use `maybe_default_pretrained_vocoder` (or the website default).
|
||||
maybe_custom_vocoder_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
|
||||
-- ========== VECTOR CLOCK ==========
|
||||
|
||||
-- Incremented with every update.
|
||||
version INT NOT NULL DEFAULT 0,
|
||||
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (model_weights_token)
|
||||
-- TODO:
|
||||
-- KEY index_model_type (model_type),
|
||||
-- KEY fk_maybe_vocoder_token (maybe_vocoder_token),
|
||||
-- KEY fk_creator_user_token (creator_user_token),
|
||||
-- KEY index_creator_set_visibility (creator_set_visibility),
|
||||
-- KEY index_private_bucket_hash (private_bucket_hash),
|
||||
-- KEY index_is_public_listing_approved (is_public_listing_approved),
|
||||
-- KEY index_is_locked_from_user_modification (is_locked_from_user_modification)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
@@ -1,50 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Every type of fine tuned model that users can upload.
|
||||
CREATE TABLE model_weights_extension_vocoder_details (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- Simultaneous primary and foreign key.
|
||||
-- This should match a single record in the `model_weights` table.
|
||||
-- This turns this table into a polymorphic extension table.
|
||||
model_weights_token VARCHAR(32) NOT NULL,
|
||||
|
||||
|
||||
-- ========== VOCODER MODEL METADATA ==========
|
||||
|
||||
-- Whether the vocoder is recommended for use
|
||||
-- vocoder_is_staff_recommended BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
|
||||
|
||||
-- ========== VECTOR CLOCK ==========
|
||||
|
||||
-- Incremented with every update.
|
||||
version INT NOT NULL DEFAULT 0,
|
||||
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- If this is removed by a mod.
|
||||
-- It completely disappears from the system.
|
||||
user_deleted_at TIMESTAMP NULL,
|
||||
mod_deleted_at TIMESTAMP NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (model_weights_token)
|
||||
-- TODO:
|
||||
-- KEY index_model_type (model_type),
|
||||
-- KEY fk_maybe_vocoder_token (maybe_vocoder_token),
|
||||
-- KEY fk_creator_user_token (creator_user_token),
|
||||
-- KEY index_creator_set_visibility (creator_set_visibility),
|
||||
-- KEY index_private_bucket_hash (private_bucket_hash),
|
||||
-- KEY index_is_public_listing_approved (is_public_listing_approved),
|
||||
-- KEY index_is_locked_from_user_modification (is_locked_from_user_modification)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Every type of fine tuned model that users can upload.
|
||||
CREATE TABLE model_weights_extension_voice_conversion_details (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- Simultaneous primary and foreign key.
|
||||
-- This should match a single record in the `model_weights` table.
|
||||
-- This turns this table into a polymorphic extension table.
|
||||
model_weights_token VARCHAR(32) NOT NULL,
|
||||
|
||||
|
||||
-- ========== VOICE CONVERSION MODEL METADATA ==========
|
||||
|
||||
-- The full IETF BCP47 language tag (eg. en, en-US, es-419, ja-JP, pt, etc.)
|
||||
-- (Not that it matters apart from categorization, since voice conversion is universal.)
|
||||
ietf_language_tag VARCHAR(64) NOT NULL DEFAULT 'en',
|
||||
|
||||
-- The IETF BCP47 language tag's primary language subtag (eg. "es-419" becomes "es")
|
||||
-- (Not that it matters apart from categorization, since voice conversion is universal.)
|
||||
ietf_primary_language_subtag VARCHAR(12) NOT NULL DEFAULT 'en',
|
||||
|
||||
-- RVC (v2) specific - whether the model has an index file associated with it
|
||||
-- These files improve the quality of the results.
|
||||
has_index_file BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
|
||||
-- Pitch algorithm to use by default
|
||||
default_pitch_algorithm VARCHAR(64) DEFAULT NULL,
|
||||
|
||||
|
||||
-- ========== VECTOR CLOCK ==========
|
||||
|
||||
-- Incremented with every update.
|
||||
version INT NOT NULL DEFAULT 0,
|
||||
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- If this is removed by a mod.
|
||||
-- It completely disappears from the system.
|
||||
user_deleted_at TIMESTAMP NULL,
|
||||
mod_deleted_at TIMESTAMP NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (model_weights_token)
|
||||
-- TODO:
|
||||
-- KEY index_model_type (model_type),
|
||||
-- KEY fk_maybe_vocoder_token (maybe_vocoder_token),
|
||||
-- KEY fk_creator_user_token (creator_user_token),
|
||||
-- KEY index_creator_set_visibility (creator_set_visibility),
|
||||
-- KEY index_private_bucket_hash (private_bucket_hash),
|
||||
-- KEY index_is_public_listing_approved (is_public_listing_approved),
|
||||
-- KEY index_is_locked_from_user_modification (is_locked_from_user_modification)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
@@ -1,47 +0,0 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
CREATE TABLE model_weights_preview_samples (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- ========== WEIGHTS CLASSIFICATION ==========
|
||||
|
||||
-- Foreign key to model weights.
|
||||
-- This is in a composite index with media_file_token to make sure a media file only applies
|
||||
-- to a given model once.
|
||||
model_weight_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- Foreign key to media files
|
||||
-- This is in a composite index with model_weight_token to make sure a media file only applies
|
||||
-- to a given model once.
|
||||
media_file_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- Information about who set the sample
|
||||
-- * automation
|
||||
-- * author
|
||||
-- * community
|
||||
set_by VARCHAR(16) NOT NULL,
|
||||
|
||||
-- Incremented with every update.
|
||||
version INT NOT NULL DEFAULT 0,
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- If this is removed by a mod.
|
||||
-- It completely disappears from the system.
|
||||
user_deleted_at TIMESTAMP NULL,
|
||||
mod_deleted_at TIMESTAMP NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (model_weight_token, media_file_token),
|
||||
|
||||
KEY index_model_weight_token (model_weight_token),
|
||||
KEY index_media_file_token (media_file_token)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
@@ -200,11 +200,6 @@ CREATE TABLE tts_models (
|
||||
-- The last moderator that made changes.
|
||||
maybe_mod_user_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- ========== MIGRATION DETAILS ==========
|
||||
|
||||
-- If migrated to model_weights, this is the new token
|
||||
maybe_migration_new_model_weights_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- ========== VECTOR CLOCK ==========
|
||||
|
||||
-- Incremented with every update.
|
||||
|
||||
@@ -99,11 +99,6 @@ CREATE TABLE vocoder_models (
|
||||
-- The last moderator that made changes.
|
||||
maybe_mod_user_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- ========== MIGRATION DETAILS ==========
|
||||
|
||||
-- If migrated to model_weights, this is the new token
|
||||
maybe_migration_new_model_weights_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- ========== VECTOR CLOCK ==========
|
||||
|
||||
-- Incremented with every update.
|
||||
|
||||
@@ -53,14 +53,6 @@ CREATE TABLE users (
|
||||
|
||||
-- ========== DISPLAY / PROFILE ==========
|
||||
|
||||
-- The "avatar" image is a media file of type image that serves as a
|
||||
-- small avatar or profile picture icon.
|
||||
maybe_avatar_media_file_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- The "cover" image is a media file of type image that covers the
|
||||
-- top of the page.
|
||||
maybe_cover_media_file_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- Gravatar image hashes are precomputed.
|
||||
email_gravatar_hash CHAR(32) NOT NULL,
|
||||
|
||||
@@ -170,9 +162,7 @@ CREATE TABLE users (
|
||||
UNIQUE KEY (token),
|
||||
UNIQUE KEY (username),
|
||||
UNIQUE KEY (email_address),
|
||||
KEY fk_user_role_slug (user_role_slug),
|
||||
KEY fk_maybe_avatar_media_file_token (maybe_avatar_media_file_token),
|
||||
KEY fk_maybe_cover_media_file_token (maybe_cover_media_file_token)
|
||||
KEY fk_user_role_slug (user_role_slug)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
|
||||
|
||||
@@ -121,11 +121,6 @@ CREATE TABLE voice_conversion_models (
|
||||
-- If a moderator has comments.
|
||||
maybe_mod_comments VARCHAR(255) DEFAULT NULL,
|
||||
|
||||
-- ========== MIGRATION DETAILS ==========
|
||||
|
||||
-- If migrated to model_weights, this is the new token
|
||||
maybe_migration_new_model_weights_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- ========== VECTOR CLOCK ==========
|
||||
|
||||
-- Incremented with every update.
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
pub trait descriptor {
|
||||
fn my_method(&self);
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
pub mod bucket_directory;
|
||||
pub mod bucket_file_path;
|
||||
pub mod web_file_manager;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
pub struct FileBucketPath {
|
||||
pub bucket_clients: BucketClients
|
||||
}
|
||||
|
||||
impl web_file_manager {
|
||||
pub fn new(my_field: i32) -> Self {
|
||||
web_file_manager { my_field }
|
||||
}
|
||||
|
||||
pub fn increment(&mut self) {
|
||||
self.my_field += 1;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_new() {
|
||||
let my_class = web_file_manager::new(10);
|
||||
assert_eq!(my_class.my_field, 10);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_increment() {
|
||||
let mut my_class = web_file_manager::new(10);
|
||||
my_class.increment();
|
||||
assert_eq!(my_class.my_field, 11);
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,4 @@ pub mod media_files;
|
||||
pub mod media_uploads;
|
||||
pub mod public_path;
|
||||
pub mod voice_conversion_results;
|
||||
pub mod weight_uploads;
|
||||
pub mod weight_files;
|
||||
pub mod weight_uploads;
|
||||
@@ -1,75 +0,0 @@
|
||||
use crockford::crockford_entropy_lower;
|
||||
|
||||
use crate::public::public_path::PublicPath;
|
||||
use crate::util::hashed_directory_path_long_string::hashed_directory_path_long_string;
|
||||
|
||||
// TODO: Generate these from a macro.
|
||||
// TODO: Use a central path registry for quick reference
|
||||
const WEIGHT_FILE_DIRECTORY: &str = "/weights";
|
||||
|
||||
/// Directory for user weight uploads.
|
||||
/// Each uploaded file gets its own directory so that we can store the original
|
||||
/// file alongside re-processed derivatives.
|
||||
#[derive(Clone)]
|
||||
pub struct WeightFileBucketDirectory {
|
||||
object_hash: String,
|
||||
directory: String,
|
||||
}
|
||||
|
||||
impl PublicPath for WeightFileBucketDirectory {}
|
||||
|
||||
impl WeightFileBucketDirectory {
|
||||
|
||||
pub fn generate_new() -> Self {
|
||||
let entropy = crockford_entropy_lower(32);
|
||||
Self::from_object_hash(&entropy)
|
||||
}
|
||||
|
||||
pub fn from_object_hash(object_hash: &str) -> Self {
|
||||
// TODO: Path construction could be cleaner.
|
||||
let middle = hashed_directory_path_long_string(object_hash);
|
||||
let directory = format!("{}/{}{}", WEIGHT_FILE_DIRECTORY, middle, object_hash);
|
||||
Self {
|
||||
object_hash: object_hash.to_string(),
|
||||
directory,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_directory_path_str(&self) -> &str {
|
||||
&self.directory
|
||||
}
|
||||
|
||||
pub fn get_object_hash(&self) -> &str {
|
||||
&self.object_hash
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::public::weight_files::bucket_directory::WeightFileBucketDirectory;
|
||||
|
||||
#[test]
|
||||
pub fn generate_new_entropy() {
|
||||
let directory = WeightFileBucketDirectory::generate_new();
|
||||
assert_eq!(directory.get_object_hash().len(), 32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn get_directory_path_str() {
|
||||
let directory = WeightFileBucketDirectory::from_object_hash("abcdefghijk");
|
||||
assert_eq!(directory.get_directory_path_str(), "/weights/a/b/c/d/e/abcdefghijk");
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn get_directory_path_str_short_name() {
|
||||
let directory = WeightFileBucketDirectory::from_object_hash("foo");
|
||||
assert_eq!(directory.get_directory_path_str(), "/weights/f/o/foo");
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn get_object_hash() {
|
||||
let hash = "abcdefghijk";
|
||||
let directory = WeightFileBucketDirectory::from_object_hash(hash);
|
||||
assert_eq!(directory.get_object_hash(), hash);
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crockford::crockford_entropy_lower;
|
||||
use crate::public::public_path::PublicPath;
|
||||
|
||||
const ORIGINAL_FILE_BASENAME : &str = "file.bin";
|
||||
|
||||
// TODO: Generate these from a macro.
|
||||
use crate::public::weight_files::bucket_directory::WeightFileBucketDirectory;
|
||||
/// The original user upload file.
|
||||
/// It may have derivative files (down samples, crops, etc.) that live alongside it.
|
||||
#[derive(Clone)]
|
||||
pub struct WeightFileBucketPath {
|
||||
directory: WeightFileBucketDirectory,
|
||||
|
||||
filename: String,
|
||||
full_object_path: String,
|
||||
|
||||
optional_prefix: Option<String>,
|
||||
/// NB: Extension contains the leading period, eg. ".mp4"
|
||||
optional_extension: Option<String>,
|
||||
}
|
||||
|
||||
impl PublicPath for WeightFileBucketPath {}
|
||||
|
||||
impl WeightFileBucketPath {
|
||||
|
||||
pub fn generate_new(optional_prefix: Option<&str>, optional_extension: Option<&str>) -> Self {
|
||||
let entropy = crockford_entropy_lower(32);
|
||||
Self::from_object_hash(&entropy, optional_prefix, optional_extension)
|
||||
}
|
||||
|
||||
pub fn from_object_hash(hash: &str, optional_prefix: Option<&str>, optional_extension: Option<&str>) -> Self {
|
||||
// TODO: Path construction could be cleaner.
|
||||
let directory = WeightFileBucketDirectory::from_object_hash(hash);
|
||||
|
||||
let filename = match (optional_prefix, optional_extension) {
|
||||
(None, None) => ORIGINAL_FILE_BASENAME.to_string(),
|
||||
(None, Some(ext)) => format!("{}{}", hash, ext),
|
||||
(Some(pre), None) => format!("{}{}", pre, hash),
|
||||
(Some(pre), Some(ext)) => format!("{}{}{}", pre, hash, ext),
|
||||
};
|
||||
|
||||
let full_object_path = format!("{}/{}", directory.get_directory_path_str(), filename);
|
||||
|
||||
Self {
|
||||
directory,
|
||||
filename,
|
||||
full_object_path,
|
||||
optional_prefix: optional_prefix.map(|p| p.to_string()),
|
||||
optional_extension: optional_extension.map(|e| e.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_full_object_path_str(&self) -> &str {
|
||||
&self.full_object_path
|
||||
}
|
||||
|
||||
pub fn to_full_object_pathbuf(&self) -> PathBuf {
|
||||
PathBuf::from(&self.full_object_path)
|
||||
}
|
||||
|
||||
pub fn get_directory(&self) -> &WeightFileBucketDirectory {
|
||||
&self.directory
|
||||
}
|
||||
|
||||
pub fn get_object_hash(&self) -> &str {
|
||||
&self.directory.get_object_hash()
|
||||
}
|
||||
|
||||
pub fn get_basename(&self) -> &str {
|
||||
&self.filename
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::public::weight_files::bucket_file_path::WeightFileBucketPath;
|
||||
mod with_prefix_and_extension {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
pub fn generate_new_entropy() {
|
||||
let file = WeightFileBucketPath::generate_new(Some("pre_"), Some(".mp4"));
|
||||
assert_eq!(file.get_object_hash().len(), 32);
|
||||
assert_eq!(file.get_object_hash().len(), 32);
|
||||
assert_eq!(file.get_directory().get_object_hash().len(), 32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn get_full_object_path_str() {
|
||||
let file = WeightFileBucketPath::from_object_hash("abcdefghijk", Some("pre_"), Some(".mp4"));
|
||||
assert_eq!(file.get_full_object_path_str(), "/weights/a/b/c/d/e/abcdefghijk/pre_abcdefghijk.mp4");
|
||||
assert_eq!(file.get_basename(), "pre_abcdefghijk.mp4");
|
||||
}
|
||||
}
|
||||
|
||||
mod without_prefix_and_extension {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
pub fn generate_new_entropy() {
|
||||
let file = WeightFileBucketPath::generate_new(None, None);
|
||||
assert_eq!(file.get_object_hash().len(), 32);
|
||||
assert_eq!(file.get_directory().get_object_hash().len(), 32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn get_full_object_path_str() {
|
||||
let file = WeightFileBucketPath::from_object_hash("abcdefghijk", None, None);
|
||||
assert_eq!(file.get_full_object_path_str(), "/weights/a/b/c/d/e/abcdefghijk/file.bin");
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn to_full_object_pathbuf() {
|
||||
let file = WeightFileBucketPath::from_object_hash("abcdefghijk", None, None);
|
||||
assert_eq!(file.to_full_object_pathbuf(), PathBuf::from("/weights/a/b/c/d/e/abcdefghijk/file.bin"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn get_full_object_path_str_short_name() {
|
||||
let file = WeightFileBucketPath::from_object_hash("foo", None, None);
|
||||
assert_eq!(file.get_full_object_path_str(), "/weights/f/o/foo/file.bin");
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn get_full_object_path_str_starts_with_directory() {
|
||||
let file = WeightFileBucketPath::from_object_hash("abcdefghijk", None, None);
|
||||
let full_path = file.get_full_object_path_str();
|
||||
assert!(full_path.starts_with(file.get_directory().get_directory_path_str()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn get_object_hash() {
|
||||
let hash = "abcdefghijk";
|
||||
let file = WeightFileBucketPath::from_object_hash(hash, None, None);
|
||||
assert_eq!(file.get_object_hash(), hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
pub mod bucket_directory;
|
||||
pub mod bucket_file_path;
|
||||
@@ -13,14 +13,6 @@ pub enum CommentEntityType {
|
||||
#[serde(rename = "user")]
|
||||
User,
|
||||
|
||||
/// Media files
|
||||
#[serde(rename = "media_file")]
|
||||
MediaFile,
|
||||
|
||||
/// Model weights
|
||||
#[serde(rename = "model_weight")]
|
||||
ModelWeight,
|
||||
|
||||
/// TTS model (architecture does not matter)
|
||||
#[serde(rename = "tts_model")]
|
||||
TtsModel,
|
||||
@@ -47,8 +39,6 @@ impl CommentEntityType {
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::User => "user",
|
||||
Self::MediaFile => "media_file",
|
||||
Self::ModelWeight => "model_weight",
|
||||
Self::TtsModel => "tts_model",
|
||||
Self::TtsResult => "tts_result",
|
||||
Self::W2lTemplate => "w2l_template",
|
||||
@@ -59,8 +49,6 @@ impl CommentEntityType {
|
||||
pub fn from_str(value: &str) -> Result<Self, String> {
|
||||
match value {
|
||||
"user" => Ok(Self::User),
|
||||
"media_file" => Ok(Self::MediaFile),
|
||||
"model_weight" => Ok(Self::ModelWeight),
|
||||
"tts_model" => Ok(Self::TtsModel),
|
||||
"tts_result" => Ok(Self::TtsResult),
|
||||
"w2l_template" => Ok(Self::W2lTemplate),
|
||||
@@ -81,8 +69,6 @@ mod tests {
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(CommentEntityType::User, "user");
|
||||
assert_serialization(CommentEntityType::MediaFile, "media_file");
|
||||
assert_serialization(CommentEntityType::ModelWeight, "model_weight");
|
||||
assert_serialization(CommentEntityType::TtsModel, "tts_model");
|
||||
assert_serialization(CommentEntityType::TtsResult, "tts_result");
|
||||
assert_serialization(CommentEntityType::W2lTemplate, "w2l_template");
|
||||
@@ -96,8 +82,6 @@ mod tests {
|
||||
#[test]
|
||||
fn test_to_str() {
|
||||
assert_eq!(CommentEntityType::User.to_str(), "user");
|
||||
assert_eq!(CommentEntityType::MediaFile.to_str(), "media_file");
|
||||
assert_eq!(CommentEntityType::ModelWeight.to_str(), "model_weight");
|
||||
assert_eq!(CommentEntityType::TtsModel.to_str(), "tts_model");
|
||||
assert_eq!(CommentEntityType::TtsResult.to_str(), "tts_result");
|
||||
assert_eq!(CommentEntityType::W2lTemplate.to_str(), "w2l_template");
|
||||
@@ -107,8 +91,6 @@ mod tests {
|
||||
#[test]
|
||||
fn test_from_str() {
|
||||
assert_eq!(CommentEntityType::from_str("user").unwrap(), CommentEntityType::User);
|
||||
assert_eq!(CommentEntityType::from_str("media_file").unwrap(), CommentEntityType::MediaFile);
|
||||
assert_eq!(CommentEntityType::from_str("model_weight").unwrap(), CommentEntityType::ModelWeight);
|
||||
assert_eq!(CommentEntityType::from_str("tts_model").unwrap(), CommentEntityType::TtsModel);
|
||||
assert_eq!(CommentEntityType::from_str("tts_result").unwrap(), CommentEntityType::TtsResult);
|
||||
assert_eq!(CommentEntityType::from_str("w2l_template").unwrap(), CommentEntityType::W2lTemplate);
|
||||
|
||||
@@ -26,8 +26,8 @@ pub enum InferenceCategory {
|
||||
#[serde(rename = "voice_conversion")]
|
||||
VoiceConversion,
|
||||
|
||||
#[serde(rename = "rerender_a_video")]
|
||||
RerenderAVideo,
|
||||
#[serde(rename = "video_filter")]
|
||||
VideoFilter,
|
||||
}
|
||||
|
||||
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
|
||||
@@ -41,7 +41,7 @@ impl InferenceCategory {
|
||||
Self::LipsyncAnimation => "lipsync_animation",
|
||||
Self::TextToSpeech => "text_to_speech",
|
||||
Self::VoiceConversion => "voice_conversion",
|
||||
Self::RerenderAVideo => "rerender_a_video",
|
||||
Self::VideoFilter => "video_filter",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ impl InferenceCategory {
|
||||
"lipsync_animation" => Ok(Self::LipsyncAnimation),
|
||||
"text_to_speech" => Ok(Self::TextToSpeech),
|
||||
"voice_conversion" => Ok(Self::VoiceConversion),
|
||||
"rerender_a_video" => Ok(Self::RerenderAVideo),
|
||||
"video_filter" => Ok(Self::VideoFilter),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ impl InferenceCategory {
|
||||
Self::LipsyncAnimation,
|
||||
Self::TextToSpeech,
|
||||
Self::VoiceConversion,
|
||||
Self::RerenderAVideo,
|
||||
Self::VideoFilter,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ mod tests {
|
||||
assert_serialization(InferenceCategory::LipsyncAnimation, "lipsync_animation");
|
||||
assert_serialization(InferenceCategory::TextToSpeech, "text_to_speech");
|
||||
assert_serialization(InferenceCategory::VoiceConversion, "voice_conversion");
|
||||
assert_serialization(InferenceCategory::RerenderAVideo, "rerender_a_video");
|
||||
assert_serialization(InferenceCategory::VideoFilter, "video_filter");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -85,7 +85,7 @@ mod tests {
|
||||
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::RerenderAVideo.to_str(), "rerender_a_video");
|
||||
assert_eq!(InferenceCategory::VideoFilter.to_str(), "video_filter");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -93,7 +93,7 @@ mod tests {
|
||||
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("rerender_a_video").unwrap(), InferenceCategory::RerenderAVideo);
|
||||
assert_eq!(InferenceCategory::from_str("video_filter").unwrap(), InferenceCategory::VideoFilter);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -104,7 +104,7 @@ mod tests {
|
||||
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::RerenderAVideo));
|
||||
assert_eq!(variants.pop_first(), Some(InferenceCategory::VideoFilter));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
|
||||
// Generated check
|
||||
|
||||
@@ -21,9 +21,9 @@ pub enum IdCategory {
|
||||
#[serde(rename = "lipsync_animation")]
|
||||
LipsyncAnimationResult,
|
||||
|
||||
// Results from rerender a video
|
||||
#[serde(rename = "rerender")]
|
||||
RerenderResult,
|
||||
// Results from video filters
|
||||
#[serde(rename = "video_filter")]
|
||||
VideoFilterResult,
|
||||
|
||||
/// Results from tacotron2
|
||||
/// Applies for RVC and SVC
|
||||
@@ -66,7 +66,7 @@ impl IdCategory {
|
||||
Self::ZeroShotVoiceDataset => "zs_dataset",
|
||||
Self::ZeroShotVoiceEmbedding => "zs_voice",
|
||||
Self::ZeroShotTtsResult => "zs_tts_result",
|
||||
Self::RerenderResult => "rerender",
|
||||
Self::VideoFilterResult => "video_filter",
|
||||
Self::ModelWeights => "model_weights",
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ impl IdCategory {
|
||||
"zs_dataset" => Ok(Self::ZeroShotVoiceDataset),
|
||||
"zs_voice" => Ok(Self::ZeroShotVoiceEmbedding),
|
||||
"zs_tts_result" => Ok(Self::ZeroShotTtsResult),
|
||||
"rerender" => Ok(Self::RerenderResult),
|
||||
"video_filter" => Ok(Self::VideoFilterResult),
|
||||
"model_weights" => Ok(Self::ModelWeights),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
@@ -92,7 +92,7 @@ impl IdCategory {
|
||||
BTreeSet::from([
|
||||
Self::MediaFile,
|
||||
Self::LipsyncAnimationResult,
|
||||
Self::RerenderResult,
|
||||
Self::VideoFilterResult,
|
||||
Self::TtsResult,
|
||||
Self::VoiceConversionResult,
|
||||
Self::ZeroShotTtsResult,
|
||||
@@ -115,7 +115,7 @@ mod tests {
|
||||
fn test_serialization() {
|
||||
assert_serialization(IdCategory::MediaFile, "media_file");
|
||||
assert_serialization(IdCategory::LipsyncAnimationResult, "lipsync_animation");
|
||||
assert_serialization(IdCategory::RerenderResult, "rerender");
|
||||
assert_serialization(IdCategory::VideoFilterResult, "video_filter");
|
||||
assert_serialization(IdCategory::TtsResult, "tts_result");
|
||||
assert_serialization(IdCategory::VoiceConversionResult, "voice_conversion");
|
||||
assert_serialization(IdCategory::ZeroShotVoiceDataset, "zs_dataset");
|
||||
@@ -128,7 +128,7 @@ mod tests {
|
||||
fn to_str() {
|
||||
assert_eq!(IdCategory::MediaFile.to_str(), "media_file");
|
||||
assert_eq!(IdCategory::LipsyncAnimationResult.to_str(), "lipsync_animation");
|
||||
assert_eq!(IdCategory::RerenderResult.to_str(), "rerender");
|
||||
assert_eq!(IdCategory::VideoFilterResult.to_str(), "video_filter");
|
||||
assert_eq!(IdCategory::TtsResult.to_str(), "tts_result");
|
||||
assert_eq!(IdCategory::VoiceConversionResult.to_str(), "voice_conversion");
|
||||
assert_eq!(IdCategory::ZeroShotVoiceDataset.to_str(), "zs_dataset");
|
||||
@@ -141,7 +141,7 @@ mod tests {
|
||||
fn from_str() {
|
||||
assert_eq!(IdCategory::from_str("media_file").unwrap(), IdCategory::MediaFile);
|
||||
assert_eq!(IdCategory::from_str("lipsync_animation").unwrap(), IdCategory::LipsyncAnimationResult);
|
||||
assert_eq!(IdCategory::from_str("rerender").unwrap(), IdCategory::RerenderResult);
|
||||
assert_eq!(IdCategory::from_str("video_filter").unwrap(), IdCategory::VideoFilterResult);
|
||||
assert_eq!(IdCategory::from_str("tts_result").unwrap(), IdCategory::TtsResult);
|
||||
assert_eq!(IdCategory::from_str("voice_conversion").unwrap(), IdCategory::VoiceConversionResult);
|
||||
assert_eq!(IdCategory::from_str("zs_dataset").unwrap(), IdCategory::ZeroShotVoiceDataset);
|
||||
@@ -157,7 +157,7 @@ mod tests {
|
||||
assert_eq!(variants.len(), 9);
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::MediaFile));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::LipsyncAnimationResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::RerenderResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::VideoFilterResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::TtsResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::VoiceConversionResult));
|
||||
assert_eq!(variants.pop_first(), Some(IdCategory::ZeroShotTtsResult));
|
||||
|
||||
+10
-10
@@ -39,9 +39,9 @@ pub enum MediaFileOriginProductCategory {
|
||||
#[serde(rename = "zs_voice")]
|
||||
ZeroShotVoice,
|
||||
|
||||
// Media files for Rerender
|
||||
#[serde(rename = "rerender")]
|
||||
Rerender,
|
||||
// Media files for video filters
|
||||
#[serde(rename = "video_filter")]
|
||||
VideoFilter,
|
||||
}
|
||||
|
||||
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
|
||||
@@ -58,7 +58,7 @@ impl MediaFileOriginProductCategory {
|
||||
Self::Unknown => "unknown",
|
||||
Self::VoiceConversion => "voice_conversion",
|
||||
Self::ZeroShotVoice => "zs_voice",
|
||||
Self::Rerender => "rerender",
|
||||
Self::VideoFilter => "video_filter",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ impl MediaFileOriginProductCategory {
|
||||
"unknown" => Ok(Self::Unknown),
|
||||
"voice_conversion" => Ok(Self::VoiceConversion),
|
||||
"zs_voice" => Ok(Self::ZeroShotVoice),
|
||||
"rerender" => Ok(Self::Rerender),
|
||||
"video_filter" => Ok(Self::VideoFilter),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ impl MediaFileOriginProductCategory {
|
||||
BTreeSet::from([
|
||||
Self::FaceAnimator,
|
||||
Self::TextToSpeech,
|
||||
Self::Rerender,
|
||||
Self::VideoFilter,
|
||||
Self::Unknown,
|
||||
Self::VoiceConversion,
|
||||
Self::ZeroShotVoice,
|
||||
@@ -103,7 +103,7 @@ mod tests {
|
||||
assert_serialization(MediaFileOriginProductCategory::Unknown, "unknown");
|
||||
assert_serialization(MediaFileOriginProductCategory::VoiceConversion, "voice_conversion");
|
||||
assert_serialization(MediaFileOriginProductCategory::ZeroShotVoice, "zs_voice");
|
||||
assert_serialization(MediaFileOriginProductCategory::Rerender, "rerender")
|
||||
assert_serialization(MediaFileOriginProductCategory::VideoFilter, "video_filter")
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -113,7 +113,7 @@ mod tests {
|
||||
assert_eq!(MediaFileOriginProductCategory::Unknown.to_str(), "unknown");
|
||||
assert_eq!(MediaFileOriginProductCategory::VoiceConversion.to_str(), "voice_conversion");
|
||||
assert_eq!(MediaFileOriginProductCategory::ZeroShotVoice.to_str(), "zs_voice");
|
||||
assert_eq!(MediaFileOriginProductCategory::Rerender.to_str(), "rerender");
|
||||
assert_eq!(MediaFileOriginProductCategory::VideoFilter.to_str(), "video_filter");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -123,7 +123,7 @@ mod tests {
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("unknown").unwrap(), MediaFileOriginProductCategory::Unknown);
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("voice_conversion").unwrap(), MediaFileOriginProductCategory::VoiceConversion);
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("zs_voice").unwrap(), MediaFileOriginProductCategory::ZeroShotVoice);
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("rerender").unwrap(), MediaFileOriginProductCategory::Rerender);
|
||||
assert_eq!(MediaFileOriginProductCategory::from_str("video_filter").unwrap(), MediaFileOriginProductCategory::VideoFilter);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -135,7 +135,7 @@ mod tests {
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::Unknown));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::VoiceConversion));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::ZeroShotVoice));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::Rerender));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileOriginProductCategory::VideoFilter));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@ use std::collections::BTreeSet;
|
||||
use strum::EnumCount;
|
||||
#[cfg(test)]
|
||||
use strum::EnumIter;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
|
||||
use utoipa::ToSchema;
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize, ToSchema)]
|
||||
pub enum WeightsCategory {
|
||||
@@ -50,7 +51,7 @@ impl WeightsCategory {
|
||||
}
|
||||
impl_enum_display_and_debug_using_to_str!(WeightsCategory);
|
||||
impl_mysql_enum_coders!(WeightsCategory);
|
||||
impl_mysql_from_row!(WeightsCategory);
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
@@ -72,7 +72,7 @@ impl WeightsType {
|
||||
|
||||
impl_enum_display_and_debug_using_to_str!(WeightsType);
|
||||
impl_mysql_enum_coders!(WeightsType);
|
||||
impl_mysql_from_row!(WeightsType);
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
@@ -33,10 +33,6 @@ pub enum UserBookmarkEntityType {
|
||||
#[serde(rename = "media_file")]
|
||||
MediaFile,
|
||||
|
||||
/// ModelWeight (the new way to store models)
|
||||
#[serde(rename = "model_weight")]
|
||||
ModelWeight,
|
||||
|
||||
/// VoiceConversionModel
|
||||
#[serde(rename = "voice_conversion_model")]
|
||||
VoiceConversionModel,
|
||||
@@ -60,7 +56,6 @@ impl UserBookmarkEntityType {
|
||||
Self::W2lTemplate => "w2l_template",
|
||||
Self::W2lResult => "w2l_result",
|
||||
Self::MediaFile => "media_file",
|
||||
Self::ModelWeight => "model_weight",
|
||||
Self::VoiceConversionModel => "voice_conversion_model",
|
||||
Self::ZsVoice => "zs_voice",
|
||||
}
|
||||
@@ -74,7 +69,6 @@ impl UserBookmarkEntityType {
|
||||
"w2l_template" => Ok(Self::W2lTemplate),
|
||||
"w2l_result" => Ok(Self::W2lResult),
|
||||
"media_file" => Ok(Self::MediaFile),
|
||||
"model_weight" => Ok(Self::ModelWeight),
|
||||
"voice_conversion_model" => Ok(Self::VoiceConversionModel),
|
||||
"zs_voice" => Ok(Self::ZsVoice),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
@@ -98,7 +92,6 @@ mod tests {
|
||||
assert_serialization(UserBookmarkEntityType::W2lTemplate, "w2l_template");
|
||||
assert_serialization(UserBookmarkEntityType::W2lResult, "w2l_result");
|
||||
assert_serialization(UserBookmarkEntityType::MediaFile, "media_file");
|
||||
assert_serialization(UserBookmarkEntityType::ModelWeight, "model_weight");
|
||||
assert_serialization(UserBookmarkEntityType::VoiceConversionModel, "voice_conversion_model");
|
||||
assert_serialization(UserBookmarkEntityType::ZsVoice, "zs_voice");
|
||||
}
|
||||
@@ -115,7 +108,6 @@ mod tests {
|
||||
assert_eq!(UserBookmarkEntityType::W2lTemplate.to_str(), "w2l_template");
|
||||
assert_eq!(UserBookmarkEntityType::W2lResult.to_str(), "w2l_result");
|
||||
assert_eq!(UserBookmarkEntityType::MediaFile.to_str(), "media_file");
|
||||
assert_eq!(UserBookmarkEntityType::ModelWeight.to_str(), "model_weight");
|
||||
assert_eq!(UserBookmarkEntityType::VoiceConversionModel.to_str(), "voice_conversion_model");
|
||||
assert_eq!(UserBookmarkEntityType::ZsVoice.to_str(), "zs_voice");
|
||||
}
|
||||
@@ -128,7 +120,6 @@ mod tests {
|
||||
assert_eq!(UserBookmarkEntityType::from_str("w2l_template").unwrap(), UserBookmarkEntityType::W2lTemplate);
|
||||
assert_eq!(UserBookmarkEntityType::from_str("w2l_result").unwrap(), UserBookmarkEntityType::W2lResult);
|
||||
assert_eq!(UserBookmarkEntityType::from_str("media_file").unwrap(), UserBookmarkEntityType::MediaFile);
|
||||
assert_eq!(UserBookmarkEntityType::from_str("model_weight").unwrap(), UserBookmarkEntityType::ModelWeight);
|
||||
assert_eq!(UserBookmarkEntityType::from_str("voice_conversion_model").unwrap(), UserBookmarkEntityType::VoiceConversionModel);
|
||||
assert_eq!(UserBookmarkEntityType::from_str("zs_voice").unwrap(), UserBookmarkEntityType::ZsVoice);
|
||||
assert!(UserBookmarkEntityType::from_str("foo").is_err());
|
||||
|
||||
@@ -9,14 +9,6 @@ use strum::EnumIter;
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Deserialize, Serialize)]
|
||||
pub enum UserRatingEntityType {
|
||||
/// Media files (inference results, uploads, etc.)
|
||||
#[serde(rename = "media_file")]
|
||||
MediaFile,
|
||||
|
||||
/// Model weights (modern, polymorphic, type agnostic)
|
||||
#[serde(rename = "model_weight")]
|
||||
ModelWeight,
|
||||
|
||||
/// TTS model (architecture does not matter)
|
||||
#[serde(rename = "tts_model")]
|
||||
TtsModel,
|
||||
@@ -42,8 +34,6 @@ impl_mysql_enum_coders!(UserRatingEntityType);
|
||||
impl UserRatingEntityType {
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::MediaFile => "media_file",
|
||||
Self::ModelWeight => "model_weight",
|
||||
Self::TtsModel => "tts_model",
|
||||
Self::TtsResult => "tts_result",
|
||||
Self::W2lTemplate => "w2l_template",
|
||||
@@ -53,8 +43,6 @@ impl UserRatingEntityType {
|
||||
|
||||
pub fn from_str(value: &str) -> Result<Self, String> {
|
||||
match value {
|
||||
"media_file" => Ok(Self::MediaFile),
|
||||
"model_weight" => Ok(Self::ModelWeight),
|
||||
"tts_model" => Ok(Self::TtsModel),
|
||||
"tts_result" => Ok(Self::TtsResult),
|
||||
"w2l_template" => Ok(Self::W2lTemplate),
|
||||
@@ -74,8 +62,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(UserRatingEntityType::MediaFile, "media_file");
|
||||
assert_serialization(UserRatingEntityType::ModelWeight, "model_weight");
|
||||
assert_serialization(UserRatingEntityType::TtsModel, "tts_model");
|
||||
assert_serialization(UserRatingEntityType::TtsResult, "tts_result");
|
||||
assert_serialization(UserRatingEntityType::W2lTemplate, "w2l_template");
|
||||
@@ -88,8 +74,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_to_str() {
|
||||
assert_eq!(UserRatingEntityType::MediaFile.to_str(), "media_file");
|
||||
assert_eq!(UserRatingEntityType::ModelWeight.to_str(), "model_weight");
|
||||
assert_eq!(UserRatingEntityType::TtsModel.to_str(), "tts_model");
|
||||
assert_eq!(UserRatingEntityType::TtsResult.to_str(), "tts_result");
|
||||
assert_eq!(UserRatingEntityType::W2lTemplate.to_str(), "w2l_template");
|
||||
@@ -98,8 +82,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_from_str() {
|
||||
assert_eq!(UserRatingEntityType::from_str("media_file").unwrap(), UserRatingEntityType::MediaFile);
|
||||
assert_eq!(UserRatingEntityType::from_str("model_weight").unwrap(), UserRatingEntityType::ModelWeight);
|
||||
assert_eq!(UserRatingEntityType::from_str("tts_model").unwrap(), UserRatingEntityType::TtsModel);
|
||||
assert_eq!(UserRatingEntityType::from_str("tts_result").unwrap(), UserRatingEntityType::TtsResult);
|
||||
assert_eq!(UserRatingEntityType::from_str("w2l_template").unwrap(), UserRatingEntityType::W2lTemplate);
|
||||
|
||||
@@ -25,9 +25,7 @@ serde = "1.0.125"
|
||||
serde_derive = "1.0.125"
|
||||
|
||||
# Random
|
||||
rand = { version = "0.8.5", features = ["std_rng"] }
|
||||
|
||||
once_cell = { version = "1.18.0", features = [] }
|
||||
rand = "0.8.5"
|
||||
|
||||
sqlx = { version = "0.7.2", features = [ "mysql", "runtime-tokio", "tls-rustls", "chrono" ] }
|
||||
sqlx-core = { version = "0.7.2" }
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
use std::sync::{Arc, LockResult, RwLock, RwLockWriteGuard};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use rand::rngs::StdRng;
|
||||
use rand::SeedableRng;
|
||||
|
||||
// FIXME(bt,2023-12-14): Is this threadsafe? Looks like it should be fine.
|
||||
/// Only use this in tests (and dev seed tools), never in production!
|
||||
#[derive(Clone)]
|
||||
pub struct DeterministicRng {
|
||||
rng : Arc<RwLock<StdRng>>
|
||||
}
|
||||
|
||||
impl DeterministicRng {
|
||||
pub fn get_instance() -> LockResult<RwLockWriteGuard<'static, DeterministicRng>> {
|
||||
static DETERMINISTIC_RNG : Lazy<Arc<RwLock<DeterministicRng>>> = Lazy::new(|| {
|
||||
Arc::new(RwLock::new(DeterministicRng::new()))
|
||||
});
|
||||
|
||||
DETERMINISTIC_RNG.write()
|
||||
}
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
rng: Arc::new(RwLock::new(StdRng::seed_from_u64(0)))
|
||||
}
|
||||
}
|
||||
|
||||
/// Reset the deterministic RNG's seed.
|
||||
pub fn reset_rng(&self, state: u64) {
|
||||
match self.rng.write() {
|
||||
Err(err) => panic!(format!("test panic due to rng failure {err}")),
|
||||
Ok(mut lock) => {
|
||||
*lock = StdRng::seed_from_u64(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Grab the deterministic RNG
|
||||
pub fn get_rng(&self) -> LockResult<RwLockWriteGuard<StdRng>>{
|
||||
self.rng.write()
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,6 @@ pub(crate) static MINIMUM_CHARACTER_ENTROPY : usize = 8;
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
pub (crate) mod deterministic_rng;
|
||||
pub (crate) mod prefixes;
|
||||
|
||||
pub mod tokens;
|
||||
|
||||
@@ -60,41 +60,6 @@ macro_rules! impl_crockford_generator {
|
||||
$t(token)
|
||||
}
|
||||
|
||||
/// Constructor for a new token to be used **DETERMINISTICALLY** in tests and seeding.
|
||||
/// This will not use a real RNG, so do not use in production code!
|
||||
/// Once called, it will output the same random numbers in sequence.
|
||||
pub fn reset_rng_for_testing_and_dev_seeding_never_use_in_production_seriously(state: u64) {
|
||||
let deterministic = crate::deterministic_rng::DeterministicRng::get_instance().expect("tests should not fail due to mutex");
|
||||
deterministic.reset_rng(state);
|
||||
}
|
||||
|
||||
/// Constructor for a new token to be used **DETERMINISTICALLY** in tests and seeding.
|
||||
/// This will not use a real RNG, so do not use in production code!
|
||||
/// Once called, it will output the same random numbers in sequence.
|
||||
pub fn generate_for_testing_and_dev_seeding_never_use_in_production_seriously() -> Self {
|
||||
use rand::Rng;
|
||||
|
||||
// FIXME(bt,2023-12-14): This is bad error handling. (Maybe panic if lock is poisoned?)
|
||||
let deterministic = crate::deterministic_rng::DeterministicRng::get_instance().expect("tests should not fail due to mutex");
|
||||
let mut rng = deterministic.get_rng().expect("tests should not fail due to mutex");
|
||||
|
||||
let charset = Self::token_character_set();
|
||||
let entropy_length = Self::entropic_character_len();
|
||||
|
||||
let entropy_part: String = (0..entropy_length)
|
||||
.map(|_| {
|
||||
let idx = rng.gen_range(0..charset.len());
|
||||
charset[idx] as char
|
||||
})
|
||||
.collect();
|
||||
|
||||
let token_prefix = Self::token_prefix();
|
||||
|
||||
let token = format!("{}{}", token_prefix, entropy_part);
|
||||
|
||||
$t(token)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn entropy_suffix(&self) -> &str {
|
||||
use crate::prefixes::PrefixGenerator;
|
||||
|
||||
@@ -21,25 +21,6 @@ mod interface {
|
||||
assert!(token.to_string().starts_with("m_"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn generate_for_testing_and_dev_seeding_never_use_in_production_seriously_1() {
|
||||
// NB: Using the same reset seed will produce the same results each time
|
||||
MediaFileToken::reset_rng_for_testing_and_dev_seeding_never_use_in_production_seriously(0);
|
||||
assert_eq!(MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously().as_str(), "m_q8sz47gmfw2zx02snrbz88ns9m16ab");
|
||||
assert_eq!(MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously().as_str(), "m_ma1xetxrwbh39vg639a9zrq8b9wk6h");
|
||||
assert_eq!(MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously().as_str(), "m_4tswec8z27wnm01njypx4vmfhgj41e");
|
||||
// NB: Same seed -> same tokens generated
|
||||
MediaFileToken::reset_rng_for_testing_and_dev_seeding_never_use_in_production_seriously(0);
|
||||
assert_eq!(MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously().as_str(), "m_q8sz47gmfw2zx02snrbz88ns9m16ab");
|
||||
assert_eq!(MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously().as_str(), "m_ma1xetxrwbh39vg639a9zrq8b9wk6h");
|
||||
assert_eq!(MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously().as_str(), "m_4tswec8z27wnm01njypx4vmfhgj41e");
|
||||
// Once more...
|
||||
MediaFileToken::reset_rng_for_testing_and_dev_seeding_never_use_in_production_seriously(0);
|
||||
assert_eq!(MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously().as_str(), "m_q8sz47gmfw2zx02snrbz88ns9m16ab");
|
||||
assert_eq!(MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously().as_str(), "m_ma1xetxrwbh39vg639a9zrq8b9wk6h");
|
||||
assert_eq!(MediaFileToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously().as_str(), "m_4tswec8z27wnm01njypx4vmfhgj41e");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new() {
|
||||
let token = MediaFileToken::new("m_foo".to_string());
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
use clap::Parser;
|
||||
|
||||
use errors::AnyhowResult;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name="dev-database-seed")]
|
||||
pub struct CliArgs {
|
||||
#[arg(name="seed_cloud_bucket", long="bucket", help="Seed the cloud bucket with files", required=false, default_value_t=false)]
|
||||
pub seed_cloud_bucket: bool,
|
||||
|
||||
#[arg(name="seed_elasticsearch", long="elasticsearch", help="Seed the local elasticsearch", required=false, default_value_t=false)]
|
||||
pub seed_elasticsearch: bool,
|
||||
}
|
||||
|
||||
pub fn parse_cli_args() -> AnyhowResult<CliArgs> {
|
||||
Ok(CliArgs::parse())
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
from types import Optional
|
||||
|
||||
class FileInfo:
|
||||
size_in_bytes: int
|
||||
mime_type: str
|
||||
file_name: str
|
||||
|
||||
class BucketDetails:
|
||||
bucket_hash: str
|
||||
maybe_bucket_name: Optional[str]
|
||||
maybe_bucket_extension: Optional[str]
|
||||
|
||||
|
||||
class MediaFileBucketDirectory:
|
||||
object_hash: str
|
||||
directory: str
|
||||
optional_prefix: Optional[str]
|
||||
optional_prefix_extension: Optional[str]
|
||||
original_file_base_name: str
|
||||
|
||||
class WeightsType:
|
||||
directory: float
|
||||
|
||||
class FileOperationManager:
|
||||
def __init__(self, bucket,bucket_info:BucketDetails):
|
||||
self.bucket = bucket
|
||||
self.bucket_info = bucket_info
|
||||
|
||||
def check_if_file_exists_in_db(self, file_token: str, callback) -> bool:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
use std::{path::Path, string};
|
||||
use errors::{anyhow, AnyhowResult};
|
||||
use log::{info, warn};
|
||||
use rand::Rng;
|
||||
use sqlx::{MySql, Pool};
|
||||
|
||||
use buckets::public::weight_files::bucket_file_path::WeightFileBucketPath;
|
||||
use enums::{
|
||||
by_table::model_weights::{weights_category::WeightsCategory, weights_types::WeightsType},
|
||||
common::visibility::Visibility,
|
||||
};
|
||||
use filesys::file_read_bytes::file_read_bytes;
|
||||
use filesys::file_size::file_size;
|
||||
use filesys::path_to_string::path_to_string;
|
||||
use hashing::sha256::sha256_hash_file::sha256_hash_file;
|
||||
use mimetypes::mimetype_for_bytes::get_mimetype_for_bytes;
|
||||
use mysql_queries::queries::model_weights::create_weight::{
|
||||
create_weight,
|
||||
CreateModelWeightsArgs,
|
||||
};
|
||||
use storyteller_root::get_seed_tool_data_root;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
use crate::bucket_clients::BucketClients;
|
||||
use crate::seeding::users::HANASHI_USER_TOKEN;
|
||||
|
||||
pub async fn seed_weights_files(
|
||||
mysql_pool: &Pool<MySql>,
|
||||
maybe_bucket_clients: Option<&BucketClients>
|
||||
) -> AnyhowResult<()> {
|
||||
info!("Seeding weights files...");
|
||||
|
||||
// NB: Stable token generation.
|
||||
ModelWeightToken::reset_rng_for_testing_and_dev_seeding_never_use_in_production_seriously(123);
|
||||
|
||||
let seeded_weights = [
|
||||
(
|
||||
HANASHI_USER_TOKEN,
|
||||
"m_21jxt406aattq2cna1xtgf5m4mjyy1",
|
||||
WeightsType::LoRA,
|
||||
WeightsCategory::ImageGeneration,
|
||||
"Niji Mecha",
|
||||
"models/imagegen/loRA/nijiMecha.safetensors",
|
||||
),
|
||||
(
|
||||
HANASHI_USER_TOKEN,
|
||||
"m_cxzabpxf88h10rshqraksxbqmhs412",
|
||||
WeightsType::StableDiffusion15,
|
||||
WeightsCategory::ImageGeneration,
|
||||
"Niji Diffused Mix",
|
||||
"models/imagegen/sd15/nijidiffusedmix_v40.safetensors",
|
||||
),
|
||||
(
|
||||
HANASHI_USER_TOKEN,
|
||||
"m_21jxt406aattq2cna1xtgf5m4mjyy9",
|
||||
WeightsType::LoRA,
|
||||
WeightsCategory::ImageGeneration,
|
||||
"Niji Mecha",
|
||||
"models/imagegen/loRA/nijiMecha.safetensors",
|
||||
),
|
||||
(
|
||||
HANASHI_USER_TOKEN,
|
||||
"m_cxzabpxf88h10rshqraksxbqmhs413",
|
||||
WeightsType::StableDiffusion15,
|
||||
WeightsCategory::ImageGeneration,
|
||||
"Niji Diffused Mix",
|
||||
"models/imagegen/sd15/nijidiffusedmix_v40.safetensors",
|
||||
),
|
||||
];
|
||||
|
||||
let seed_tool_data_root = get_seed_tool_data_root();
|
||||
|
||||
for (
|
||||
user_token,
|
||||
weights_file_token,
|
||||
weights_type,
|
||||
weights_category,
|
||||
model_name,
|
||||
subdirectory_path,
|
||||
) in seeded_weights {
|
||||
let user_token = UserToken::new_from_str(user_token);
|
||||
// prepare the inputs for a model
|
||||
let mut rng = rand::thread_rng();
|
||||
let n: u32 = rng.gen();
|
||||
|
||||
let model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
|
||||
let title = model_name;
|
||||
let description = "This is a description";
|
||||
let description_rendered_html = "This is a description rendered html";
|
||||
let original_filename = "model.safetensors";
|
||||
let original_download_url = "https://example.com/model.safetensors";
|
||||
let thumbnail_token = format!("{}", n);
|
||||
|
||||
// let public_bucket_hash: String = weights_file_token.to_string();
|
||||
// let public_bucket_prefix = weights_type.to_string();
|
||||
// let public_bucket_extension = weights_category.to_string();
|
||||
|
||||
let cached_user_ratings_total_count = n.clone();
|
||||
let cached_user_ratings_positive_count = n.clone();
|
||||
let cached_user_ratings_negative_count = n.clone();
|
||||
let cached_user_ratings_ratio = 100.0 as f32;
|
||||
let version = 1;
|
||||
|
||||
// get the abs path of the weights file to upload.
|
||||
let mut weight_file_path = seed_tool_data_root.clone();
|
||||
weight_file_path.push(subdirectory_path);
|
||||
|
||||
let file_size_bytes = file_size(weight_file_path.clone())?;
|
||||
let sha256_checksum = sha256_hash_file(weight_file_path.clone())?;
|
||||
|
||||
let bucket_details = seed_model(
|
||||
&mysql_pool,
|
||||
&model_weight_token,
|
||||
&user_token,
|
||||
weights_type,
|
||||
&weight_file_path,
|
||||
maybe_bucket_clients
|
||||
).await;
|
||||
let bucket_details_data = bucket_details.unwrap();
|
||||
|
||||
let bucket_hash = bucket_details_data.bucket_hash;
|
||||
let maybe_bucket_prefix = bucket_details_data.maybe_bucket_prefix.as_deref().unwrap();
|
||||
let maybe_bucket_extension = bucket_details_data.maybe_bucket_extension.as_deref().unwrap();
|
||||
|
||||
let create_model_weights_args = CreateModelWeightsArgs {
|
||||
token: &model_weight_token,
|
||||
weights_type, // Assuming weights_type is defined elsewhere
|
||||
weights_category, // Assuming weights_category is defined elsewhere
|
||||
title: title.to_string(),
|
||||
maybe_thumbnail_token: Some(thumbnail_token),
|
||||
description_markdown: description.to_string(),
|
||||
description_rendered_html: description_rendered_html.to_string(),
|
||||
creator_user_token: Some(&user_token),
|
||||
creator_ip_address: "127.0.0.1", // Assuming the IP address is localhost
|
||||
creator_set_visibility: Visibility::Public, // Assuming the visibility is public
|
||||
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_checksum_sha2: sha256_checksum.to_string(), // Assuming the file checksum is an empty string
|
||||
private_bucket_hash: bucket_hash,
|
||||
maybe_private_bucket_prefix: Some(maybe_bucket_prefix.to_string()),
|
||||
maybe_private_bucket_extension: Some(maybe_bucket_extension.to_string()),
|
||||
cached_user_ratings_total_count,
|
||||
cached_user_ratings_positive_count,
|
||||
cached_user_ratings_negative_count,
|
||||
maybe_cached_user_ratings_ratio: Some(cached_user_ratings_ratio),
|
||||
version,
|
||||
mysql_pool: &mysql_pool, // Assuming mysql_pool is defined elsewhere
|
||||
};
|
||||
|
||||
create_weight(create_model_weights_args).await?;
|
||||
|
||||
|
||||
info!("Seeded {:?}", weight_file_path)
|
||||
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct BucketDetails {
|
||||
bucket_hash: String,
|
||||
maybe_bucket_prefix: Option<String>,
|
||||
maybe_bucket_extension: Option<String>,
|
||||
}
|
||||
|
||||
async fn seed_model(
|
||||
mysql_pool: &Pool<MySql>,
|
||||
model_weight_token: &ModelWeightToken,
|
||||
user_token: &UserToken,
|
||||
weight_type: WeightsType,
|
||||
weight_file_path: &Path,
|
||||
maybe_bucket_clients: Option<&BucketClients>
|
||||
) -> AnyhowResult<BucketDetails> {
|
||||
info!("Seeding Media file {:?} ...", weight_file_path);
|
||||
// mutable variables
|
||||
if let Some(bucket_clients) = maybe_bucket_clients {
|
||||
let bucket_details = seed_file_to_bucket(weight_file_path, bucket_clients,weight_type).await?;
|
||||
return Ok(bucket_details);
|
||||
}
|
||||
Err(anyhow!("No bucket clients provided!"))
|
||||
|
||||
}
|
||||
|
||||
async fn seed_file_to_bucket(
|
||||
weight_file_path: &Path,
|
||||
bucket_clients: &BucketClients,
|
||||
weight_type: WeightsType,
|
||||
) -> AnyhowResult<BucketDetails> {
|
||||
info!("Uploading weights file {:?} ...", weight_file_path);
|
||||
|
||||
let maybe_bucket_prefix = Some(format!("{}_",weight_type.to_str()));
|
||||
let maybe_bucket_prefix = maybe_bucket_prefix.as_deref();
|
||||
|
||||
let maybe_bucket_extension = weight_file_path
|
||||
.extension()
|
||||
.map(|extension| extension.to_str())
|
||||
.flatten();
|
||||
// we should just have this be file bucket path and then we can use a file descriptor to turn it into a specific type of path
|
||||
let bucket_location = WeightFileBucketPath::generate_new(
|
||||
maybe_bucket_prefix,
|
||||
maybe_bucket_extension
|
||||
);
|
||||
|
||||
let bucket_path = path_to_string(bucket_location.to_full_object_pathbuf());
|
||||
|
||||
info!("Reading weights file: {:?}", weight_file_path);
|
||||
|
||||
let bytes = file_read_bytes(weight_file_path)?;
|
||||
let mimetype = get_mimetype_for_bytes(&bytes).unwrap_or("application/octet-stream");
|
||||
|
||||
info!("Copy this line here! Uploading weights file to bucket path: {:?}", bucket_path);
|
||||
|
||||
let _r = bucket_clients.public.upload_file_with_content_type(
|
||||
&bucket_path,
|
||||
bytes.as_ref(),
|
||||
mimetype
|
||||
).await?;
|
||||
|
||||
Ok(BucketDetails {
|
||||
bucket_hash: bucket_location.get_object_hash().to_string(),
|
||||
maybe_bucket_prefix: maybe_bucket_prefix.map(|s| s.to_string()),
|
||||
maybe_bucket_extension: maybe_bucket_extension.map(|s| s.to_string()),
|
||||
})
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
use errors::AnyhowResult;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name="dev-upload-media-file")]
|
||||
pub struct RawArgs {
|
||||
#[arg(name="file", short='f', long="file", help="File to upload", required=true)]
|
||||
pub file_path: String,
|
||||
}
|
||||
|
||||
pub struct CliArgs {
|
||||
pub file_path: PathBuf,
|
||||
}
|
||||
|
||||
pub fn parse_cli_args() -> AnyhowResult<CliArgs> {
|
||||
let args = RawArgs::parse();
|
||||
|
||||
Ok(CliArgs {
|
||||
file_path: PathBuf::from(args.file_path),
|
||||
})
|
||||
}
|
||||
@@ -33,8 +33,8 @@ my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
|
||||
|
||||
# External
|
||||
log = "0.4.14"
|
||||
clap = "4.4.8"
|
||||
rand = "0.8.5"
|
||||
clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated
|
||||
|
||||
# Runtime
|
||||
# NB: We switched to Tokio from `async-std` for broader ecosystem support.
|
||||
tokio = { version = "1.34.0", features = ["macros"] }
|
||||
@@ -0,0 +1,28 @@
|
||||
use clap::{App, Arg};
|
||||
|
||||
use errors::AnyhowResult;
|
||||
|
||||
pub struct CliArgs {
|
||||
pub seed_cloud_bucket: bool,
|
||||
pub seed_elasticsearch: bool,
|
||||
}
|
||||
|
||||
pub fn parse_cli_args() -> AnyhowResult<CliArgs> {
|
||||
let matches = App::new("dev-database-seed")
|
||||
.arg(Arg::with_name("seed_cloud_bucket")
|
||||
.long("bucket")
|
||||
.help("Seed the cloud bucket with files")
|
||||
.takes_value(false)
|
||||
.required(false))
|
||||
.arg(Arg::with_name("seed_elasticsearch")
|
||||
.long("elasticsearch")
|
||||
.help("Seed the local elasticsearch")
|
||||
.takes_value(false)
|
||||
.required(false))
|
||||
.get_matches();
|
||||
|
||||
Ok(CliArgs {
|
||||
seed_cloud_bucket: matches.is_present("seed_cloud_bucket"),
|
||||
seed_elasticsearch: matches.is_present("seed_elasticsearch"),
|
||||
})
|
||||
}
|
||||
@@ -7,8 +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_model_weights::seed_weights_files; // V2 v3 will come later on when everything is more conslidated and clear.
|
||||
use crate::seeding::model_weights::seed_weights;
|
||||
use crate::seeding::seed_media_files::seed_media_files;
|
||||
use crate::seeding::tts_tacotron2::seed_tts_tacotron2;
|
||||
use crate::seeding::users::seed_user_accounts;
|
||||
@@ -61,9 +60,6 @@ pub async fn main() -> AnyhowResult<()> {
|
||||
seed_weights(&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?;
|
||||
|
||||
info!("Done!");
|
||||
Ok(())
|
||||
+1
-2
@@ -3,5 +3,4 @@ pub mod seed_media_files;
|
||||
pub mod tts_tacotron2;
|
||||
pub mod users;
|
||||
pub mod voice_conversion;
|
||||
pub mod zero_shot_tts;
|
||||
pub mod seed_model_weights;
|
||||
pub mod zero_shot_tts;
|
||||
+21
-23
@@ -132,7 +132,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
- Gawr Gura MOS 4
|
||||
"#;
|
||||
|
||||
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
model_weight_token = ModelWeightToken(format!("{}", i));
|
||||
title = format!("Gawr Gura: {}", i);
|
||||
description = format!("Description Number {} The special edition offers significantly better quality with fewer issues. It's the model as initially envisioned.", i);
|
||||
description_rendered_html = rvc_markdown_description;
|
||||
@@ -155,7 +155,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
},
|
||||
21..=40 =>{
|
||||
// TTS
|
||||
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
model_weight_token = ModelWeightToken(format!("{}", i));
|
||||
title = format!("dragonfruitGTv1: {}", i);
|
||||
|
||||
description = format!("Description Number {}:", i);
|
||||
@@ -187,7 +187,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
},
|
||||
41..=60 => {
|
||||
// SD 1.5
|
||||
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
model_weight_token = ModelWeightToken(format!("{}", i));
|
||||
title = format!("dragonfruitGTv1: {}", i);
|
||||
|
||||
description = format!("Description Number {}:", i);
|
||||
@@ -232,7 +232,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
"#;
|
||||
let sdxl_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/be706282-2978-42a0-aaa2-73881aad94e9/width=1024/00049-2287632957-1girl,face,curly%20hair,red%20hair,white%20background,.jpeg";
|
||||
|
||||
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
model_weight_token = ModelWeightToken(format!("{}", i));
|
||||
title = format!("SDXL_Niji_Special Edition: {}", i);
|
||||
description = format!("Description Number {}:", i);
|
||||
|
||||
@@ -263,7 +263,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
"#;
|
||||
|
||||
let lora_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/123645df-dee2-4239-863a-76a150b09c32/width=1024/00000-2171948503.jpeg";
|
||||
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
model_weight_token = ModelWeightToken(format!("{}", i));
|
||||
title = format!("Gawr Gura LoRA: {}", i);
|
||||
|
||||
description = format!("Description Number {}:", i);
|
||||
@@ -295,7 +295,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
- Gawr Gura MOS 4
|
||||
"#;
|
||||
|
||||
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
model_weight_token = ModelWeightToken(format!("{}", i));
|
||||
title = format!("Gawr Gura: {}", i);
|
||||
description = format!("Description Number {} The special edition offers significantly better quality with fewer issues. It's the model as initially envisioned.", i);
|
||||
description_rendered_html = rvc_markdown_description;
|
||||
@@ -356,13 +356,11 @@ pub async fn seed_weights_for_user_token(
|
||||
) -> AnyhowResult<()> {
|
||||
info!("Seeding weights...");
|
||||
|
||||
ModelWeightToken::reset_rng_for_testing_and_dev_seeding_never_use_in_production_seriously(54321);
|
||||
|
||||
let model_weight_token1 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token2 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token3 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token4 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token5 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token1 = ModelWeightToken("11".to_string());
|
||||
let model_weight_token2 = ModelWeightToken("22".to_string());
|
||||
let model_weight_token3 = ModelWeightToken("33".to_string());
|
||||
let model_weight_token4 = ModelWeightToken("44".to_string());
|
||||
let model_weight_token5 = ModelWeightToken("55".to_string());
|
||||
|
||||
let model_weights_args = vec![
|
||||
CreateModelWeightsArgs {
|
||||
@@ -505,20 +503,20 @@ pub async fn seed_weights_for_user_token(
|
||||
|
||||
|
||||
pub async fn original_seed_weights(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 creator_token1 = UserToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token1 = ModelWeightToken("1".to_string());
|
||||
let creator_token1 = UserToken("creatorToken1".to_string());
|
||||
|
||||
let model_weight_token2 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let creator_token2 = UserToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token2 = ModelWeightToken("2".to_string());
|
||||
let creator_token2 = UserToken("creatorToken2".to_string());
|
||||
|
||||
let model_weight_token3 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let creator_token3 = UserToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token3 = ModelWeightToken("3".to_string());
|
||||
let creator_token3 = UserToken("creatorToken3".to_string());
|
||||
|
||||
let model_weight_token4 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let creator_token4 = UserToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token4 = ModelWeightToken("4".to_string());
|
||||
let creator_token4 = UserToken("creatorToken4".to_string());
|
||||
|
||||
let model_weight_token5 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let creator_token5 = UserToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token5 = ModelWeightToken("5".to_string());
|
||||
let creator_token5 = UserToken("creatorToken5".to_string());
|
||||
|
||||
let model_weights_args = vec![
|
||||
CreateModelWeightsArgs {
|
||||
+1
-1
@@ -29,7 +29,7 @@ tokens = { path = "../../_types/tokens" }
|
||||
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
|
||||
|
||||
# External
|
||||
clap = "4.4.8"
|
||||
clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated
|
||||
log = "0.4.14"
|
||||
|
||||
# Runtime
|
||||
@@ -0,0 +1,27 @@
|
||||
use std::path::PathBuf;
|
||||
use clap::{App, Arg};
|
||||
use errors::{anyhow, AnyhowResult};
|
||||
|
||||
pub struct CliArgs {
|
||||
pub file_path: PathBuf,
|
||||
}
|
||||
|
||||
pub fn parse_cli_args() -> AnyhowResult<CliArgs> {
|
||||
let matches = App::new("dev_upload_media")
|
||||
.arg(Arg::with_name("file")
|
||||
.short("f")
|
||||
.long("file")
|
||||
.value_name("FILE")
|
||||
.help("File to upload")
|
||||
.takes_value(true)
|
||||
.required(true))
|
||||
.get_matches();
|
||||
|
||||
let file_path = matches.value_of("file")
|
||||
.map(|val| val.trim().to_string())
|
||||
.ok_or(anyhow!("no file path supplied"))?;
|
||||
|
||||
Ok(CliArgs {
|
||||
file_path: PathBuf::from(file_path),
|
||||
})
|
||||
}
|
||||
@@ -29,7 +29,7 @@ my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
|
||||
|
||||
# External
|
||||
log = "0.4.14"
|
||||
clap = "4.4.8"
|
||||
clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated
|
||||
strum = { version = "0.25", features = ["derive"] }
|
||||
|
||||
# Runtime
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use clap::Parser;
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use strum::{EnumCount, EnumString, IntoEnumIterator};
|
||||
use strum::EnumIter;
|
||||
|
||||
use errors::{anyhow, AnyhowResult, bail};
|
||||
|
||||
pub struct ParsedArgs {
|
||||
pub struct CliArgs {
|
||||
pub mysql_environment: Environment,
|
||||
pub elasticsearch_environment: Environment,
|
||||
pub action: Action,
|
||||
@@ -25,38 +25,53 @@ pub enum Action {
|
||||
SearchTts,
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name="elasticsearch-cli")]
|
||||
pub struct Args {
|
||||
#[arg(name="action", long="action", help="action to take", required=true)]
|
||||
action: String,
|
||||
pub fn parse_cli_args() -> AnyhowResult<CliArgs> {
|
||||
let matches = App::new("dev-database-seed")
|
||||
.arg(Arg::with_name("action")
|
||||
.long("action")
|
||||
.help("action to take")
|
||||
.takes_value(true)
|
||||
.required(true))
|
||||
.arg(Arg::with_name("mysql")
|
||||
.long("mysql")
|
||||
.help("Production or development")
|
||||
.takes_value(true)
|
||||
.required(false))
|
||||
.arg(Arg::with_name("elasticsearch")
|
||||
.long("elasticsearch")
|
||||
.help("Production or development")
|
||||
.takes_value(true)
|
||||
.required(false))
|
||||
.get_matches();
|
||||
|
||||
#[arg(name="mysql", long="mysql", help="production or development")]
|
||||
mysql: Option<String>,
|
||||
|
||||
#[arg(name="elasticsearch", long="elasticsearch", help="production or development")]
|
||||
elasticsearch: Option<String>,
|
||||
}
|
||||
|
||||
pub fn parse_cli_args() -> AnyhowResult<ParsedArgs> {
|
||||
let args = Args::parse();
|
||||
|
||||
Ok(ParsedArgs {
|
||||
mysql_environment: to_environment(args.mysql.as_deref())?,
|
||||
elasticsearch_environment: to_environment(args.elasticsearch.as_deref())?,
|
||||
action: action_from_str(&args.action)?,
|
||||
Ok(CliArgs {
|
||||
mysql_environment: to_environment(&matches, "mysql")?,
|
||||
elasticsearch_environment: to_environment(&matches, "elasticsearch")?,
|
||||
action: get_action(&matches)?,
|
||||
})
|
||||
}
|
||||
|
||||
fn to_environment(environment: Option<&str>) -> AnyhowResult<Environment> {
|
||||
Ok(match environment {
|
||||
fn to_environment(matches: &ArgMatches, key: &str) -> AnyhowResult<Environment> {
|
||||
let value = matches.value_of(key)
|
||||
.map(|s| s.to_lowercase());
|
||||
|
||||
Ok(match value.as_deref() {
|
||||
None => Environment::Development,
|
||||
Some("dev") | Some("development") => Environment::Development,
|
||||
Some("prod") | Some("production") => Environment::Production,
|
||||
_ => bail!("invalid environment: {:?}", environment),
|
||||
_ => bail!("invalid environment: {:?}", value),
|
||||
})
|
||||
}
|
||||
|
||||
fn get_action(matches: &ArgMatches) -> AnyhowResult<Action> {
|
||||
let action = matches.value_of("action")
|
||||
.map(|s| action_from_str(s))
|
||||
.transpose()?
|
||||
.ok_or(anyhow!("no action provided"))?;
|
||||
|
||||
Ok(action)
|
||||
}
|
||||
|
||||
fn action_from_str(value: &str) -> AnyhowResult<Action> {
|
||||
let action = Action::from_str(value)
|
||||
.map_err(|err| {
|
||||
|
||||
@@ -21,7 +21,7 @@ logging = { path = "../../lib/logging" }
|
||||
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
|
||||
|
||||
# External
|
||||
clap = { version = "4.4.8", features = ["derive"] }
|
||||
clap = { version = "4.4.7", features = ["derive"] }
|
||||
walkdir = "2.4.0"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
[package]
|
||||
name = "migration-tool"
|
||||
edition = "2018"
|
||||
version = "0.0.1"
|
||||
authors = [
|
||||
"Brandon Thomas <bt@brand.io>",
|
||||
"Brandon Thomas <echelon@gmail.com>",
|
||||
]
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
name = "migration-tool"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
# Internal
|
||||
buckets = { path = "../../_types/buckets" }
|
||||
config = { path = "../../lib/deprecated/config" }
|
||||
easyenv = { path = "../../lib/easyenv" }
|
||||
enums = { path = "../../_types/enums" }
|
||||
errors = { path = "../../lib/errors" }
|
||||
mysql_queries = { path = "../../lib/mysql_queries" }
|
||||
storyteller_root = { path = "../../lib/storyteller_root" }
|
||||
tokens = { path = "../../_types/tokens" }
|
||||
|
||||
# Workspace hack (faster compile times)
|
||||
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
|
||||
|
||||
# External
|
||||
clap = "4.4.8"
|
||||
log = "0.4.14"
|
||||
strum = { version = "0.25", features = ["derive"] }
|
||||
|
||||
# Async + clients
|
||||
tokio = { version = "1.34.0", features = ["macros"] }
|
||||
sqlx = { version = "0.7.2", features = [ "mysql", "runtime-tokio", "tls-rustls", "chrono" ] }
|
||||
|
||||
# Serialization
|
||||
serde = "1.0.125"
|
||||
serde_derive = "1.0.125"
|
||||
serde_json = "1.0.108"
|
||||
|
||||
[dev-dependencies]
|
||||
# None yet
|
||||
@@ -1,23 +0,0 @@
|
||||
//! migration-tool
|
||||
//!
|
||||
//! Migrate database records.
|
||||
//!
|
||||
|
||||
|
||||
use config::shared_constants::DEFAULT_RUST_LOG;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn main() -> AnyhowResult<()> {
|
||||
println!("migration-tool: migrate database records");
|
||||
|
||||
easyenv::init_all_with_default_logging(Some(DEFAULT_RUST_LOG));
|
||||
|
||||
// NB: This secrets file differs from the rest because we might actually want to cross
|
||||
// development/production boundaries for migration. We don't want to pull in secrets
|
||||
// from other sources. (Hopefully this isn't getting out of hand at this point.)
|
||||
easyenv::from_filename(".env-migration-tool-secrets")?;
|
||||
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -22,5 +22,5 @@ web_scrapers = { path = "../../lib/web_scrapers" }
|
||||
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
|
||||
|
||||
# External
|
||||
clap = "4.4.8"
|
||||
clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated
|
||||
tokio = { version = "1.34.0", features = ["macros"] }
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
use clap::Parser;
|
||||
use clap::{App, Arg};
|
||||
|
||||
use errors::AnyhowResult;
|
||||
use errors::{anyhow, AnyhowResult};
|
||||
use web_scrapers::scrape_supported_webpage::scrape_supported_webpage;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "scrape_test")]
|
||||
pub struct Args {
|
||||
#[arg(name="url", short='u', long = "url", help = "URL of the page to scrape", required = true)]
|
||||
url: String,
|
||||
|
||||
#[arg(name="print_html", long = "html", help = "Print the HTML scraped", required = true)]
|
||||
print_html: bool,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn main() -> AnyhowResult<()> {
|
||||
let args = Args::parse();
|
||||
let matches = App::new("scrape_test")
|
||||
.arg(Arg::with_name("url")
|
||||
.short("u")
|
||||
.long("url")
|
||||
.value_name("URL")
|
||||
.help("URL of the page to scrape")
|
||||
.takes_value(true)
|
||||
.required(true))
|
||||
.arg(Arg::with_name("print_html")
|
||||
.long("html")
|
||||
.help("Print the HTML scraped")
|
||||
.takes_value(false)
|
||||
.required(false))
|
||||
.get_matches();
|
||||
|
||||
let url = args.url.trim().to_string();
|
||||
let print_html = args.print_html;
|
||||
let url = matches.value_of("url")
|
||||
.map(|val| val.trim().to_string())
|
||||
.ok_or(anyhow!("no url supplied"))?;
|
||||
|
||||
let print_html = matches.is_present("print_html");
|
||||
|
||||
let scrape_result = scrape_supported_webpage(&url).await?;
|
||||
|
||||
|
||||
-8
@@ -1,6 +1,4 @@
|
||||
use enums::by_table::user_ratings::entity_type::UserRatingEntityType;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::tts_models::TtsModelToken;
|
||||
use tokens::tokens::w2l_templates::W2lTemplateToken;
|
||||
|
||||
@@ -14,8 +12,6 @@ use tokens::tokens::w2l_templates::W2lTemplateToken;
|
||||
/// NB: We probably don't want to expose this type of interface to web clients because it's
|
||||
/// monotonous as a JSON interface.
|
||||
pub enum UserRatingEntity {
|
||||
MediaFile(MediaFileToken),
|
||||
ModelWeight(ModelWeightToken),
|
||||
TtsModel(TtsModelToken),
|
||||
W2lTemplate(W2lTemplateToken),
|
||||
}
|
||||
@@ -24,8 +20,6 @@ pub enum UserRatingEntity {
|
||||
impl UserRatingEntity {
|
||||
pub fn get_entity_type(&self) -> UserRatingEntityType {
|
||||
match self {
|
||||
UserRatingEntity::MediaFile(_) => UserRatingEntityType::MediaFile,
|
||||
UserRatingEntity::ModelWeight(_) => UserRatingEntityType::ModelWeight,
|
||||
UserRatingEntity::TtsModel(_) => UserRatingEntityType::TtsModel,
|
||||
UserRatingEntity::W2lTemplate(_) => UserRatingEntityType::W2lTemplate,
|
||||
}
|
||||
@@ -33,8 +27,6 @@ impl UserRatingEntity {
|
||||
|
||||
pub fn get_entity_token_str(&self) -> &str {
|
||||
match self {
|
||||
UserRatingEntity::MediaFile(token) => token.as_str(),
|
||||
UserRatingEntity::ModelWeight(token) => token.as_str(),
|
||||
UserRatingEntity::TtsModel(token) => token.as_str(),
|
||||
UserRatingEntity::W2lTemplate(token) => token.as_str(),
|
||||
}
|
||||
|
||||
+5
-5
@@ -37,9 +37,9 @@ pub enum InferenceCategoryAbbreviated {
|
||||
#[serde(alias = "voice_conversion")]
|
||||
VoiceConversion,
|
||||
|
||||
#[serde(rename = "rr")] // NB: DO NOT CHANGE. It could break live jobs. Renamed to be fewer bytes.
|
||||
#[serde(alias = "rerender_a_video")]
|
||||
RerenderAVideo,
|
||||
#[serde(rename = "vf")] // NB: DO NOT CHANGE. It could break live jobs. Renamed to be fewer bytes.
|
||||
#[serde(alias = "video_filter")]
|
||||
VideoFilter,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
|
||||
@@ -112,7 +112,7 @@ impl InferenceCategoryAbbreviated {
|
||||
InferenceCategory::LipsyncAnimation => Self::LipsyncAnimation,
|
||||
InferenceCategory::TextToSpeech => Self::TextToSpeech,
|
||||
InferenceCategory::VoiceConversion => Self::VoiceConversion,
|
||||
InferenceCategory::RerenderAVideo => Self::RerenderAVideo,
|
||||
InferenceCategory::VideoFilter => Self::VideoFilter,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ impl InferenceCategoryAbbreviated {
|
||||
Self::LipsyncAnimation => InferenceCategory::LipsyncAnimation,
|
||||
Self::TextToSpeech => InferenceCategory::TextToSpeech,
|
||||
Self::VoiceConversion => InferenceCategory::VoiceConversion,
|
||||
Self::RerenderAVideo => InferenceCategory::RerenderAVideo,
|
||||
Self::VideoFilter => InferenceCategory::VideoFilter,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-1
@@ -1,3 +1,5 @@
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
/// Video sources can be one of several:
|
||||
/// - F: media_files (todo)
|
||||
/// - U: media_uploads (legacy)
|
||||
@@ -32,5 +34,25 @@ pub struct RerenderArgs {
|
||||
|
||||
#[serde(rename = "sd")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_sd_model: Option<String>,
|
||||
pub maybe_sd_model_token: Option<ModelWeightToken>,
|
||||
|
||||
#[serde(rename = "lora")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_lora_model_token: Option<ModelWeightToken>,
|
||||
|
||||
#[serde(rename = "p")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_prompt: Option<String>,
|
||||
|
||||
#[serde(rename = "ap")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_a_prompt: Option<String>,
|
||||
|
||||
#[serde(rename = "np")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_n_prompt: Option<String>,
|
||||
|
||||
#[serde(rename = "se")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub maybe_seed: Option<i32>,
|
||||
}
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
use enums::by_table::comments::comment_entity_type::CommentEntityType;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::tts_models::TtsModelToken;
|
||||
use tokens::tokens::w2l_templates::W2lTemplateToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
pub enum CommentEntityToken {
|
||||
User(UserToken),
|
||||
MediaFile(MediaFileToken),
|
||||
ModelWeight(ModelWeightToken),
|
||||
TtsModel(TtsModelToken),
|
||||
TtsResult(String), // TODO: Strong type
|
||||
W2lTemplate(W2lTemplateToken),
|
||||
@@ -24,8 +20,6 @@ impl CommentEntityToken {
|
||||
CommentEntityType::TtsResult => Self::TtsResult(token.to_string()),
|
||||
CommentEntityType::W2lTemplate => Self::W2lTemplate(W2lTemplateToken::new_from_str(token)),
|
||||
CommentEntityType::W2lResult => Self::W2lResult(token.to_string()),
|
||||
CommentEntityType::MediaFile => Self::MediaFile(MediaFileToken::new_from_str(token)),
|
||||
CommentEntityType::ModelWeight => Self::ModelWeight(ModelWeightToken::new_from_str(token)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +30,6 @@ impl CommentEntityToken {
|
||||
CommentEntityToken::TtsResult(tts_result_token) => (CommentEntityType::TtsResult, tts_result_token.as_str()),
|
||||
CommentEntityToken::W2lTemplate(w2l_template_token) => (CommentEntityType::W2lTemplate, w2l_template_token.as_str()),
|
||||
CommentEntityToken::W2lResult(w2l_result_token) => (CommentEntityType::W2lResult, w2l_result_token.as_str()),
|
||||
CommentEntityToken::MediaFile(media_file_token) => (CommentEntityType::MediaFile, media_file_token.as_str()),
|
||||
CommentEntityToken::ModelWeight(model_weight_token) => (CommentEntityType::ModelWeight, model_weight_token.as_str()),
|
||||
};
|
||||
(entity_type, entity_token)
|
||||
}
|
||||
|
||||
+2
-2
@@ -178,7 +178,7 @@ fn raw_record_to_public_result(record: RawGenericInferenceJobStatus) -> GenericI
|
||||
InferenceCategory::LipsyncAnimation => Some("lipsync animation"),
|
||||
InferenceCategory::TextToSpeech => record.maybe_tts_model_title.as_deref(),
|
||||
InferenceCategory::VoiceConversion => record.maybe_voice_conversion_model_title.as_deref(),
|
||||
InferenceCategory::RerenderAVideo => Some("rerender animation"),
|
||||
InferenceCategory::VideoFilter => Some("Video Filter"),
|
||||
};
|
||||
|
||||
// NB: A bit of a hack. We store TTS results with a full path.
|
||||
@@ -187,7 +187,7 @@ fn raw_record_to_public_result(record: RawGenericInferenceJobStatus) -> GenericI
|
||||
InferenceCategory::LipsyncAnimation => (true, record.maybe_media_file_public_bucket_directory_hash.as_deref()),
|
||||
InferenceCategory::TextToSpeech => (false, record.maybe_tts_public_bucket_path.as_deref()),
|
||||
InferenceCategory::VoiceConversion => (true, record.maybe_voice_conversion_public_bucket_hash.as_deref()),
|
||||
InferenceCategory::RerenderAVideo => (true, record.maybe_media_file_public_bucket_directory_hash.as_deref()),
|
||||
InferenceCategory::VideoFilter => (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
|
||||
|
||||
@@ -55,7 +55,7 @@ pub async fn insert_media_file_from_rerender(
|
||||
|
||||
let next_rerender_id = transactional_increment_generic_synthetic_id(
|
||||
&user_token,
|
||||
IdCategory::RerenderResult,
|
||||
IdCategory::VideoFilterResult,
|
||||
&mut transaction
|
||||
).await?;
|
||||
|
||||
@@ -67,7 +67,7 @@ pub async fn insert_media_file_from_rerender(
|
||||
let creator_set_visibility = args.job.creator_set_visibility.clone();
|
||||
|
||||
const ORIGIN_CATEGORY : MediaFileOriginCategory = MediaFileOriginCategory::Inference;
|
||||
const ORIGIN_PRODUCT_CATEGORY : MediaFileOriginProductCategory = MediaFileOriginProductCategory::Rerender;
|
||||
const ORIGIN_PRODUCT_CATEGORY : MediaFileOriginProductCategory = MediaFileOriginProductCategory::VideoFilter;
|
||||
const ORIGIN_MODEL_TYPE : MediaFileOriginModelType = MediaFileOriginModelType::Rerender;
|
||||
const MEDIA_TYPE : MediaFileType = MediaFileType::Video;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user