Skip to content

Conversation

@echosprint
Copy link

Previously, we used .repeat(1,1,1,2) to expand our RoPE sin/cos embeddings, which duplicated each frequency across its vector pair. This is a subtle bug.

This change replaces that pattern with a direct repeat_interleave(2, dim=-1), ensuring that each θᵢ is exactly duplicated for both dimensions of its 2×2 rotation block:

  • Before: repeat(1,1,1,2)
  • After: repeat_interleave(2, dim=-1)

By interleaving correctly, we guarantee proper alignment of all coordinate pairs during the complex rotation.

…or_keys

Previously, we used `.repeat(1,1,1,2)` to expand our RoPE sin/cos embeddings, which duplicated each frequency across its vector pair. This is a subtle bug.

This change replaces that pattern with a direct `repeat_interleave(2, dim=-1)`, ensuring that each θᵢ is exactly duplicated for both dimensions of its 2×2 rotation block:

- Before: `repeat(1,1,1,2)`  
- After:  `repeat_interleave(2, dim=-1)`

By interleaving correctly, we guarantee proper alignment of all coordinate pairs during the complex rotation.
@facebook-github-bot
Copy link

Hi @echosprint!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 13, 2025
@ballasnicolas
Copy link
Contributor

Hi @echosprint,

Thanks for the catch!

Indeed you are right that we use a different angle per coordinate axis in the current implementation. We can't merge the PR as this would break compatibility with the pretrained model but it would be useful to highlight the difference with RoPE with a comment.

russellhowes added a commit that referenced this pull request Aug 18, 2025
russellhowes added a commit that referenced this pull request Aug 19, 2025
russellhowes added a commit that referenced this pull request Aug 19, 2025
* Comments addressing PR #15 and Issue #65

* Link to PR #15
@russellhowes
Copy link
Contributor

russellhowes commented Aug 19, 2025

Echoing Nicolas, thanks for flagging! I added your proposed change (commented out) in #75 so others can easily make the change locally for their own pretraining if desired. Closing this PR out

richardhoff88 pushed a commit to richardhoff88/vjepa2 that referenced this pull request Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants