@@ -7,11 +7,13 @@ use crate::{
77 api:: { Config , ConfigBuilder , ConfigBuilderError , ModelConfig , ModelConfigBuilder } ,
88 preset_builder:: {
99 chroma, chroma_radiance, diff_instruct_star, dream_shaper_xl_2_1_turbo, flux_1_dev,
10- flux_1_mini, flux_1_schnell, flux_2_dev, juggernaut_xl_11, nitro_sd_realism,
11- nitro_sd_vibrant, ovis_image, qwen_image, sd_turbo, sdxl_base_1_0, sdxl_turbo_1_0, ssd_1b,
12- stable_diffusion_1_4, stable_diffusion_1_5, stable_diffusion_2_1,
13- stable_diffusion_3_5_large, stable_diffusion_3_5_large_turbo, stable_diffusion_3_5_medium,
14- stable_diffusion_3_medium, twinflow_z_image_turbo, z_image_turbo,
10+ flux_1_mini, flux_1_schnell, flux_2_dev, flux_2_klein_4b, flux_2_klein_9b,
11+ flux_2_klein_base_4b, flux_2_klein_base_9b, juggernaut_xl_11, nitro_sd_realism,
12+ nitro_sd_vibrant, ovis_image, qwen_image, sd_turbo, sdxl_base_1_0, sdxl_turbo_1_0,
13+ sdxs512_dream_shaper, ssd_1b, stable_diffusion_1_4, stable_diffusion_1_5,
14+ stable_diffusion_2_1, stable_diffusion_3_5_large, stable_diffusion_3_5_large_turbo,
15+ stable_diffusion_3_5_medium, stable_diffusion_3_medium, twinflow_z_image_turbo,
16+ z_image_turbo,
1517 } ,
1618} ;
1719
@@ -30,7 +32,11 @@ use crate::{
3032 ZImageTurboWeight ( derive( Default ) ) ,
3133 QwenImageWeight ( derive( Default ) ) ,
3234 OvisImageWeight ( derive( Default ) ) ,
33- TwinFlowZImageTurboExpWeight ( derive( Default ) )
35+ TwinFlowZImageTurboExpWeight ( derive( Default ) ) ,
36+ Flux2Klein4BWeight ( derive( Default ) ) ,
37+ Flux2KleinBase4BWeight ( derive( Default ) ) ,
38+ Flux2Klein9BWeight ( derive( Default ) ) ,
39+ Flux2KleinBase9BWeight ( derive( Default ) )
3440) ]
3541#[ derive( Debug , Clone , Copy , EnumString , VariantNames ) ]
3642#[ strum( ascii_case_insensitive) ]
@@ -55,7 +61,11 @@ pub enum WeightType {
5561 ZImageTurboWeight ,
5662 QwenImageWeight ,
5763 OvisImageWeight ( default ) ,
58- TwinFlowZImageTurboExpWeight ( default )
64+ TwinFlowZImageTurboExpWeight ( default ) ,
65+ Flux2Klein4BWeight ,
66+ Flux2KleinBase4BWeight ,
67+ Flux2Klein9BWeight ( default ) ,
68+ Flux2KleinBase9BWeight ( default )
5969 ) ]
6070 Q4_0 ,
6171 #[ subenum( Flux2Weight , QwenImageWeight ) ]
@@ -84,7 +94,10 @@ pub enum WeightType {
8494 ZImageTurboWeight ,
8595 QwenImageWeight ,
8696 OvisImageWeight ,
87- TwinFlowZImageTurboExpWeight
97+ TwinFlowZImageTurboExpWeight ,
98+ Flux2Klein4BWeight ( default ) ,
99+ Flux2KleinBase4BWeight ( default ) ,
100+ Flux2Klein9BWeight
88101 ) ]
89102 Q8_0 ,
90103 Q8_1 ,
@@ -149,7 +162,11 @@ pub enum WeightType {
149162 ZImageTurboWeight ,
150163 QwenImageWeight ,
151164 OvisImageWeight ,
152- TwinFlowZImageTurboExpWeight
165+ TwinFlowZImageTurboExpWeight ,
166+ Flux2Klein4BWeight ,
167+ Flux2KleinBase4BWeight ,
168+ Flux2Klein9BWeight ,
169+ Flux2KleinBase9BWeight
153170 ) ]
154171 BF16 ,
155172 TQ1_0 ,
@@ -229,6 +246,20 @@ pub enum Preset {
229246 /// Requires access rights to <https://huggingface.co/black-forest-labs/FLUX.1-schnell> providing a token via [crate::util::set_hf_token]
230247 /// Enabled [crate::api::SampleMethod::DPM2_SAMPLE_METHOD] and [crate::api::Scheduler::SMOOTHSTEP_SCHEDULER]. cfg_scale 1.0. 3 steps. Flash attention enabled. 1024x512. Vae-tiling enabled.
231248 TwinFlowZImageTurboExp ( TwinFlowZImageTurboExpWeight ) ,
249+ /// cfg_scale 1.0. 1 steps. 512x512
250+ SDXS512DreamShaper ,
251+ /// Requires access rights to <https://huggingface.co/black-forest-labs/FLUX.2-dev> providing a token via [crate::util::set_hf_token]
252+ /// cfg scale 1.0. 4 steps. Flash attention enabled. Offload params to CPU enabled. 1024x1024. Vae-tiling enabled
253+ Flux2Klein4B ( Flux2Klein4BWeight ) ,
254+ /// Requires access rights to <https://huggingface.co/black-forest-labs/FLUX.2-dev> providing a token via [crate::util::set_hf_token]
255+ /// cfg scale 4.0. 20 steps. Flash attention enabled. Offload params to CPU enabled. 1024x1024. Vae-tiling enabled
256+ Flux2KleinBase4B ( Flux2KleinBase4BWeight ) ,
257+ /// Requires access rights to <https://huggingface.co/black-forest-labs/FLUX.2-dev> providing a token via [crate::util::set_hf_token]
258+ /// cfg scale 1.0. 4 steps. Flash attention enabled. Offload params to CPU enabled. 1024x1024. Vae-tiling enabled
259+ Flux2Klein9B ( Flux2Klein9BWeight ) ,
260+ /// Requires access rights to <https://huggingface.co/black-forest-labs/FLUX.2-dev> providing a token via [crate::util::set_hf_token]
261+ /// cfg scale 4.0. 20 steps. Flash attention enabled. Offload params to CPU enabled. 1024x1024. Vae-tiling enabled
262+ Flux2KleinBase9B ( Flux2KleinBase9BWeight ) ,
232263}
233264
234265impl Preset {
@@ -261,6 +292,11 @@ impl Preset {
261292 Preset :: OvisImage ( sd_type_t) => ovis_image ( sd_type_t) ,
262293 Preset :: DreamShaperXL2_1Turbo => dream_shaper_xl_2_1_turbo ( ) ,
263294 Preset :: TwinFlowZImageTurboExp ( sd_type_t) => twinflow_z_image_turbo ( sd_type_t) ,
295+ Preset :: SDXS512DreamShaper => sdxs512_dream_shaper ( ) ,
296+ Preset :: Flux2Klein4B ( sd_type_t) => flux_2_klein_4b ( sd_type_t) ,
297+ Preset :: Flux2KleinBase4B ( sd_type_t) => flux_2_klein_base_4b ( sd_type_t) ,
298+ Preset :: Flux2Klein9B ( sd_type_t) => flux_2_klein_9b ( sd_type_t) ,
299+ Preset :: Flux2KleinBase9B ( sd_type_t) => flux_2_klein_base_9b ( sd_type_t) ,
264300 } ;
265301
266302 // Metal workaround.
@@ -343,8 +379,10 @@ mod tests {
343379 api:: gen_img,
344380 preset:: {
345381 ChromaRadianceWeight , ChromaWeight , DiffInstructStarWeight , Flux1MiniWeight ,
346- Flux1Weight , Flux2Weight , NitroSDRealismWeight , NitroSDVibrantWeight , OvisImageWeight ,
347- QwenImageWeight , SSD1BWeight , TwinFlowZImageTurboExpWeight , ZImageTurboWeight ,
382+ Flux1Weight , Flux2Klein4BWeight , Flux2Klein9BWeight , Flux2KleinBase4BWeight ,
383+ Flux2KleinBase9BWeight , Flux2Weight , NitroSDRealismWeight , NitroSDVibrantWeight ,
384+ OvisImageWeight , QwenImageWeight , SSD1BWeight , TwinFlowZImageTurboExpWeight ,
385+ ZImageTurboWeight ,
348386 } ,
349387 util:: set_hf_token,
350388 } ;
@@ -531,4 +569,38 @@ mod tests {
531569 TwinFlowZImageTurboExpWeight :: Q3_K ,
532570 ) ) ;
533571 }
572+
573+ #[ ignore]
574+ #[ test]
575+ fn test_sdxs512_dream_shaper ( ) {
576+ run ( Preset :: SDXS512DreamShaper ) ;
577+ }
578+
579+ #[ ignore]
580+ #[ test]
581+ fn test_flux_2_klein_4b ( ) {
582+ set_hf_token ( include_str ! ( "../token.txt" ) ) ;
583+ run ( Preset :: Flux2Klein4B ( Flux2Klein4BWeight :: Q8_0 ) ) ;
584+ }
585+
586+ #[ ignore]
587+ #[ test]
588+ fn test_flux_2_klein_base_4b ( ) {
589+ set_hf_token ( include_str ! ( "../token.txt" ) ) ;
590+ run ( Preset :: Flux2KleinBase4B ( Flux2KleinBase4BWeight :: Q8_0 ) ) ;
591+ }
592+
593+ #[ ignore]
594+ #[ test]
595+ fn test_flux_2_klein_9b ( ) {
596+ set_hf_token ( include_str ! ( "../token.txt" ) ) ;
597+ run ( Preset :: Flux2Klein9B ( Flux2Klein9BWeight :: Q4_0 ) ) ;
598+ }
599+
600+ #[ ignore]
601+ #[ test]
602+ fn test_flux_2_klein_base_9b ( ) {
603+ set_hf_token ( include_str ! ( "../token.txt" ) ) ;
604+ run ( Preset :: Flux2KleinBase9B ( Flux2KleinBase9BWeight :: Q4_0 ) ) ;
605+ }
534606}
0 commit comments