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

add full support for JAX in utils.py #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aalmarhabi
Copy link

Hi Jay, thank you for making the PicoGPT repo. It is very useful, as well as the blog I was following it to understand the GPT model more.

The current version of the repo does support the JAX numpy API. However, for full support, you may consider these changes. I found out that if I also change utils.py numpy to jax.numpy an issue arises (Issue 4564).

So if you modified both gpt2.py and utlis.py to use jax.numpy on the new changes, it should work fine. Also for the current version work fine.

in gpt2 function
token + positional embeddings

    x = wte[np.array(inputs)] + wpe[np.array(range(len(inputs)))]  # [n_seq] -> [n_seq, n_embd]

@aalmarhabi
Copy link
Author

Also, I was testing the code on Python 3.10.9 version, I just forgot to mention that.

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

Successfully merging this pull request may close these issues.

None yet

1 participant