mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-11 04:51:25 +00:00
add support for Qwen Image Pruning (#1779)
From leejet/stable-diffusion.cpp#874 .
This commit is contained in:
parent
bece22f996
commit
bc762fe9b4
1 changed files with 21 additions and 0 deletions
|
|
@ -492,6 +492,27 @@ namespace Qwen {
|
|||
bool flash_attn = false)
|
||||
: GGMLRunner(backend, offload_params_to_cpu) {
|
||||
qwen_image_params.flash_attn = flash_attn;
|
||||
|
||||
int model_layers = qwen_image_params.num_layers;
|
||||
int num_layers = 1;
|
||||
std::string layer_prefix = "transformer_blocks.";
|
||||
if (prefix.size() > 0) {
|
||||
layer_prefix = prefix + "." + layer_prefix;
|
||||
}
|
||||
for (int layer = model_layers; layer > num_layers; layer--) {
|
||||
std::string layer_name = layer_prefix + std::to_string(layer-1) + ".attn.add_k_proj.bias";
|
||||
for (auto pair : tensor_types) {
|
||||
if (pair.first.find(layer_name) != std::string::npos) {
|
||||
num_layers = layer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num_layers < model_layers) {
|
||||
LOG_INFO("Qwen Image: some layers missing, assuming pruned model");
|
||||
}
|
||||
|
||||
qwen_image_params.num_layers = num_layers;
|
||||
qwen_image = QwenImageModel(qwen_image_params);
|
||||
qwen_image.init(params_ctx, tensor_types, prefix);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue