Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: juggernaut xl v11 preset #11

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/preset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use hf_hub::api::sync::ApiError;
use crate::{
api::{self, Config, ConfigBuilder, ConfigBuilderError},
preset_builder::{
flux_1_dev, flux_1_schnell, sd_turbo, sdxl_base_1_0, sdxl_turbo_1_0_fp16,
flux_1_dev, flux_1_schnell, juggernaut_xl_11, sd_turbo, sdxl_base_1_0, sdxl_turbo_1_0_fp16,
stable_diffusion_1_4, stable_diffusion_1_5, stable_diffusion_2_1,
stable_diffusion_3_5_large_fp16, stable_diffusion_3_5_large_turbo_fp16,
stable_diffusion_3_5_medium_fp16, stable_diffusion_3_medium_fp16,
Expand Down Expand Up @@ -33,16 +33,19 @@ pub enum Preset {
/// Vae-tiling enabled. 1024x1024. Enabled [api::SampleMethod::EULER]. cfg_scale 0. 4 steps.
StableDiffusion3_5LargeTurboFp16,
SDXLBase1_0,
/// cfg_scale 1. guidance 0. 4 Steps
/// cfg_scale 1. guidance 0. 4 steps
SDTurbo,
/// cfg_scale 1. guidance 0. 4 Steps
/// cfg_scale 1. guidance 0. 4 steps
SDXLTurbo1_0Fp16,
/// Requires access rights to <https://huggingface.co/black-forest-labs/FLUX.1-dev> providing a token via [crate::util::set_hf_token]
/// Vae-tiling enabled. 1024x1024. Enabled [api::SampleMethod::EULER]. 28 steps.
Flux1Dev(api::WeightType),
/// Requires access rights to <https://huggingface.co/black-forest-labs/FLUX.1-schnell> providing a token via [crate::util::set_hf_token]
/// Vae-tiling enabled. 1024x1024. Enabled [api::SampleMethod::EULER]. 4 steps.
Flux1Schnell(api::WeightType),
/// Requires access rights to <https://huggingface.co/RunDiffusion/Juggernaut-XI-v11> providing a token via [crate::util::set_hf_token]
/// Vae-tiling enabled. 1024x1024. Enabled [api::SampleMethod::DPM2]. guidance 6. 20 steps
JuggernautXL11,
}

impl Preset {
Expand All @@ -60,6 +63,7 @@ impl Preset {
Preset::StableDiffusion3_5LargeFp16 => stable_diffusion_3_5_large_fp16(),
Preset::StableDiffusion3_5MediumFp16 => stable_diffusion_3_5_medium_fp16(),
Preset::StableDiffusion3_5LargeTurboFp16 => stable_diffusion_3_5_large_turbo_fp16(),
Preset::JuggernautXL11 => juggernaut_xl_11(),
}
}
}
Expand Down Expand Up @@ -209,4 +213,11 @@ mod tests {
set_hf_token(include_str!("../token.txt"));
run(Preset::StableDiffusion3_5LargeTurboFp16);
}

#[ignore]
#[test]
fn test_juggernaut_xl_11() {
set_hf_token(include_str!("../token.txt"));
run(Preset::JuggernautXL11);
}
}
20 changes: 20 additions & 0 deletions src/preset_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,23 @@ pub fn stable_diffusion_3_5(

Ok(config)
}

pub fn juggernaut_xl_11() -> Result<ConfigBuilder, ApiError> {
let model_path = download_file_hf_hub(
"RunDiffusion/Juggernaut-XI-v11",
"Juggernaut-XI-byRunDiffusion.safetensors",
)?;

let mut config = ConfigBuilder::default();

config
.model(model_path)
.vae_tiling(true)
.sampling_method(SampleMethod::DPM2)
.steps(20)
.guidance(6.)
.height(1024)
.width(1024);

Ok(config)
}