Hey guys. In this blog, we are going to learn about GPT3 and how it can help us create text

It means Generative Pre-training Transformer 3

GPT3 is an in-depth learning language model trained in over 175 million parameters, making it the best for most NLP tasks.

GPT-3 can create anything with a language structure – which means it can answer questions, write essays, condense long texts, translate languages, take notes, and even generate computer code.

So we are going to how we can use GPT 3 templates to create text in Python.

So that’s what we need PyTorch and Transformers.

So let’s install it in our Google Colab / Jupyter notebook.

Big Data jobs
!pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html!pip install transformers

Now we have to bring tube

from transformers import pipeline

Now we are going to download the GPT 3 model. Here I have used EleutherAI / gpt-neo-1.3B model. You can also use EleutherAI / gpt-neo-2.7B which is more accurate but requires about 60GB of download file. You can use anything.

generator = pipeline(‘text-generation’, model=’EleutherAI/gpt-neo-1.3B’)

Now we need to move the text to the downloaded template

1. Why do business AI projects fail?

2. How will artificial intelligence trigger the next wave of healthcare innovation?

3. Machine learning using a regression model

4. Most popular computing platforms in 2021, other than Kaggle

text = ‘Who is Elon Musk'

Now we use the generator function and pass the max_length, do_sample and temperature.

result = generator(text, max_length=100, do_sample=True, temperature=0.9)

Last we print our results

>>Who is Elon Musk? Elon Musk made a name for himself at Tesla, where he transformed the auto industry. In 2009, the entrepreneur and founder of Tesla Motors was named the “World’s Most Hated Person.” Today, Musk is the richest man on Earth;

You can access my GitHub archive here

I hope you enjoy this blog. Feel free to share your thoughts in the comments section and you can also contact me: –
Linkedin – https://www.linkedin.com/in/shreyak007/
Github – https://github.com/Shreyakkk
Twitter – https://twitter.com/Shreyakkkk
Instagram – https://www.instagram.com/shreyakkk/
Snapchat – shreyak001
Facebook – https://www.facebook.com/007shreyak

Thank you!


Please enter your comment!
Please enter your name here