Basics of PyTorch#
PyTorch is a high-level framework for machine learning based on torch. Modern ML techniques, such as artificial neural networks, require efficient computations of algebraic operations on large and high-dimensional tensors. PyTorch offers a tensor-based computing framework that is optimized for exactly these kinds of computations. Moreover, PyTorch offers ready-made modules for building complex ANNs. A powerful automatic differentiation system, makes training these networks possible.
There are other similar libraries on the market (e.g., tensorflow), but PyTorch has been particularly popular in the NLP community.
Learning goals for this session#
Understand what PyTorch is good for.
Ability to create, access and manipulate tensors.
Understand parameterized model predictions.
Understand of what ‘parameter optimization’ is.
Ability to use stochastic gradient descent to optimize parameters in PyTorch.
Slides#
Here are the slides for this session.
Practical exercises#
There are two notebooks for exercises: one on basics of PyTorch, the other on maximum likelihood estimation. You can also find the extracted Python code for both notebooks on the GitHub repository for this web-book.
Resources#
Official PyTorch website for information on installation