@@ -134,6 +134,27 @@ static bool sd_is_quiet = false;
134134static std::string sdmodelfilename = " " ;
135135static bool photomaker_enabled = false ;
136136
137+ static void set_sd_vae_tiling (sd_ctx_t * ctx, bool tiling)
138+ {
139+ ctx->sd ->vae_tiling = tiling;
140+ }
141+
142+ static int get_loaded_sd_version (sd_ctx_t * ctx)
143+ {
144+ return ctx->sd ->version ;
145+ }
146+
147+ static bool loaded_model_is_chroma (sd_ctx_t * ctx)
148+ {
149+ if (ctx != nullptr && ctx->sd != nullptr ) {
150+ auto maybe_flux = std::dynamic_pointer_cast<FluxModel>(ctx->sd ->diffusion_model );
151+ if (maybe_flux != nullptr ) {
152+ return maybe_flux->flux .flux_params .is_chroma ;
153+ }
154+ }
155+ return false ;
156+ }
157+
137158bool sdtype_load_model (const sd_load_model_inputs inputs) {
138159 sd_is_quiet = inputs.quiet ;
139160 set_sd_quiet (sd_is_quiet);
@@ -485,7 +506,7 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
485506 auto loadedsdver = get_loaded_sd_version (sd_ctx);
486507 if (loadedsdver == SDVersion::VERSION_FLUX)
487508 {
488- if (!sd_loaded_chroma ( )) {
509+ if (!loaded_model_is_chroma (sd_ctx )) {
489510 sd_params->cfg_scale = 1 ; // non chroma clamp cfg scale
490511 }
491512 if (sampler == " euler a" || sampler == " k_euler_a" || sampler == " euler_a" ) {
@@ -667,7 +688,7 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
667688 }
668689
669690 std::vector<sd_image_t > kontext_imgs;
670- if (extra_image_data.size ()>0 && loadedsdver==SDVersion::VERSION_FLUX && !sd_loaded_chroma ( ))
691+ if (extra_image_data.size ()>0 && loadedsdver==SDVersion::VERSION_FLUX && !loaded_model_is_chroma (sd_ctx ))
671692 {
672693 for (int i=0 ;i<extra_image_data.size ();++i)
673694 {
0 commit comments