Icon

01_Sentiment_Predictor_Exercise

There has been no title set for this workflow's metadata.

Exercise - Sentiment prediction with LLMs:

- LLMs (open source): Consume model via API to predict sentiment.
- LLMs (closed source): Consume model via API to predict sentiment.

URL: Slides KNIME Analytics Platform Text Mining Course https://www.knime.com/knime-course-material-download-page

Annotations and comments
  • Exercise 01 - Sentiment Prediction with LLMs
  • Learning objective: In this exercise, you will practice performing sentiment classification on an IMDB data set. Workflow description: This workflow predicts the sentiment of movie reviews using LLMs. You’ll find the instructions for the exercises in the yellow annotations.
  • Activity 1. LLMs (open source): Consume model via API to predict sentiment Write a prompt for sentiment prediction in the Table Creator node. Join the prompt with the texts. Make sure that each row contains prompt + text. Get your own private API token from HuggingFace. Follow the instructions: "Get your API Token". Provide the token as a password in the Credentials Configuration node. Authenticate in the HuggingFace Hub with the HF Hub Authenticator node. Connect to the LLM of your choice with the HF Hub LLM Connector node. Pick a model* for text-generation or text2text-generation. For example: bigscience/mt0-large or google/flan-t5-xxl. Obtain predictions with the LLM Prompter node and score the model. * Make sure that the "Hosted inference API" by HuggingFace is available.
  • Your Solution
  • Activity 2. LLMs (closed source): Consume model via API to predict sentiment Write a prompt for sentiment prediction in the Table Creator node. Join the prompt with the texts. Make sure that each row contains prompt + text. Get your own private API key from OpenAI. Sign up to get your key. Provide the key as a password in the Credentials Configuration node. Authenticate in OpenAI with the OpenAI Authenticator node. Connect to the LLM of your choice with the OpenAI Chat Model Connector node. Obtain predictions with the LLM Prompter node and score the model.
  • Read imdb sample data
  • Sample 10 rows

Nodes

Extensions

Links