Repository navigation
feat: RoPE-related typing improvements - #41967
RyanMullins wants to merge 2 commits into
Conversation
|
LGTM but cc @zucchini-nlp @ArthurZucker! |
f300361 to
7e7ab8b
Compare
ddcd9e9 to
cbb3751
Compare
|
[For maintainers] Suggested jobs to run (before merge) run-slow: gemma3 |
cbb3751 to
db871df
Compare
zucchini-nlp
left a comment
There was a problem hiding this comment.
Thanks a lot for adding a docstring, much clearer! I just left a few comments to be aligned with current code
| logger.warning( | ||
| "Unable to find a rope_theta and defaults are not supported for this value. Returning the config" | ||
| " un-modified. Verify that the model uses RoPE and that it should have been present in this config." | ||
| ) |
There was a problem hiding this comment.
maybe not raise a warning? Standardization can be called on an already standardized config and this warning will be raised every time it happens
| rope_theta = getattr(config, "rope_theta", None) | ||
|
|
||
| # Case 1: one RoPE theat = one RoPE param per model without nesting | ||
| def process_rope_parameters_for_layer_type(rope_theta: dict[str, float], layer_type: str) -> RopeParameters: |
There was a problem hiding this comment.
let's expect a single theta here, since we're already unfolding thetas dict below
| ) | ||
| return | ||
|
|
||
| config.rope_parameters = RopeParameters(rope_type=rope_type, rope_theta=rope_theta) |
There was a problem hiding this comment.
if we create a new value, we can lose scaling params that existed before like rope_parameters.factor
|
Closing this draft since it has been inactive for a while and |
What does this PR do?
Fixes #41964
total=FalseonRopeParametersRequiredto the relevant properties ofRopeParametersBefore submitting
Pull Request section?
to it if that's the case. Improve typing support and flexibility for RopeParameters #41964
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.