Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this a typo of rotary embedding (rope)? #184

Open
xilanhua12138 opened this issue Jan 14, 2025 · 0 comments
Open

Is this a typo of rotary embedding (rope)? #184

xilanhua12138 opened this issue Jan 14, 2025 · 0 comments

Comments

@xilanhua12138
Copy link

xilanhua12138 commented Jan 14, 2025

` def forward(self, hidden_states: torch.Tensor, frame_id: int=None) -> torch.Tensor:
batch_size, num_channels, num_frames, height, width = hidden_states.shape
rope_sizes = [num_frames // self.patch_size_t, height // self.patch_size, width // self.patch_size]

    axes_grids = []
    for i in range(3):
        # Note: The following line diverges from original behaviour. We create the grid on the device, whereas
        # original implementation creates it on CPU and then moves it to device. This results in numerical
        # differences in layerwise debugging outputs, but visually it is the same.
        grid = torch.arange(0, rope_sizes[i], device=hidden_states.device, dtype=torch.float32)
        axes_grids.append(grid)
    grid = torch.meshgrid(*axes_grids, indexing="ij")  # [W, H, T]
    grid = torch.stack(grid, dim=0)  # [3, W, H, T]

`

this should be [T, H, W] not [W, H, T], am I thinking right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant