mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-16 23:03:06 +00:00
uploading models and then reseed.
This commit is contained in:
1 parent
1b4e3cccb5
commit
aa202172a2
3 files changed
+293
-1
No files matched your search
@@ -2,6 +2,10 @@ use std::vec;
|
||||
|
||||
use log::info;
|
||||
use sqlx::{MySql, Pool};
|
||||
use cloud_storage::remote_file_manager::remote_cloud_file_manager::RemoteCloudFileClient;
|
||||
use cloud_storage::remote_file_manager::weights_descriptor;
|
||||
use cloud_storage::remote_file_manager::weights_descriptor::{WeightsLoRADescriptor, WeightsSD15Descriptor};
|
||||
use easyenv::from_filename;
|
||||
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
@@ -11,6 +15,7 @@ use enums::common::visibility::Visibility;
|
||||
use errors::{anyhow, AnyhowResult};
|
||||
use mysql_queries::queries::model_weights::create::create_weight::{create_weight, CreateModelWeightsArgs};
|
||||
use mysql_queries::queries::users::user::get_user_token_by_username::get_user_token_by_username;
|
||||
use storyteller_root::get_seed_tool_data_root;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
@@ -330,6 +335,291 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn seed_weights_for_testing_inference(mysql_pool: &Pool<MySql>, user_token: UserToken) -> AnyhowResult<()>{
|
||||
let miyhoyo_description = r#"一个面向米哈游角色的模型合集~A collection for MIHOYO Characters~
|
||||
对应人物tag记录在版本信息里,可在右侧“About this version”选项中查看。The corresponding character prompts are recorded in the version information and can be viewed in the About this version option on the right.
|
||||
打开目录寻找最爱~(附带链接,点击直达)~Open the catalog, find your favorites~ (with links, click to go directly):
|
||||
崩坏三 Honkai Impact 3rd:
|
||||
|
||||
梅比乌斯- Mobius
|
||||
|
||||
琪亚娜-Kiana:琪亚娜 合集-Collections for Kiana (Honkai Impact 3rd)
|
||||
|
||||
布洛妮娅-bronya:布洛妮娅 合集-Collections for Bronya (Honkai Impact 3rd | Honkai Star Rail)
|
||||
|
||||
芽衣:雷电芽衣 合集-Collections for Raiden Mei (Honkai Impact 3rd)
|
||||
|
||||
西琳-Sirin
|
||||
|
||||
魔法少女-Miracle ☆ Magical Girl
|
||||
|
||||
赤鸢-Jingwei
|
||||
|
||||
丹朱苍玄-Nuwa/Fuxi
|
||||
|
||||
李素裳-Li Sushang
|
||||
|
||||
玉骑士·月痕/锦岁玉团-Jade Knight/Auspicious Dazzle
|
||||
|
||||
卡莲-kallen
|
||||
|
||||
第六夜想曲-Sixth Serenade
|
||||
|
||||
符华-Fu hua
|
||||
|
||||
崩落
|
||||
|
||||
云墨丹心-Azure Empyrea
|
||||
|
||||
八重樱-Yae Sakura
|
||||
|
||||
逆神巫女-Gyakushinn Miko
|
||||
|
||||
御神装·勿忘-Goushinnso Memento
|
||||
|
||||
信花舞伎-Blooming Maiko
|
||||
|
||||
希尔-Seele
|
||||
|
||||
生死律者-Herrscher of Rebirth
|
||||
|
||||
栖于永夜-Eternal Night's Embrace
|
||||
|
||||
德莉莎-Theresa:德莉莎 合集-Collections for Theresa (Honkai Impact 3rd)
|
||||
|
||||
月下誓约-Lunar Vow: Crimson Love
|
||||
|
||||
月下初拥-Luna Kindred
|
||||
|
||||
花裳月纱-Rosy Bridesmaid
|
||||
|
||||
格蕾修-Griseo
|
||||
|
||||
繁星·绘世之卷-Starry Impression
|
||||
|
||||
天行·绘星之卷-Cosmic Expression
|
||||
|
||||
画中的童话-Maroon Riding Hood
|
||||
|
||||
原神 Genshin:
|
||||
|
||||
凝光-Ningguang
|
||||
|
||||
申鹤-Shenhe
|
||||
|
||||
妮露
|
||||
|
||||
诺艾尔
|
||||
|
||||
神里绫华(包含礼装)
|
||||
|
||||
甘雨(包含喜茶联动礼装)-Ganyu
|
||||
|
||||
胡桃(包含森罗联动礼装)-Hutao
|
||||
|
||||
琳妮特-Lynette
|
||||
|
||||
绮良良-Kirara
|
||||
|
||||
坎蒂丝-Candace
|
||||
|
||||
芙宁娜-Furina
|
||||
|
||||
芙宁娜/芙卡洛斯-Furina/Focalors
|
||||
|
||||
克洛琳德-Clorinde
|
||||
|
||||
娜维娅-Navia
|
||||
|
||||
丝柯克-Skirk
|
||||
|
||||
夏洛蒂-Charlotte
|
||||
|
||||
归终-Guizhong
|
||||
|
||||
闲云-Xianyun
|
||||
|
||||
千织-Chiori
|
||||
|
||||
夏沃蕾-Chevreuse
|
||||
|
||||
崩坏:星穹铁道 Honkai Star Rand:
|
||||
|
||||
驭空-Yukong
|
||||
|
||||
银狼-Silver Wolf
|
||||
|
||||
符玄-Fu Xuan
|
||||
|
||||
李素裳-Sushang
|
||||
|
||||
三月七(礼装)-March 7th (New Outfit)
|
||||
|
||||
停云-Tingyun
|
||||
|
||||
青雀-Qingque
|
||||
|
||||
布洛妮娅·兰德-Bronya Rand
|
||||
|
||||
镜流-Jingliu
|
||||
|
||||
卡芙卡-Kafka
|
||||
|
||||
托帕-Topaz
|
||||
|
||||
桂乃芬-Guinaifen
|
||||
|
||||
玲可-Lynx
|
||||
|
||||
佩拉-Peia
|
||||
|
||||
寒鸦-Hanya
|
||||
|
||||
藿藿-Huohuo
|
||||
|
||||
阮·梅-Ruan Mei
|
||||
|
||||
雪衣-Xueyi
|
||||
|
||||
希露瓦-Serval
|
||||
|
||||
绝区零 Zenless-zone-zero:
|
||||
|
||||
星见雅-Miyabi
|
||||
|
||||
猫宫又奈-Nekomata
|
||||
|
||||
艾莲·乔-Ellen
|
||||
|
||||
妮可-Nicole
|
||||
|
||||
苍角-Soukaku
|
||||
|
||||
格莉丝-Grace
|
||||
|
||||
珂蕾妲-koleda
|
||||
|
||||
可琳-Corin
|
||||
|
||||
其他 Others:
|
||||
|
||||
鹿鸣-Luming
|
||||
"""#;
|
||||
|
||||
let sd1_5_markdown_description = r#"
|
||||
00025-2161235528-1girl,(orange_hair_1.1),(zentangle, mandala, tangle, entangle_0.6),(fractal art),the most beautiful form of chaos,brutalist desi.png
|
||||
|
||||
|
||||
00010-1626070972-elf portrait,enchanting beauty,fantasy,ethereal glow,pointed ears,delicate facial features,long elegant hair,nature-themed attir.png
|
||||
|
||||
|
||||
00001-301370162-girl in a snowy landscape,winter coat,fluffy hood,white fur trim,breath visible in cold air,soft falling snowflakes,glistening s.png
|
||||
|
||||
|
||||
00002-3996269517-venomous sorcerer,ominous dark robes,glowing green eyes,holding a staff with a serpent design,mystical green flames,poisonous mi.png
|
||||
|
||||
|
||||
00003-3817469732-Thunder Deity,immense power,hovering above the sea,stormy ocean waves below,crackling lightning in fingertips,dramatic stormy cl.png
|
||||
|
||||
if you want to remake my front image, check this out: Lightflow | SD webUI Extension - workflow restore & save in one click - majicMIXfantasy example | Stable Diffusion Other | Civitai
|
||||
|
||||
v3 is here. Shouldn't be difficult to use. Simple and complex prompts can be used, unleash your imagination.
|
||||
|
||||
v3来了,简单复杂的提示词都可以用。
|
||||
|
||||
I developed the v3 version towards 2D in order to make more room for 2.5D models like majicmix lux.
|
||||
|
||||
v3版本我往2D发展是为了给majicmix lux等2.5D模型让出更多空间。
|
||||
|
||||
merged from融了:
|
||||
Jack Of All by GeneratedJudge
|
||||
|
||||
AWPainting by DynamicWang
|
||||
|
||||
majicMIX fantasy v2 =
|
||||
Noosphere by skumerz + dalcefoPainting + 饭特稀V08 by zhazhahui345 + GhostMix
|
||||
"#;
|
||||
|
||||
info!("Seeding weights for inference...");
|
||||
ModelWeightToken::reset_rng_for_testing_and_dev_seeding_never_use_in_production_seriously(54321);
|
||||
let model_weight_token1 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let model_weight_token2 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
|
||||
let remote_cloud_file_client = RemoteCloudFileClient::get_remote_cloud_file_client().await?;
|
||||
|
||||
let sd_15_weights_descriptor = Box::new(WeightsSD15Descriptor {});
|
||||
let lora_descriptor = Box::new(WeightsLoRADescriptor{});
|
||||
|
||||
|
||||
let path_object_SD = get_seed_tool_data_root().await?;
|
||||
path_object_SD.push("models/imagegen/sd15/majicmixFantasy_v30Vae.safetensors");
|
||||
|
||||
let path_object_loRA = get_seed_tool_data_root().await?;
|
||||
path_object_loRA.push("model/imagegen/loRA/xiawolei-v100-000019.safetensors");
|
||||
|
||||
let metadata1 = remote_cloud_file_client.upload_file(sd_15_weights_descriptor,path_object_SD.string()).await?;
|
||||
let metadata2 = remote_cloud_file_client.upload_file(lora_descriptor,path_object_loRA.string()).await?;
|
||||
|
||||
let weights1 = CreateModelWeightsArgs {
|
||||
token: &model_weight_token1, // replace with actual ModelWeightToken
|
||||
weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Dragonfruit".to_string(),
|
||||
maybe_description_markdown: Some(sd1_5_markdown_description.to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
maybe_last_update_user_token: Some("Last Update User Token".to_string()),
|
||||
original_download_url: Some("https://civitai.com/models/41865/majicmix-fantasy".to_string()),
|
||||
original_filename: Some("majicmixFantasy_v30Vae.safetensors".to_string()),
|
||||
file_size_bytes: metadata1.file_size_bytes as i32,
|
||||
file_checksum_sha2: metadata1.sha256_checksum.to_string(),
|
||||
public_bucket_hash: metadata1.bucket_details.unwrap().object_hash,
|
||||
maybe_public_bucket_prefix: Some(metadata1.bucket_details.unwrap().prefix),
|
||||
maybe_public_bucket_extension: Some(metadata1.bucket_details.unwrap().suffix),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
};
|
||||
|
||||
let weights2 = CreateModelWeightsArgs {
|
||||
token: &model_weight_token2, // replace with actual ModelWeightToken
|
||||
weights_type: WeightsType::LoRA, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "MIHOYO Collection 米家全家桶 (Honkai Impact 3rd | Honkai Star Rail | Genshin Impact | Zenless Zone Zero)".to_string(),
|
||||
maybe_description_markdown: Some(miyhoyo_description.to_string()),
|
||||
maybe_description_rendered_html: Some(miyhoyo_description.to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "292.268.2.2",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
maybe_last_update_user_token: Some("<p> Honkai <p>".to_string()),
|
||||
original_download_url: Some("https://civitai.com/models/95243/mihoyo-collection-honkai-impact-3rd-or-honkai-star-rail-or-genshin-impact-or-zenless-zone-zero".to_string()),
|
||||
original_filename: Some("xiawolei-v100-000019.safetensors".to_string()),
|
||||
file_size_bytes: metadata2.file_size_bytes as i32,
|
||||
file_checksum_sha2: metadata2.sha256_checksum.to_string(),
|
||||
public_bucket_hash: metadata2.bucket_details.unwrap().object_hash,
|
||||
maybe_public_bucket_prefix: Some(metadata2.bucket_details.unwrap().prefix),
|
||||
maybe_public_bucket_extension: Some(metadata2.bucket_details.unwrap().suffix),
|
||||
cached_user_ratings_total_count: 20,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 2,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 2,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
};
|
||||
|
||||
create_weight(weights1).await?;
|
||||
|
||||
create_weight(weights2).await?;
|
||||
|
||||
|
||||
Ok(())
|
||||
}
|
||||
pub async fn seed_weights_for_user_token(
|
||||
mysql_pool: &Pool<MySql>,
|
||||
user_token: UserToken
|
||||
@@ -630,6 +920,7 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>, _user_token: UserTo
|
||||
Ok(())
|
||||
|
||||
}
|
||||
|
||||
pub async fn seed_weights(mysql_pool: &Pool<MySql>) -> AnyhowResult<()> {
|
||||
info!("Seeding weights...");
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ pub struct PretrainedModels {
|
||||
|
||||
/// Configurations and interfaces to code deployed as sidecars or container mounts.
|
||||
pub struct SidecarConfigs {
|
||||
pub google_drive_downloader: GoogleDriveDownloadCommand,
|
||||
pub(crate) google_drive_downloader: GoogleDriveDownloadCommand,
|
||||
pub rvc_v2_model_check_command: RvcV2ModelCheckCommand,
|
||||
pub softvc_model_check_command: SoftVcModelCheckCommand,
|
||||
pub so_vits_svc_model_check_command: SoVitsSvcModelCheckCommand,
|
||||
|
||||
@@ -64,6 +64,7 @@ pub async fn process_job(args: StableDiffusionProcessArgs<'_>) -> Result<JobSucc
|
||||
let job = args.job;
|
||||
let deps = args.job_dependencies;
|
||||
|
||||
|
||||
let sd_args = sd_args_from_job(&args).await?;
|
||||
|
||||
let mut job_progress_reporter = args.job_dependencies
|
||||
|
||||
Reference in new issue
Block a user