@@ -144,7 +144,9 @@ class StableDiffusionGGML {
144
144
ggml_backend_t control_net_backend = NULL ;
145
145
ggml_backend_t vae_backend = NULL ;
146
146
ggml_type model_wtype = GGML_TYPE_COUNT;
147
- ggml_type conditioner_wtype = GGML_TYPE_COUNT;
147
+ ggml_type clip_l_wtype = GGML_TYPE_COUNT;
148
+ ggml_type clip_g_wtype = GGML_TYPE_COUNT;
149
+ ggml_type t5xxl_wtype = GGML_TYPE_COUNT;
148
150
ggml_type diffusion_model_wtype = GGML_TYPE_COUNT;
149
151
ggml_type vae_wtype = GGML_TYPE_COUNT;
150
152
@@ -337,9 +339,56 @@ class StableDiffusionGGML {
337
339
model_wtype = GGML_TYPE_F32;
338
340
LOG_WARN (" can not get mode wtype frome weight, use f32" );
339
341
}
340
- conditioner_wtype = model_loader.get_conditioner_wtype ();
341
- if (conditioner_wtype == GGML_TYPE_COUNT) {
342
- conditioner_wtype = wtype;
342
+ switch (version) {
343
+ case VERSION_SVD:
344
+ case VERSION_SD1:
345
+ case VERSION_SD1_INPAINT:
346
+ case VERSION_SD2:
347
+ case VERSION_SD2_INPAINT:
348
+ case VERSION_SDXL:
349
+ case VERSION_SDXL_REFINER:
350
+ case VERSION_SDXL_INPAINT: {
351
+ if (version != VERSION_SDXL_REFINER) {
352
+ clip_l_wtype = model_loader.get_conditioner_wtype ({" cond_stage_model.transformer." , " text_encoders.clip_l." });
353
+ if (clip_l_wtype == GGML_TYPE_COUNT) {
354
+ clip_l_wtype = wtype;
355
+ }
356
+ }
357
+ if (sd_version_is_sdxl (version)) {
358
+ clip_g_wtype = model_loader.get_conditioner_wtype ({" cond_stage_model.1." , " text_encoders.clip_g." });
359
+ if (clip_g_wtype == GGML_TYPE_COUNT) {
360
+ clip_g_wtype = wtype;
361
+ }
362
+ }
363
+ break ;
364
+ }
365
+ case VERSION_SD3: {
366
+ clip_l_wtype = model_loader.get_conditioner_wtype ({" cond_stage_model.transformer." , " text_encoders.clip_l." });
367
+ if (clip_l_wtype == GGML_TYPE_COUNT) {
368
+ clip_l_wtype = wtype;
369
+ }
370
+ clip_g_wtype = model_loader.get_conditioner_wtype ({" cond_stage_model.1." , " text_encoders.clip_g." });
371
+ if (clip_g_wtype == GGML_TYPE_COUNT) {
372
+ clip_g_wtype = wtype;
373
+ }
374
+ t5xxl_wtype = model_loader.get_conditioner_wtype ({" cond_stage_model.2." , " text_encoders.t5xxl." });
375
+ if (t5xxl_wtype == GGML_TYPE_COUNT) {
376
+ t5xxl_wtype = wtype;
377
+ }
378
+ break ;
379
+ }
380
+ case VERSION_FLUX:
381
+ case VERSION_FLUX_FILL: {
382
+ clip_l_wtype = model_loader.get_conditioner_wtype ({" cond_stage_model.transformer." , " text_encoders.clip_l." });
383
+ if (clip_l_wtype == GGML_TYPE_COUNT) {
384
+ clip_l_wtype = wtype;
385
+ }
386
+ t5xxl_wtype = model_loader.get_conditioner_wtype ({" cond_stage_model.1." , " text_encoders.t5xxl." });
387
+ if (t5xxl_wtype == GGML_TYPE_COUNT) {
388
+ t5xxl_wtype = wtype;
389
+ }
390
+ break ;
391
+ }
343
392
}
344
393
diffusion_model_wtype = model_loader.get_diffusion_model_wtype ();
345
394
if (diffusion_model_wtype == GGML_TYPE_COUNT) {
@@ -352,7 +401,9 @@ class StableDiffusionGGML {
352
401
}
353
402
} else {
354
403
model_wtype = wtype;
355
- conditioner_wtype = wtype;
404
+ clip_l_wtype = wtype;
405
+ clip_g_wtype = wtype;
406
+ t5xxl_wtype = wtype;
356
407
diffusion_model_wtype = wtype;
357
408
vae_wtype = wtype;
358
409
model_loader.set_wtype_override (wtype);
@@ -363,22 +414,17 @@ class StableDiffusionGGML {
363
414
model_loader.set_wtype_override (GGML_TYPE_F32, " vae." );
364
415
}
365
416
366
- LOG_INFO (" Weight type: %s" , model_wtype != SD_TYPE_COUNT ? ggml_type_name (model_wtype) : " ??" );
367
- LOG_INFO (" Conditioner weight type: %s" , conditioner_wtype != SD_TYPE_COUNT ? ggml_type_name (conditioner_wtype) : " ??" );
368
- LOG_INFO (" Diffusion model weight type: %s" , diffusion_model_wtype != SD_TYPE_COUNT ? ggml_type_name (diffusion_model_wtype) : " ??" );
369
- LOG_INFO (" VAE weight type: %s" , vae_wtype != SD_TYPE_COUNT ? ggml_type_name (vae_wtype) : " ??" );
417
+ LOG_INFO (" Weight type: %s" , model_wtype != GGML_TYPE_COUNT ? ggml_type_name (model_wtype) : " ??" );
418
+ LOG_INFO (" CLIP_L weight type: %s" , clip_l_wtype != GGML_TYPE_COUNT ? ggml_type_name (clip_l_wtype) : " ??" );
419
+ LOG_INFO (" CLIP_G weight type: %s" , clip_g_wtype != GGML_TYPE_COUNT ? ggml_type_name (clip_g_wtype) : " ??" );
420
+ LOG_INFO (" T5XXL weight type: %s" , t5xxl_wtype != GGML_TYPE_COUNT ? ggml_type_name (t5xxl_wtype) : " ??" );
421
+ LOG_INFO (" Diffusion model weight type: %s" , diffusion_model_wtype != GGML_TYPE_COUNT ? ggml_type_name (diffusion_model_wtype) : " ??" );
422
+ LOG_INFO (" VAE weight type: %s" , vae_wtype != GGML_TYPE_COUNT ? ggml_type_name (vae_wtype) : " ??" );
370
423
371
424
LOG_DEBUG (" ggml tensor size = %d bytes" , (int )sizeof (ggml_tensor));
372
425
373
426
if (sd_version_is_sdxl (version)) {
374
427
scale_factor = 0 .13025f ;
375
- if (vae_path.size () == 0 && taesd_path.size () == 0 ) {
376
- LOG_WARN (
377
- " !!!It looks like you are using SDXL model. "
378
- " If you find that the generated images are completely black, "
379
- " try specifying SDXL VAE FP16 Fix with the --vae parameter. "
380
- " You can find it here: https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/blob/main/sdxl_vae.safetensors" );
381
- }
382
428
} else if (sd_version_is_sd3 (version)) {
383
429
scale_factor = 1 .5305f ;
384
430
} else if (sd_version_is_flux (version)) {
0 commit comments