Skip to content

Add comment on using torch.utils.benchmark #2147

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

Merged
merged 3 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions intermediate_source/torch_compile_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ much as possible, and so we chose ``"reduce-overhead"``. For your own models,
you may need to experiment with different modes to maximize speedup. You can
read more about modes `here <https://pytorch.org/get-started/pytorch-2.0/#user-experience>`__.

For general PyTorch benchmarking, you can try using ``torch.utils.benchmark`` instead of the ``timed``
function we defined above. We wrote our own timing function in this tutorial to show
``torch.compile``'s compilation latency.

Now, let's consider comparing training.

.. code-block:: python
Expand Down
4 changes: 4 additions & 0 deletions intermediate_source/torch_compile_tutorial_.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ def evaluate(mod, inp):
# you may need to experiment with different modes to maximize speedup. You can
# read more about modes `here <https://pytorch.org/get-started/pytorch-2.0/#user-experience>`__.
#
# For general PyTorch benchmarking, you can try using ``torch.utils.benchmark`` instead of the ``timed``
# function we defined above. We wrote our own timing function in this tutorial to show
# ``torch.compile``'s compilation latency.
#
# Now, let's consider comparing training.

model = init_model()
Expand Down