transformers - ✅(Solved) Fix More permissive config parsing and validation [1 pull requests, 9 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
huggingface/transformers#45265Fetched 2026-04-08 03:00:52
View on GitHub
Comments
9
Participants
3
Timeline
18
Reactions
0
Timeline (top)
commented ×9subscribed ×4mentioned ×3cross-referenced ×1

Fix Action

Fixed

PR fix notes

PR #45289: Less unnecessary RoPE warnings

Description (problem / solution / changelog)

What does this PR do?

Fixes https://github.com/huggingface/transformers/issues/45265 and doesn't warn if the value is an int.

Changed files

  • src/transformers/modeling_rope_utils.py (modified, +24/-22)

Code Example

Unrecognized keys in `rope_parameters` for 'rope_type'='yarn': {'apply_yarn_scaling'}
`rope_parameters`'s factor field must be a float >= 1, got 128
`rope_parameters`'s beta_fast field must be a float, got 32
`rope_parameters`'s beta_slow field must be a float, got 1
Unrecognized keys in `rope_parameters` for 'rope_type'='yarn': {'apply_yarn_scaling'}
`rope_parameters`'s factor field must be a float >= 1, got 128
`rope_parameters`'s beta_fast field must be a float, got 32
`rope_parameters`'s beta_slow field must be a float, got 1
RAW_BUFFERClick to expand / collapse

Feature request

Make more permissive config.json/params.json parsing / validation: cast int constants as float without warnings

Motivation

E.g. when loading Leanstral (cf https://huggingface.co/mistralai/Leanstral-2603/discussions/7#69cfde05abe040f5323c6390):

Unrecognized keys in `rope_parameters` for 'rope_type'='yarn': {'apply_yarn_scaling'}
`rope_parameters`'s factor field must be a float >= 1, got 128
`rope_parameters`'s beta_fast field must be a float, got 32
`rope_parameters`'s beta_slow field must be a float, got 1
Unrecognized keys in `rope_parameters` for 'rope_type'='yarn': {'apply_yarn_scaling'}
`rope_parameters`'s factor field must be a float >= 1, got 128
`rope_parameters`'s beta_fast field must be a float, got 32
`rope_parameters`'s beta_slow field must be a float, got 1

1, 32, 128 should be auto-promoted to float

Your contribution

N/A

cc @juliendenize

extent analysis

TL;DR

Modify the parsing/validation logic in config.json/params.json to automatically cast integer constants to floats without warnings.

Guidance

  • Review the current parsing/validation logic for config.json/params.json to identify where integer values are being checked as floats.
  • Update the validation checks to allow integer values to be cast to floats, ensuring that the casted values meet the required conditions (e.g., factor field being a float >= 1).
  • Consider adding explicit type conversions in the code where integer values are assigned to float fields (e.g., factor, beta_fast, beta_slow) to ensure consistency.
  • Verify that the updated parsing/validation logic correctly handles both integer and float inputs for the affected fields.

Example

# Example of explicit type conversion
rope_parameters['factor'] = float(rope_parameters['factor'])
rope_parameters['beta_fast'] = float(rope_parameters['beta_fast'])
rope_parameters['beta_slow'] = float(rope_parameters['beta_slow'])

Notes

The exact implementation details may vary depending on the programming language and framework used. This guidance assumes a Python-based implementation.

Recommendation

Apply workaround: Modify the parsing/validation logic to allow integer values to be cast to floats, as this is a more targeted solution that addresses the specific issue at hand.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING