From 98fe59708874a41a08234913e884fb73f4838400 Mon Sep 17 00:00:00 2001 From: Madeline Underwood <167196745+madeline-underwood@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:14:51 +0000 Subject: [PATCH 1/2] update --- .../thirdai-sentiment-analysis/_index.md | 4 ++-- .../thirdai-sentiment-analysis/udt-walkthrough.md | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/_index.md b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/_index.md index 69abcf73c..973a7005f 100644 --- a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/_index.md +++ b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/_index.md @@ -3,14 +3,14 @@ title: Run Text Classification with ThirdAI on Arm servers minutes_to_complete: 10 -who_is_this_for: This is an introduction for software developers who want to learn how to run text classification tasks with ThirdAI on Arm servers. +who_is_this_for: This is for software developers who want to learn how to run text classification tasks with ThirdAI on Arm servers. learning_objectives: - Train, evaluate, and deploy a ThirdAI model. - Set up your Arm server for text classification tasks with ThirdAI. prerequisites: - - An [Arm based instance](/learning-paths/servers-and-cloud-computing/csp/) from a cloud service provider or an on-premise Arm server. + - An [Arm-based instance](/learning-paths/servers-and-cloud-computing/csp/) from a cloud service provider or an on-premise Arm server. author_primary: ThirdAI diff --git a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/udt-walkthrough.md b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/udt-walkthrough.md index 7e202e783..9e3cc8816 100644 --- a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/udt-walkthrough.md +++ b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/udt-walkthrough.md @@ -13,11 +13,11 @@ layout: learningpathall ThirdAI is a multi-purpose library that provides a high-level API to build machine learning models. It provides APIs to support common machine learning problems, such as: -- Text Classification and NLP (Natural Language Processing) -- Search and Recommendation -- Time-series Forecasting and Predictions -- Tabular Classification -- Graph Classification +- Text Classification and NLP (Natural Language Processing). +- Search and Recommendation. +- Time-series Forecasting and Predictions. +- Tabular Classification. +- Graph Classification. The following steps show you how to use ThirdAI's library for Text Classification tasks on your Arm servers. @@ -29,7 +29,7 @@ You need to install Python and pip to use ThirdAI. The instructions below are fo sudo apt install python3-pip python3-venv -y ``` -Create a virtual environment to avoid dependency conflicts. +Create a virtual environment to avoid dependency conflicts: ```bash python3 -m venv thirdai From ac106c7c31a2e94ea25c1bc3bbac158c3b1a7b46 Mon Sep 17 00:00:00 2001 From: Madeline Underwood <167196745+madeline-underwood@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:40:02 +0000 Subject: [PATCH 2/2] Editorial review --- .../thirdai-sentiment-analysis/_next-steps.md | 2 +- .../background_and_overview.md | 29 ++++++++++++++++ .../thirdai-sentiment-analysis/evaluate.md | 8 ++--- .../udt-walkthrough.md | 33 +++---------------- 4 files changed, 39 insertions(+), 33 deletions(-) create mode 100644 content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/background_and_overview.md diff --git a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/_next-steps.md b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/_next-steps.md index 5728f1c9a..15e85323b 100644 --- a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/_next-steps.md +++ b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/_next-steps.md @@ -1,5 +1,5 @@ --- -next_step_guidance: Thank you for completing this learning path on how to run text classification tasks on Arm CPUs with ThirdAI. You might be interested how to use the HuggingFace library and transformers to accomplish a similar task. +next_step_guidance: Thank you for completing this Learning Path on how to run text classification tasks on Arm CPUs with ThirdAI. You might be interested in how to use the HuggingFace library and transformers to accomplish a similar task. recommended_path: /learning-paths/servers-and-cloud-computing/nlp-hugging-face/ diff --git a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/background_and_overview.md b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/background_and_overview.md new file mode 100644 index 000000000..c560f0197 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/background_and_overview.md @@ -0,0 +1,29 @@ +--- +title: Background and Overview of Learning Path +weight: 2 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- +## What is ThirdAI? + +ThirdAI is a multi-purpose library that provides a high-level API to build machine learning models. + +It provides APIs to support common machine learning problems, such as: +- Text classification and NLP (Natural Language Processing). +- Search and recommendation. +- Time-series forecasting and predictions. +- Tabular classification. +- Graph classification. + +## Learning Path Overview + +This Learning Path shows you how to use ThirdAI's library for *text classification* tasks on your Arm servers. + +Specifically, the Learning Path shows you how to perform the following tasks: + +- Download a sentiment classification dataset using the Hugging Face `datasets` library. +- Format the data for the model to understand. +- Create a UniversalDeepTransformer, and configure it for text classification. +- Train the model and print the training metrics. +- Save the model to `sentiment_analysis.model` for further deployment. diff --git a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/evaluate.md b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/evaluate.md index 90742ade9..99e729b69 100644 --- a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/evaluate.md +++ b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/evaluate.md @@ -1,6 +1,6 @@ --- title: Evaluate the model -weight: 3 +weight: 4 ### FIXED, DO NOT MODIFY layout: learningpathall @@ -54,9 +54,9 @@ validate | epoch 0 | train_steps 8790 | val_categorical_accuracy=0.843548 | val ``` This example performs the following tasks: -- Load the trained model from the saved file -- Run the evaluation on the test dataset and report accuracy metrics -- Give an example of how to handle a prediction in a real time inference setting +- Load the trained model from the saved file. +- Run the evaluation on the test dataset and report accuracy metrics. +- Give an example of how to handle a prediction in a real time inference setting. The first output line provides the accuracy results and run time for the 40,000 text strings of test data. diff --git a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/udt-walkthrough.md b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/udt-walkthrough.md index 9e3cc8816..d5fbe427c 100644 --- a/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/udt-walkthrough.md +++ b/content/learning-paths/servers-and-cloud-computing/thirdai-sentiment-analysis/udt-walkthrough.md @@ -1,29 +1,14 @@ --- title: Train a model for text classification -weight: 2 +weight: 3 ### FIXED, DO NOT MODIFY layout: learningpathall --- -![alt-text #center](thirdai_logo.png) - -## What is ThirdAI? - -ThirdAI is a multi-purpose library that provides a high-level API to build machine learning models. - -It provides APIs to support common machine learning problems, such as: -- Text Classification and NLP (Natural Language Processing). -- Search and Recommendation. -- Time-series Forecasting and Predictions. -- Tabular Classification. -- Graph Classification. - -The following steps show you how to use ThirdAI's library for Text Classification tasks on your Arm servers. - ## Install dependencies -You need to install Python and pip to use ThirdAI. The instructions below are for Ubuntu, but other Linux distributions can be used. +You will need to install Python and pip to use ThirdAI. The instructions below are for Ubuntu, but you can use other Linux distributions. ```bash { target="ubuntu:latest" } sudo apt install python3-pip python3-venv -y @@ -38,7 +23,7 @@ source thirdai/bin/activate The prompt of your terminal now has (thirdai) as a prefix to indicate the virtual environment is active. -To start, you will need to install the ThirdAI package: +To start, you need to install the ThirdAI package: ```bash pip3 install thirdai @@ -60,7 +45,7 @@ The dataset is called "polarity" because it focuses on binary sentiment classifi This dataset is often used in natural language processing tasks related to sentiment analysis, where the goal is to determine the sentiment expressed in a piece of text. -## Train the model +## Download dataset and train the model You are now ready to download the text classification dataset and train a classification model with ThirdAI. @@ -111,14 +96,6 @@ model = bolt.UniversalDeepTransformer.load(save_location) model.evaluate(test_filename, metrics=["categorical_accuracy"]) ``` - -This example performs the following tasks: -- Download a sentiment classification dataset using the Hugging Face `datasets` library -- Format the data for the model to understand -- Create a UniversalDeepTransformer and configure it for text classification -- Train the model and print the training metrics -- Save the model to `sentiment_analysis.model` for further deployment - To train the model run the script: ```bash @@ -152,7 +129,7 @@ validate | epoch 0 | train_steps 8790 | val_categorical_accuracy=0.843548 | val ``` -With each epoch, the model refines its understanding of the training data, leading to an increase in accuracy. This means it's getting better at making correct predictions. +With each epoch, the model refines its understanding of the training data, leading to increased accuracy. This means it is getting better at making correct predictions. To examine the training data, open the `amazon_polarity_train.csv` file. Each line contains a phrase and is followed by either a 1, signifying a positive review, or a 0, representing a negative review.