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 a ggml tensor's dimension order reversed? #710

Open
chunhualiao opened this issue Jan 29, 2024 · 1 comment
Open

Is a ggml tensor's dimension order reversed? #710

chunhualiao opened this issue Jan 29, 2024 · 1 comment

Comments

@chunhualiao
Copy link

Hi, when I look at the model/wte tensor (token embedding weights) of GPT-2 117 M example.
It has a shape of [768,50257]. I guess it is the [embedding_dim, vocabulary_size].

Should the usual dimension order for wte be [vocabulary_size, embedding_dim] instead?
If so, why does ggml tensor store the dimensions in a reversed order?

Similarly, model/wpe (positional encoding weights) has the shape of [768,1024], which also seems to be reversed from a usual [1024, 768] order.

Thanks,

@ggerganov
Copy link
Owner

Yes, dimension order is reversed compared to Python: #500 (comment)

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

2 participants