Skip to content

mtmd : harden feature_layer range check - #29362

Draft
3em0 wants to merge 1 commit into
ggml-org:masterfrom
3em0:mtmd-feature-layer-range
Draft

3em0 wants to merge 1 commit into
ggml-org:masterfrom
3em0:mtmd-feature-layer-range

Conversation

@3em0

@3em0 3em0 commented Sep 24, 2026

Copy link
Copy Markdown

Follow-up to #29276, which added a range check for clip.*.feature_layer (indices above n_layer are rejected). Two small hardenings:

  • also reject negative indices: conversions are expected to standardize on non-negative values (-1 is used internally to mark values as unset), so a negative declared index is malformed and should fail loudly instead of being silently ignored
  • include the offending key and the valid range in the error message, which makes a malformed projector easier to identify from the log

No behavior change for well-formed files.

Testing

  • mmproj declaring feature_layer = [4096] with block_count = 2: fails to load with the range error, same as master
  • mmproj declaring a negative feature_layer value: now fails to load with the range error (previously the value was silently ignored and the default layer choice was used)
  • well-formed projectors with indices in [0, n_layer] (llava, minicpmv-family, granite-vision): load as before

ggml-org#29276 rejects feature_layer indices above n_layer. Also reject negative
indices: conversions are expected to standardize on non-negative values
(-1 is used internally to mark values as unset), so a negative declared
index is malformed and should fail loudly instead of being silently
ignored. Also include the offending key and the valid range in the error
message to make malformed projectors easier to identify.
@3em0
3em0 requested a review from a team as a code owner September 24, 2026 09:04
@github-actions github-actions Bot added the mtmd Related to multimodal functionality (video/image/audio) label Sep 24, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown

Hi @3em0, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

  • Multiple open PRs from a new contributor: We limit new contributors (those without a previously merged PR) to 1 open PR at a time. You currently have 2 open PRs.


Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@ggml-gh-bot ggml-gh-bot Bot added the draft PR will be changed to draft by github-actions bot label Sep 24, 2026
@github-actions
github-actions Bot marked this pull request as draft September 24, 2026 09:09
@github-actions github-actions Bot removed the draft PR will be changed to draft by github-actions bot label Sep 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mtmd Related to multimodal functionality (video/image/audio)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant