[Bugfix][Model] Mistral3: align placeholder grid with public processor (#53758)
Signed-off-by: Oliver Holworthy <1216955+oliverholworthy@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
59f1527280
commit
9598487bc1
@@ -192,18 +192,13 @@ class Mistral3HFEncoderInfo(PixtralHFEncoderInfo):
|
||||
image_width = math.floor(image_width / ratio)
|
||||
image_height = math.floor(image_height / ratio)
|
||||
|
||||
patch_size = self.vision_config.patch_size
|
||||
assert isinstance(self.hf_config, Mistral3Config)
|
||||
spatial_merge_size = self.hf_config.spatial_merge_size
|
||||
merged_patch_size = (
|
||||
self.vision_config.patch_size * self.hf_config.spatial_merge_size
|
||||
)
|
||||
|
||||
# The HF processor rounds each dimension up to the vision patch size
|
||||
# before the projector drops incomplete spatial-merge groups. This is
|
||||
# not equivalent to rounding directly to the merged patch size.
|
||||
num_width_patches = (image_width - 1) // patch_size + 1
|
||||
num_height_patches = (image_height - 1) // patch_size + 1
|
||||
|
||||
ncols = num_width_patches // spatial_merge_size
|
||||
nrows = num_height_patches // spatial_merge_size
|
||||
ncols = (image_width - 1) // merged_patch_size + 1
|
||||
nrows = (image_height - 1) // merged_patch_size + 1
|
||||
return ncols, nrows
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user