@@ -400,6 +400,7 @@ bool ImageGenerator::ensureModelLoaded(const std::string& controlnet_model) {
400400 std::string clip_l_path_str;
401401 std::string clip_g_path_str;
402402 std::string t5xxl_path_str;
403+ std::string llm_path_str;
403404
404405 if (options.has (" forge_additional_modules" )) {
405406 auto modules = options[" forge_additional_modules" ];
@@ -423,6 +424,8 @@ bool ImageGenerator::ensureModelLoaded(const std::string& controlnet_model) {
423424 clip_g_path_str = module_full_path;
424425 } else if (model_type == " t5xxl" ) {
425426 t5xxl_path_str = module_full_path;
427+ } else if (model_type == " llm" ) {
428+ llm_path_str = module_full_path;
426429 } else {
427430 LOG_WARNING (" Unknown model type for: %s (detected as: %s)" , module_full_path.c_str (),
428431 model_type.c_str ());
@@ -437,7 +440,7 @@ bool ImageGenerator::ensureModelLoaded(const std::string& controlnet_model) {
437440 bool needs_reload = !initialized_ || !sd_ctx_ || model_path != current_model_path_ ||
438441 vae_path_str != current_vae_path_ || clip_l_path_str != current_clip_l_path_ ||
439442 clip_g_path_str != current_clip_g_path_ || t5xxl_path_str != current_t5xxl_path_ ||
440- controlnet_path_str != current_controlnet_path_;
443+ llm_path_str != current_llm_path_ || controlnet_path_str != current_controlnet_path_;
441444
442445 if (!needs_reload) {
443446 LOG_DEBUG (" Model already loaded: %s" , model_path.c_str ());
@@ -471,7 +474,8 @@ bool ImageGenerator::ensureModelLoaded(const std::string& controlnet_model) {
471474 params.free_params_immediately = false ;
472475
473476 // Check if we have additional modules (VAE, CLIP, etc.)
474- bool has_additional_modules = !clip_l_path_str.empty () || !clip_g_path_str.empty () || !t5xxl_path_str.empty ();
477+ bool has_additional_modules =
478+ !clip_l_path_str.empty () || !clip_g_path_str.empty () || !t5xxl_path_str.empty () || !llm_path_str.empty ();
475479
476480 if (has_additional_modules) {
477481 LOG_INFO (" Using additional modules - loading diffusion model separately" );
@@ -488,6 +492,7 @@ bool ImageGenerator::ensureModelLoaded(const std::string& controlnet_model) {
488492 params.clip_l_path = clip_l_path_str.empty () ? nullptr : clip_l_path_str.c_str ();
489493 params.clip_g_path = clip_g_path_str.empty () ? nullptr : clip_g_path_str.c_str ();
490494 params.t5xxl_path = t5xxl_path_str.empty () ? nullptr : t5xxl_path_str.c_str ();
495+ params.llm_path = llm_path_str.empty () ? nullptr : llm_path_str.c_str ();
491496 params.taesd_path = nullptr ;
492497 params.control_net_path = controlnet_path_str.empty () ? nullptr : controlnet_path_str.c_str ();
493498 params.lora_model_dir = lora_dir_str.empty () ? nullptr : lora_dir_str.c_str ();
@@ -507,6 +512,9 @@ bool ImageGenerator::ensureModelLoaded(const std::string& controlnet_model) {
507512 if (!t5xxl_path_str.empty ()) {
508513 LOG_INFO (" Loading T5XXL model: %s" , t5xxl_path_str.c_str ());
509514 }
515+ if (!llm_path_str.empty ()) {
516+ LOG_INFO (" Loading LLM model: %s" , llm_path_str.c_str ());
517+ }
510518 if (!controlnet_path_str.empty ()) {
511519 LOG_INFO (" Loading ControlNet model: %s" , controlnet_path_str.c_str ());
512520 }
@@ -530,6 +538,7 @@ bool ImageGenerator::ensureModelLoaded(const std::string& controlnet_model) {
530538 current_clip_l_path_ = clip_l_path_str;
531539 current_clip_g_path_ = clip_g_path_str;
532540 current_t5xxl_path_ = t5xxl_path_str;
541+ current_llm_path_ = llm_path_str;
533542 current_taesd_path_ = " " ;
534543 current_lora_model_dir_ = lora_dir_str;
535544 current_embeddings_dir_ = " " ;
0 commit comments