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

Ensure the computation stays in single precision #12

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

certik
Copy link
Contributor

@certik certik commented Feb 17, 2023

On my computer this change makes picoGPT several times faster.

Before:

$ time python gpt2.py 'Alan Turing theorized that computers would one day become' --models_dir ../gpt2/models 
generating: 100%|███████████████████████████████| 40/40 [00:16<00:00,  2.40it/s]
 the most powerful machines on the planet.

The computer is a machine that can perform complex calculations, and it can perform these calculations in a way that is very similar to the human brain.

python gpt2.py 'Alan Turing theorized that computers would one day become'    95.80s user 1.85s system 516% cpu 18.913 total

After:

$ time python gpt2.py 'Alan Turing theorized that computers would one day become' --models_dir ../gpt2/models
generating: 100%|███████████████████████████████| 40/40 [00:03<00:00, 12.11it/s]
 the most powerful machines on the planet.

The computer is a machine that can perform complex calculations, and it can perform these calculations in a way that is very similar to the human brain.

python gpt2.py 'Alan Turing theorized that computers would one day become'    22.94s user 0.72s system 428% cpu 5.526 total

The inference went from 16s to 3s.

On my computer this change makes picoGPT several times faster.
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.

2 participants