@@ -213,16 +213,25 @@ class StableDiffusionGGML {
213213 }
214214 }
215215
216+ if (diffusion_model_path.size () > 0 ) {
217+ LOG_INFO (" loading diffusion model from '%s'" , diffusion_model_path.c_str ());
218+ if (!model_loader.init_from_file (diffusion_model_path, " model.diffusion_model." )) {
219+ LOG_WARN (" loading diffusion model from '%s' failed" , diffusion_model_path.c_str ());
220+ }
221+ }
222+
223+ bool is_unet = model_loader.model_is_unet ();
224+
216225 if (clip_l_path.size () > 0 ) {
217226 LOG_INFO (" loading clip_l from '%s'" , clip_l_path.c_str ());
218- if (!model_loader.init_from_file (clip_l_path, " text_encoders.clip_l.transformer." )) {
227+ if (!model_loader.init_from_file (clip_l_path, is_unet ? " cond_stage_model.transformer. " : " text_encoders.clip_l.transformer." )) {
219228 LOG_WARN (" loading clip_l from '%s' failed" , clip_l_path.c_str ());
220229 }
221230 }
222231
223232 if (clip_g_path.size () > 0 ) {
224233 LOG_INFO (" loading clip_g from '%s'" , clip_g_path.c_str ());
225- if (!model_loader.init_from_file (clip_g_path, " text_encoders.clip_g.transformer." )) {
234+ if (!model_loader.init_from_file (clip_g_path, is_unet ? " cond_stage_model.1.transformer. " : " text_encoders.clip_g.transformer." )) {
226235 LOG_WARN (" loading clip_g from '%s' failed" , clip_g_path.c_str ());
227236 }
228237 }
@@ -234,13 +243,6 @@ class StableDiffusionGGML {
234243 }
235244 }
236245
237- if (diffusion_model_path.size () > 0 ) {
238- LOG_INFO (" loading diffusion model from '%s'" , diffusion_model_path.c_str ());
239- if (!model_loader.init_from_file (diffusion_model_path, " model.diffusion_model." )) {
240- LOG_WARN (" loading diffusion model from '%s' failed" , diffusion_model_path.c_str ());
241- }
242- }
243-
244246 if (vae_path.size () > 0 ) {
245247 LOG_INFO (" loading vae from '%s'" , vae_path.c_str ());
246248 if (!model_loader.init_from_file (vae_path, " vae." )) {
0 commit comments