Fundamentos de PyTorch
¿Qué necesitas para aprender PyTorch?
¿Por qué usar PyTorch?
Hola, mundo en PyTorch
Creación de Tensores en PyTorch
Debugging de operaciones con tensores
Conversión y operación de tensores con PyTorch
Quiz: Fundamentos de PyTorch
Estructura de modelo de deep learning en PyTorch
Generación y split de datos para entrenamiento de modelo
Estructura de modelo en PyTorch con torch.nn
Entrenamiento, funciones de pérdida y optimizadores
Entrenamiento y visualización de pérdida
Predicción con un modelo de PyTorch entrenado
Quiz: Estructura de modelo de deep learning en PyTorch
Redes neuronales con PyTorch
Datos para clasificación de texto
Procesamiento de datos: tokenización y creación de vocabulario
Procesamiento de datos: preparación del DataLoader()
Creación de modelo de clasificación de texto con PyTorch
Función para entrenamiento
Función para evaluación
Split de datos, pérdida y optimización
Entrenamiento y evaluación de modelo de clasificación de texto
Inferencia utilizando torch.compile(): el presente con PyTorch 2.X
Almacenamiento del modelo con torch.save() y state_dict()
Sube tu modelo de PyTorch a Hugging Face
Carga de modelo de PyTorch con torch.load()
Quiz: Redes neuronales con PyTorch
Cierre del curso
Cierre del curso
You don't have access to this class
Keep learning! Join and start boosting your career
Launching into the world of natural language processing using PyTorch has never been so accessible and exciting. In this module, we explore how to build an advanced text classification model with the tools provided by PyTorch and Torch Text. We will dive into using nn.module and Torch Text to study a text classification model, train it and finally implement it on a platform such as Jogging Face. From installing dependencies to text classification, this educational walkthrough will give you the basics to get started.
Torch Text is a powerful library part of the PyTorch suite, aimed at text processing. It provides several tools to adjust texts and prepare them for models within the PyTorch framework. It facilitates the creation of vocabularies, tokenization and handling of real datasets. In addition, PyTorch offers specialized libraries such as Torch Audio and Torch Vision for working with audio and computer vision, respectively, marking its versatility.
To install Torch Text along with a specific version of Portal Locker (required for its operation), we use Google Colab:
!pip install portalocker>=2.0.0!pip install torchtext --upgrade
The --upgrade
flag ensures that we get the latest version available.
Torch Text includes a large set of datasets for testing and training natural language processing models. An important example of such datasets is DBpedia, a high quality dataset composed of English Wikipedia articles and entries.
To use a dataset in Torch Text:
Import the necessary dependencies:
import torchimport torchtext
Access the DBpedia dataset:
from torchtext.datasets import DBpedia.
DBpedia is highly suitable for testing in text classification and is known for its high curation and detailed information. Other available datasets include AGnews and Colag, among many others, facilitating various applications such as machine translation and language modeling.
Once we have loaded the dataset, the goal is to train a model for multiple classification. DBpedia is used here to classify the text into one of the 14 available labels, such as references to an athlete, company or towns. This is where the wonders of word processing come into play: determining the subject matter of a document automatically. Undoubtedly, a powerful tool for startups and large companies.
PyTorch, with its hands spread across multiple libraries, offers advanced resources for machine learning and AI applications. Learning to use tools like Torch Text expands your data science and model development skills, contributing to your professional development - remember to keep exploring and experimenting! The possibilities are as vast as your curiosity allows.
Contributions 3
Questions 1
Want to see more contributions, questions and answers from the community?