mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-17 11:58:21 +08:00
Gemma4: make image max_soft_tokens settable via tokenize kwarg (default 280 unchanged)
This commit is contained in:
parent
6c639e2a93
commit
d5fc7cc58c
@ -1088,7 +1088,7 @@ class Gemma4_Tokenizer():
|
|||||||
h, w = samples.shape[2], samples.shape[3]
|
h, w = samples.shape[2], samples.shape[3]
|
||||||
patch_size = 16
|
patch_size = 16
|
||||||
pooling_k = 3
|
pooling_k = 3
|
||||||
max_soft_tokens = 70 if is_video else 280 # video uses smaller token budget per frame
|
max_soft_tokens = kwargs.get("max_soft_tokens", 70 if is_video else 280)
|
||||||
max_patches = max_soft_tokens * pooling_k * pooling_k
|
max_patches = max_soft_tokens * pooling_k * pooling_k
|
||||||
target_px = max_patches * patch_size * patch_size
|
target_px = max_patches * patch_size * patch_size
|
||||||
factor = (target_px / (h * w)) ** 0.5
|
factor = (target_px / (h * w)) ** 0.5
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user