Skip to content

Commit 4c7626f

Browse files
committed
Qwen-VL: support larger images
1 parent cf94e0b commit 4c7626f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

models/qwen.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,8 @@ namespace chatllm::qwen::vit
13881388
vis_config.merge_size = (int)pp_cfg["merge_size"].ToInt();
13891389
vis_config.min_pixels = (int)pp_cfg["min_pixels"].ToInt();
13901390
vis_config.max_patches = max_patches;
1391-
vis_config.max_pixels = max_patches * vis_config.patch_size * vis_config.patch_size;
1391+
vis_config.max_pixels = max_patches * vis_config.patch_size * vis_config.patch_size * vis_config.merge_size * vis_config.merge_size;
1392+
vis_config.max_pixels = std::min(vis_config.max_pixels, (int)pp_cfg["max_pixels"].ToInt());
13921393
}
13931394

13941395
const size_t tensor_ovhd = ggml_tensor_overhead();
@@ -1529,7 +1530,7 @@ namespace chatllm::qwen::v2_5_vl
15291530
class ExtendEmbedding
15301531
{
15311532
public:
1532-
ExtendEmbedding() : pad_arg(new BlockParams::PadEmbedding(4096, 4096)) {}
1533+
ExtendEmbedding() : pad_arg(new BlockParams::PadEmbedding(2048, 2048)) {}
15331534
public:
15341535
BlockParams::PadEmbedding *pad_arg = nullptr;
15351536
};

0 commit comments

Comments
 (0)