File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -492,6 +492,22 @@ namespace Qwen {
492
492
bool flash_attn = false )
493
493
: GGMLRunner(backend, offload_params_to_cpu) {
494
494
qwen_image_params.flash_attn = flash_attn;
495
+
496
+ int model_layers = 60 ;
497
+ int num_layers = 1 ;
498
+ for (int layer = model_layers; layer > num_layers; layer--) {
499
+ for (auto pair : tensor_types) {
500
+ if (pair.first .find (" model.diffusion_model.transformer_blocks." + std::to_string (layer-1 ) + " .attn.add_k_proj.bias" ) != std::string::npos) {
501
+ num_layers = layer;
502
+ break ;
503
+ }
504
+ }
505
+ }
506
+ if (num_layers < model_layers) {
507
+ LOG_INFO (" Qwen Image: some layers missing, assuming pruned model" );
508
+ }
509
+
510
+ qwen_image_params.num_layers = num_layers;
495
511
qwen_image = QwenImageModel (qwen_image_params);
496
512
qwen_image.init (params_ctx, tensor_types, prefix);
497
513
}
You can’t perform that action at this time.
0 commit comments