-
Notifications
You must be signed in to change notification settings - Fork 19
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
adding benchmarking #3
Conversation
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the False True
args in your example command line doing? Let's make those proper named args so they're not a mystery :)
models/llama/llama/mathOps.py
Outdated
@@ -0,0 +1,143 @@ | |||
import torch.nn.functional as F |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be math_ops.py
to keep with standard conventions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing
@bertmaher fixed! was only in the test plan the params are properly named in the main.py file :) |
benchmarking/profiler.py
Outdated
start_time = time.perf_counter() | ||
|
||
with torch.profiler.record_function(name): | ||
result = func(*args, **kwargs) | ||
|
||
end_time = time.perf_counter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perf_counter
isn't the right way to measure GPU time. Use torch.cuda.Event
instead:
https://discuss.pytorch.org/t/how-to-measure-time-in-pytorch/26964
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary:
adding benchmarking by pulling out all the parts of torch we want to replace with triton and adding them to a single operators file. I also had to make some changes to the existing kernels since they had relative paths to triton itself
Test Plan:
made sure I didnt break anything so far
python3.9 -m main llama_chat_completion --profile=False --benchmark=True --ckpt_dir="models/llama/meta-llama/Meta-Llama-3-8B-Instruct/original" --tokenizer_path="models/llama/meta-llama/Meta-Llama-3-8B-Instruct/original/tokenizer.model" --use_triton=False
Output from benchmarks: