ML Two
Lecture 09
πŸ€—NLP 103 the finale: Embed ChatGPT (and other OpenAI AI models) in your App😎
Welcome πŸ‘©β€πŸŽ€πŸ§‘β€πŸŽ€πŸ‘¨β€πŸŽ€
First of all, don't forget to confirm your attendence on Seats App!
After today's lecture:
-- A "ChatGPT-powered" APP built on your phone
-- Knowing how to incorporate ANY OpenAI model in your future Apps (via the magic named "API")
Recap on last two weeks of NLP series 🀌
Basic NLP tasks
--- Language identification
--- Named Entity Recognition
--- Part-of-speech tagging
--- Lemmatization
--- Tokennization
Higher-level NLP tasks
--- Sentiment analysis
An emoji summerising up previous NLP models: πŸ‘Ά
Today we are going to interact with Large Language Model (e.g. GPT models by OpenAI)!
The evolution pathway of ChatGPT πŸ›£οΈ
-- architecture improvement:
the "T" in GPT: transformer (attention mechanism)
-- upscaled data:
570GB of data obtained from various sources
-- upscaled model:
175 Billion parameters
-- upscaled computation resource:
~10,000 GPUs
etc.
Let's bring this gem into our phone (any ios app actually).
Example App code
here
referenced from this article
βœ‹We are not copying pasting the large language models themselves into our phone (check how large they are).
πŸ‘Instead we will use OpenAI APIs to communicate with large language models stored on their servers.
To be able to use Open APIs, we need "API key"πŸ—οΈ.
API key ???
πŸ™Œ Reading session (VERY IMPORTANT)
-- 1. Have a read on the OpenAI API document here
-- 2. Have a read on how to get an OpenAI API key here
Just a quick quiz: what's the model name for speech recognition?
πŸ™Œ Hands-on session
1. Generate a new OpenAI API key here .
2. Paste that into the code:"OpenAIConnector" file -> Line 18 let openAIKey = ""
3. Build the App. (you need to comment out line 17)
me demo πŸ’…
To incorporate this to any other app:
1. Check the last section from this article
2. See how the example code generates request(input) and handles response(output), both in JSON
A little exercise: how to turn this app into an auto-summary app?
- that is to,
πŸ“² input a paragraph to be summarised,
πŸ”˜ click a button,
πŸ‚ output a summary of that paragraph!
But the response is slow πŸ₯²:
-- There are other language models that are faster!
-- check the timeout parameter in line 94 from OpenAIConnector.
πŸŽ‰
Today we talked about:
1. OpenAI APIs and how to get your API key.
2. Example of embedding OpenAI models into your APP via the API.
A weekly gentle reminder of the final assessment presentation ✌️πŸ₯
Video time: 2022 Art Show: NeurIPS Workshop on Machine Learning for Creativity and Design
We'll see you next week same time same place! 🫑