File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -513,6 +513,25 @@ namespace Qwen {
513513 bool flash_attn = false )
514514 : GGMLRunner(backend, offload_params_to_cpu) {
515515 qwen_image_params.flash_attn = flash_attn;
516+ qwen_image_params.num_layers = 0 ;
517+ for (auto pair : tensor_types) {
518+ std::string tensor_name = pair.first ;
519+ if (tensor_name.find (prefix) == std::string::npos)
520+ continue ;
521+ size_t pos = tensor_name.find (" transformer_blocks." );
522+ if (pos != std::string::npos) {
523+ tensor_name = tensor_name.substr (pos); // remove prefix
524+ auto items = split_string (tensor_name, ' .' );
525+ if (items.size () > 1 ) {
526+ int block_index = atoi (items[1 ].c_str ());
527+ if (block_index + 1 > qwen_image_params.num_layers ) {
528+ qwen_image_params.num_layers = block_index + 1 ;
529+ }
530+ }
531+ continue ;
532+ }
533+ }
534+ LOG_ERROR (" qwen_image_params.num_layers: %ld" , qwen_image_params.num_layers );
516535 qwen_image = QwenImageModel (qwen_image_params);
517536 qwen_image.init (params_ctx, tensor_types, prefix);
518537 }
Original file line number Diff line number Diff line change @@ -615,6 +615,7 @@ class StableDiffusionGGML {
615615
616616 if (vae_decode_only) {
617617 ignore_tensors.insert (" first_stage_model.encoder" );
618+ ignore_tensors.insert (" first_stage_model.conv1" );
618619 ignore_tensors.insert (" first_stage_model.quant" );
619620 ignore_tensors.insert (" text_encoders.qwen2vl.visual." );
620621 }
You can’t perform that action at this time.
0 commit comments