Repository navigation
MRoPE continued - #48594
MRoPE continued#48594
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
| # do not use the same rope config as LM backbone, vision will always use axial rope (i hope) | ||
| if "rope_parameters" in kwargs: | ||
| kwargs["rope_parameters"] = {"rope_type": "axial", "rope_theta": 10_000} |
There was a problem hiding this comment.
not cool in general that we can't set different values for the same key on text/vision/audio subconfigs. The only way is to override the whole config construction
Should be improved in the future!
| "hidden_act": "silu", | ||
| "max_position_embeddings": 512, | ||
| "rope_parameters": {"type": "default", "mrope_section": [2, 2], "partial_rotary_factor": 1.0}, | ||
| "rope_parameters": {"type": "default", "mrope_section": [2, 3, 3], "partial_rotary_factor": 1.0}, |
There was a problem hiding this comment.
the code hardcoded 3 and even official ckpt uses 3 sections
| class Cosmos3EdgeTextRotaryEmbedding(Qwen3VLTextRotaryEmbedding): | ||
| pass |
There was a problem hiding this comment.
was really identical, we gotta be careful when reviewing models so contribs don't re-invent the wheel
There was a problem hiding this comment.
Sadly will and can happen at times. This is why it's more important than ever to have a more uniform recipe 🫡
| # Interleave them instead of usual shape | ||
| cos = cos[..., : cos.shape[-1] // 2].repeat_interleave(2, dim=-1) | ||
| sin = sin[..., : sin.shape[-1] // 2].repeat_interleave(2, dim=-1) | ||
|
|
There was a problem hiding this comment.
this is so weird 😆
It was doing too much so I moved interleave where it belongs, sadly though we still can't apply rope kernel
There was a problem hiding this comment.
Argh I swear we can get there tho! I will maybe check whether I can work on the kernels side for this
There was a problem hiding this comment.
Maybe open an issue for me :D
| def recomposition_frequencies(self, freq): | ||
| """ | ||
| Recompose the frequencies into the final spatial layout used per each grid. | ||
| """ | ||
| freq = torch.cat( | ||
| [m[i % len(self.mrope_section)] for i, m in enumerate(freq.split(self.mrope_section, dim=-1))], dim=-1 | ||
| ) | ||
| return torch.cat((freq, freq), dim=-1) |
There was a problem hiding this comment.
basically qwen but the num_axis depends on config instead of hardcoded 3, and the init is a bit different
| rope_parameters["partial_rotary_factor"] = partial_rotary_factor | ||
| rope_parameters.setdefault("partial_rotary_factor", partial_rotary_factor) |
There was a problem hiding this comment.
don't force override if the dict has a value set, mirror setdefault(rope_theta) above, a missed bug from months ago
There was a problem hiding this comment.
uh oh do we maybe have a test for that
|
run-slow: cosmos3_edge, glm4v, glm4v_moe, glm_image, glm_ocr, hunyuan_vl, kimi_k25, mistral3, pixtral |
|
This comment contains models: ["models/cosmos3_edge", "models/glm4v", "models/glm4v_moe", "models/glm_image", "models/glm_ocr", "models/hunyuan_vl", "models/kimi_k25", "models/mistral3", "models/pixtral"] |
|
This comment contains models: ["models/cosmos3_edge", "models/glm4v", "models/glm4v_moe", "models/glm_image", "models/glm_ocr", "models/hunyuan_vl", "models/kimi_k25", "models/mistral3", "models/pixtral"] |
CI Results (AMD)Commit Info
Model CI Report❌ 17 new failed tests from this PR 😭
|
|
run-slow: glm4v, glm4v_moe, glm_image, glm_ocr, hunyuan_vl |
CI ResultsCommit Info
Model CI Report❌ 2 new failed tests from this PR 😭
|
|
I am so lost with slow CI reports, so is it green or failing edit: ah one is for AMD... |
|
run-slow: hunyuan_vl |
|
run-slow: hunyuan_vl |
|
This comment contains models: ["models/hunyuan_vl"] |
|
This comment contains models: ["models/hunyuan_vl"] |
CI recapDashboard: View test results in Grafana |
|
Yea, this is truly weird with casting rope into dtype, uncasting back to rotate and downcasting QK again 🫠 |
|
Maybe you can move the dtype casting to apply rope but yea no worries. Sometimes we have to do weird things to keep up with the original |
|
Yeah, that is what I did at the end but I really wanted to keep it copied from Llama (not today) 😆 |
* add and fix * wait what, why would they even override if it is same as qwen?! * LOL why would we cat if rope is interleaved * fix last * axial but needs a fix * maybe last fix? * fix for the test, also this is more "standard" * skip * lost partial rotary factor * just noticed - kinda weird rope but oke * that still doesn't mul each value, gotta iterate * nit * keep float32 for rope, this should still be equivalent i hope * really didnt want it, but num precision matters more than i thought
What does this PR do?
Un-skips rope tests for 3D positions and reverts the
no_grad()on rope, i don't know how and when it got deleted 😭Thought we could also add test for each model config that
validate_rope()raises no warnings (given GH a few issues i've seen), though we can't test with real weight so too much work for little gain, leaving that out