Notebook
PyTorch training
Prerequisites
Setup Configuration file path
Dataset
The data set (The Social Dilemma Tweets - Text Classification 2020) was downloaded from Kaggle. This dataset brings you the twitter responses made with the #TheSocialDilemma hashtag after watching the eye-opening documentary "The Social Dilemma" released in an OTT platform(Netflix) on September 9th, 2020. The dataset was extracted using TwitterAPI, consisting of nearly 10,526 tweets from twitter users all over the globe!
We'd like to train a model based on the content of the text in order to determine the sentiment.
This is a multi-class classification problem:
- Negative - 0
- Neutral - 1
- Positive - 2
Step 1 - Import Modules
Here we’ll import some libraries and define some variables.
Create a SageMaker Session and save the default region and the execution role in some Python variables
Upload the dataset in the default Amazon S3 Bucket
In order to make data available for the SageMaker Processing Job, let's copy the dataset in the default S3 Bucket
Step 2 - Create the ModelTrainer
Queue Some Training Jobs
This section and the following are intended to be used interactively so that you can explore how to use the SageMaker Python SDK to submit jobs to your Batch queues. Let's start by selecting which queue to submit to.
Select the Queue to Use
Submit your jobs
In the next cell, we are going to submit 2 Training jobs in the queue
We are going to use the API submit to submit all the jobs
Display the Status of Running and 'In Queue' Jobs
We can use the job queue list and job queue snapshot APIs to programmaticaly view a snapshot of the jobs that the queue will run next. Keep in mind that for fair-share queues this ordering is dynamic and occassionally needs to be refreshed as new jobs are submitted to the queue or as share usage changes over time.
Submit an additional job
In the next cell, we are going to submit an additional job to the queue, by using the API submit
Display the Status of Running and 'In Queue' Jobs
Now we are going to see another runnable job. Given that the last job has high priority, it will be run before the MIDPRI and LOWPRI jobs
Cancel a Job in the Queue
This next cell shows how to cancel an in queue job.