3
Compiling the Model
Paraphrasing one of the famous presenters: “It’s time!” After completing our initial steps toward performance improvement, it is time to learn a new capability of PyTorch 2.0 to accelerate the training and inference of deep learning models.
We are talking about the Compile API, which was presented in PyTorch 2.0 as one of the most exciting capabilities of this new version. In this chapter, we will learn how to use this API to build a faster model to optimize the execution of its training phase.
Here is what you will learn as part of this chapter:
- The benefits of graph mode over eager mode
- How to use the API to compile a model
- The components, workflow, and backends used by the API
Technical requirements
You can find the ...
Get Accelerate Model Training with PyTorch 2.X now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.