Blog Post Generation
This example uses text generation. Text generation can be very powerful, but using it correctly takes a bit of practice.
For most use cases based on text generation, it is crucial to understand the few-shot learning concept. Basically, in order for GPT to understand what you want, you should give it a couple of examples in your input request. In the playground, we are illustrating with some random examples, but for better results you should create your own few-shot examples that better suit your own use case.
If you're still not getting good results even when using few-shot learning, it might be a sign that you need to fine-tune your own GPT model. You can easily do it on NLP Cloud.
Feel free to play with the text parameters like top p, temperature, repetition penalty... and see the documentation about how to use these parameters if needed.
If you need advice, please contact us!
Control whether you want to use the model on a GPU. Machine learning models run much faster on GPUs.
Whether min_length and max_length should not include the length of the input text. If false, min_length and max_length include the length of the input text. If true, min_length and max_length don't include the length of the input text. Defaults to false.
Whether you want to remove the input text form the result. Defaults to false.
Whether or not to use sampling; use greedy decoding otherwise. Defaults to true. This is an advanced parameter, so you should change it only if you know what you're doing. Not supported yet by Fast GPT-J.
Whether to stop the beam search when at least num_beams sentences are finished per batch or not. Defaults to false. This is an advanced parameter, so you should change it only if you know what you're doing. Not supported yet by Fast GPT-J.
The minimum number of tokens that the generated text should contain. The size of the generated text should not exceed 256 tokens on a CPU plan and 1024 tokens on GPU plan (please contact us if you need more generated tokens). The input size + the size of the generated text should not exceed 2048 tokens. If length_no_input is false, the size of the generated text is the difference between min_length and the length of your input text. If length_no_input is true, the size of the generated text simply is min_length. Defaults to 10. Not supported yet by Fast GPT-J.
The maximum number of tokens that the generated text should contain. The size of the generated text should not exceed 256 tokens on a CPU plan and 1024 tokens on GPU plan (please contact us if you need more generated tokens). The input size + the size of the generated text should not exceed 2048 tokens. If length_no_input is false, the size of the generated text is the difference between max_length and the length of your input text. If length_no_input is true, the size of the generated text simply is max_length. Defaults to 50.
A specific token that should be the end of the generated sequence. For example if could be `.` or `###` or anything else below 10 characters (`\n` is not supported for the moment).
Whether you want to remove the end sequence form the result. Defaults to false.
List of tokens that are not allowed to be generated. Defaults to null. Not supported yet by Fast GPT-J.
If set to int > 0, all ngrams of that size can only occur once. Defaults to 0. This is an advanced parameter, so you should change it only if you know what you're doing. Not supported yet by Fast GPT-J.
The number of independently computed returned sequences. Defaults to 1. Not supported yet by Fast GPT-J.
Prevents the same word to be repeated too many times. 1.0 means no penalty. Defaults to 1.0. Not supported yet by Fast GPT-J.
Exponential penalty to the length. 1.0 means no penalty. Set to values < 1.0 in order to encourage the model to generate shorter sequences, or to a value > 1.0 in order to encourage the model to produce longer sequences. Defaults to 1.0. Not supported yet by Fast GPT-J.
Number of beams for beam search. 1 means no beam search. If num_beams > 1, the size of the input text should not exceed 40 tokens on GPU (please contact us if you need a bigger input length with num_beams > 1). Defaults to 1. This is an advanced parameter, so you should change it only if you know what you're doing. Not supported yet by Fast GPT-J.
The number of highest probability vocabulary tokens to keep for top-k-filtering. Maximum 1000 tokens. The lower this value, the less likely GPT-J is going to generate off-topic text. Defaults to 0 on base GPT-J and defaults to 50 on fast GPT-J.
If set to float < 1, only the most probable tokens with probabilities that add up to top_p or higher are kept for generation. The higher this value, the less deterministic the result will be. It's recommended to play with top_p if you want to produce original content for applications that require accurate results, while you should use temperature if you want to generate more funny results. You should not use both at the same time. Should be between 0 and 1. Defaults to 0.7.
The value used to module the next token probabilities. The higher this value, the less deterministic the result will be. For example if temperature=0 the output will always be the same, while if temperature=1 each new request will produce very different results. It's recommended to play with top_p if you want to produce original content for applications that require accurate results, while you should use temperature if you want to generate more funny results. You should not use both at the same time. Should be between 0 and 1. Defaults to 1.
NLP has a critical weakness: it doesn't work well with non-English languages.
We do our best to add non-English models when it's possible. See for example XLM Roberta Large XNLI, TF Allociné, German Sentiment Bert... Unfortunately few models are available so it's not possible to cover all the NLP use cases with that method.
In order to solve this challenge, we developed a multilingual AI that automatically translates your input into English, performs the actual NLP operation, and then translates the result back to your original language. It makes your requests a bit slower but returns impressive results.
Simply select your language in the list, and from now on you can write the input text in your own language!
This multilingual add-on is a paid feature. Please contact the support team so they can upgrade your plan.
What is Blog Post Generation and Why Use GPT?
Blog post generation is about getting AI to automatically write a blog article for you. Simply give a couple of instructions to the AI and it will write a whole blog post for you that is both relevant and fluent. You can even automatically generate blog posts with the proper HTML formatting (headings, subheadings, etc.). GPT (GPT-J / GPT-Neo / GPT-NeoX) is perfectly suited for this task because it is very good at understanding your requirements and at generating complex content based on this, in many languages. This is pure original content so there is no risk of duplicated content.
For example ask the following: generate a blog article about a text classification API. The AI model could return something like this:
<h1>Text Classification API</h1>
<h2>What is Text Classification?</h2>
<p>Text classification is the process of categorizing a block of text based on one or several labels. Let's say you have the following block of text: Perseverance is just getting started, and already has provided some of the most iconic visuals in space exploration history. It reinforces the remarkable level of engineering and precision that is required to build and fly a vehicle to the Red Planet. Let's also say that you also have the following labels: space, science, and food. Now the question is: which ones of these labels apply best to this block of text? Answer is space and science of course.</p>
<h2>Text Classification with Hugging Face Transformers.</h2>
<p>Hugging Face transformers is an amazing library that has been recently released. It is based on either PyTorch or TensorFlow, depending on the model you're using. Transformers have clearly helped deep learning NLP make great progress in terms of accuracy. However this accuracy improvement comes at a cost: transformers are extremely demanding in terms of resources.</p>
You could also pass specific keywords that you want to be included in your blog article. Or on the contrary you can explicitly specify keywords that you don't want to see in the final blog post.
The length of the article, its structure, and the generated content itself, will radically depend on the instructions you pass to the AI.
GPT-J and GPT-NeoX are the most advanced open-source NLP model as of this writing, and they are the best alternatives to GPT-3 for full blog post generation, without restrictions. These models are so big that they can adapt to many situations, and behave like real content writers. For advanced use cases, it is possible to fine-tune GPT (train it with your own data), which is a great way to perform more advanced code generation that is perfectly tailored to your company or industry.
Why Use Automatic Blog Post Generation?
Content creation is at the heart of every marketing and SEO strategies today, but producing quality content on a regular basis can be tedious and very costly. Here are a couple of examples about how you could leverage blog post generation:
Feed a Corporate Blog
So many corporate blogs stop being maintained after a couple of articles because it's too much work. This is bad for SEO but it also gives a bad impression to visitors. Thanks to automatic content writing, you can easily write a couple of articles per week in a couple of minutes that rank very well on Google.
Writing articles in non-English languages is often a good strategy to rank on competitive keywords, but of course writing multilingual content is hard... You can now easily do it thanks to GPT-J.
import nlpcloud client = nlpcloud.Client("fast-gpt-j", "", gpu=True, lang="en") client.generation("""[Title]: 3 Tips to Increase the Effectiveness of Online Learning [Blog article]: <h1>3 Tips to Increase the Effectiveness of Online Learning</h1> <p>The hurdles associated with online learning correlate with the teacher’s inability to build a personal relationship with their students and to monitor their productivity during class.</p> <h2>1. Creative and Effective Approach</h2> <p>Each aspect of online teaching, from curriculum, theory, and practice, to administration and technology, should be formulated in a way that promotes productivity and the effectiveness of online learning.</p> <h2>2. Utilize Multimedia Tools in Lectures</h2> <p>In the 21st century, networking is crucial in every sphere of life. In most cases, a simple and functional interface is preferred for eLearning to create ease for the students as well as the teacher.</p> <h2>3. Respond to Regular Feedback</h2> <p>Collecting student feedback can help identify which methods increase the effectiveness of online learning, and which ones need improvement. An effective learning environment is a continuous work in progress.</p> ### [Title]: 4 Tips for Teachers Shifting to Teaching Online [Blog article]: <h1>4 Tips for Teachers Shifting to Teaching Online </h1> <p>An educator with experience in distance learning shares what he’s learned: Keep it simple, and build in as much contact as possible.</p> <h2>1. Simplicity Is Key</h2> <p>Every teacher knows what it’s like to explain new instructions to their students. It usually starts with a whole group walk-through, followed by an endless stream of questions from students to clarify next steps.</p> <h2>2. Establish a Digital Home Base</h2> <p>In the spirit of simplicity, it’s vital to have a digital home base for your students. This can be a district-provided learning management system like Canvas or Google Classrooms, or it can be a self-created class website. I recommend Google Sites as a simple, easy-to-set-up platform.</p> <h2>3. Prioritize Longer, Student-Driven Assignments</h2> <p>Efficiency is key when designing distance learning experiences. Planning is going to take more time and require a high level of attention to detail. You will not be able to correct mistakes on the fly or suddenly pivot when kids are disengaged.</p> <h2>4. Individual Touchpoints Are Game-Changers</h2> <p>You can create these touchpoints through any medium you like: emails, video messages, phone calls, messages through your learning management system, comments on shared documents, etc.</p> ### [Title]: 3 Best Free Image Converter Software Programs [Blog article]: <h1>3 Best Free Image Converter Software Programs</h1> <p>Best free image converters for JPG, BMP, PSD, TIF, GIF, RAW, and more</p> <h2>1. XnConvert</h2> <p>XnConvert is the Swiss Army knife of image converters. With XnView, you can convert any of around 500 image formats to your choice of around 80 others. If you have a rare image format that you can't open, XnView can probably convert it.</p> <h2>2. CoolUtils Online Image Converter</h2> <p>The CoolUtils Online Image Converter is just that—an image converter that exists completely online, no download required. Unlike some online image converters, this one does the image converting for you in real-time—no waiting on an email link.</p> <h2>3. FileZigZag</h2> <p>FileZigZag is another online image converter service that will convert most common graphics formats. Just upload the original image, choose the desired output, and then wait for the download link to appear on the page.</p> ### [Title]: 4 Best Tips to Find a Girlfriend [Blog article]: """, min_length=100, max_length=500, length_no_input=True, remove_input=True, end_sequence=, top_p=1, temperature=0.8, top_k=50, repetition_penalty=1, length_penalty=1, do_sample=True, early_stopping=False, num_beams=1, no_repeat_ngram_size=0, num_return_sequences=1, bad_words=None, remove_end_sequence=True )