Training produces a model whose parameters are optimized for a task. Deployment puts that model where people or applications can use it—for example, on a server, in a larger application, or on a phone. The right route depends on where inference needs to run. section 1.5 section 17.0
Common routes serve different needs:
- Use Gradio for a quick, shareable demo that lets people try the model. section 17.0
- Use a Python web framework such as FastAPI to expose the model through a network API. section 17.0
- Export to ONNX when the model must run with compatible processors, hardware, or cloud services. section 17.0
- Consider LibTorch for C++ applications or ExecuTorch for mobile deployment. section 17.7
Deployment may also involve improving inference performance. PyTorch normally executes operations immediately in eager mode; production options include torch.compile for optimization and export tools for other runtimes. These choices are separate from training the model. section 1.5 section 17.7
Figure 1.2 Basic, high-level structure of a PyTorch project, with data loading, training, and deployment to production
The project diagram places deployment after data loading and training, showing why a trained model is a milestone rather than the end of the workflow. section 1.5






















