{"id":269052,"date":"2021-06-08T14:43:25","date_gmt":"2021-06-08T11:43:25","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-build-your-own-meme-generator-with-machine-learning\/"},"modified":"2021-06-08T14:43:25","modified_gmt":"2021-06-08T11:43:25","slug":"how-to-build-your-own-meme-generator-with-machine-learning","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-build-your-own-meme-generator-with-machine-learning\/","title":{"rendered":"#How to build your own meme generator with machine learning"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a290619e6c6d\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a290619e6c6d\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-build-your-own-meme-generator-with-machine-learning\/#Generating_captions\" >Generating captions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-build-your-own-meme-generator-with-machine-learning\/#GPT-3_Da_Vinci\" >GPT-3 Da Vinci<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-build-your-own-meme-generator-with-machine-learning\/#GPT-Neo\" >GPT-Neo<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-build-your-own-meme-generator-with-machine-learning\/#Typesetting_memes\" >Typesetting memes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-build-your-own-meme-generator-with-machine-learning\/#Discussion\" >Discussion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-build-your-own-meme-generator-with-machine-learning\/#Next_steps\" >Next steps<\/a><\/li><\/ul><\/nav><\/div>\n<p>&#8220;<strong>#How to build your own meme generator with machine learning<\/strong>&#8221;<\/p>\n<div tabindex=\"0\" role=\"button\">\n<h2 id=\"8806\" class=\"ld le gl bf lf lg lh ke li lj lk kh ll lm ln lo lp lq lr ls lt lu lv lw lx ly hi\"><span class=\"ez-toc-section\" id=\"Generating_captions\"><\/span><strong>Generating captions<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p id=\"ef73\" class=\"ka kb gl kc b hk lz ke kf hn ma kh ki kj mb kl km kn mc kp kq kr md kt ku kv ge hi\" data-selectable-paragraph=\"\">I use two different implementations of GPT to generate the captions. There\u2019s the latest GPT-3 Da Vinci model from OpenAI that does an excellent job, but you have to be enrolled in their beta program to use it. And there\u2019s the open-source GPT-Neo model from EleutherAI. The model is a lot smaller, but it\u2019s free to use.<\/p>\n<h2 id=\"91d4\" class=\"nc le gl bf lf nd ne hm li nf ng hp ll hq nh hs lp ht ni hv lt hw nj hy lx nk hi\" data-selectable-paragraph=\"\"><span class=\"ez-toc-section\" id=\"GPT-3_Da_Vinci\"><\/span><strong>GPT-3 Da Vinci<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p id=\"8334\" class=\"ka kb gl kc b hk lz ke kf hn ma kh ki kj mb kl km kn mc kp kq kr md kt ku kv ge hi\" data-selectable-paragraph=\"\">OpenAI\u2019s GPT-3 Da Vinci is currently the largest AI model for Natural Language Processing. I am using their latest \u201czero-shot\u201d style of prompting with their new Da Vinci Instruct model. Instead of providing examples of what you are asking the model to do, you can just simply ask it what to do directly.<\/p>\n<p id=\"25c6\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">Here is the prompt that creates a caption for the <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>le pie picture.<\/p>\n<blockquote>\n<p data-selectable-paragraph=\"\"><span>Create a funny caption for a new meme about apple pie. The background picture is Simple and easy apple pie served with vanilla ice cream, on a gingham tablecloth in Lysekil, Sweden.<\/span><\/p>\n<\/blockquote>\n<p data-selectable-paragraph=\"\"><span>I pass the prompt into the call to OpenAI along with some additional parameters. Here\u2019s the Python code.<\/span><\/p>\n<blockquote>\n<p data-selectable-paragraph=\"\"><span>import openai<\/span><br \/><span>response = openai.Completion.create(<\/span><br \/><span> engine=\u201ddavinci-instruct-beta\u201d,<\/span><br \/><span> prompt=prompt,<\/span><br \/><span> max_tokens=64,<\/span><br \/><span> temperature=0.7,<\/span><br \/><span> top_p=0.5,<\/span><br \/><span> frequency_penalty=0.5,<\/span><br \/><span> presence_penalty=0.5,<\/span><br \/><span> best_of=1)<\/span><\/p>\n<\/blockquote>\n<p id=\"8520\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">The\u00a0<em class=\"mf\">max_token\u00a0<\/em>parameter indicates how long the response should be. The\u00a0<em class=\"mf\">temperature\u00a0<\/em>and\u00a0<em class=\"mf\">top_p\u00a0<\/em>parameters are similar in that they indicate the amount of variety in the response. The\u00a0<em class=\"mf\">frequency_penalty\u00a0<\/em>and\u00a0<em class=\"mf\">presence_penalty\u00a0<\/em>are also similar in that they control how often there are new deviations and new topics in the response. If you want to know what all these parameters do, check out my article from last month,\u00a0<a rel=\"nofollow noopener\" target=\"_blank\" class=\"ed kw\" href=\"https:\/\/towardsdatascience.com\/voxmorphia-using-ai-for-style-transfer-of-song-lyrics-fe22d52128dd\">here<\/a>.<\/p>\n<p id=\"15f7\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">Before I show examples of the output from GPT-3, here is the legal disclaimer that OpenAI suggests that I show, which is all true.<\/p>\n<p id=\"f3f6\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\"><em class=\"mf\">The author generated the following text in part with GPT-3, OpenAI\u2019s large-scale language-generation model. Upon generating draft language, the author reviewed and revised the language to their own liking and takes ultimate responsibility for the content of this publication.<\/em><\/p>\n<p id=\"dbf7\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">Running the code 10 times will yield the following results, at a total cost of $0.03. Note that I formatted the text to be in uppercase.<\/p>\n<blockquote>\n<p data-selectable-paragraph=\"\"><span> 1: THIS IS THE PERFECT WAY TO END A DAY OF APPLE PICKING<\/span><br \/><span> 2: NO, IT\u2019S NOT THAT EASY<\/span><br \/><span> 3: I\u2019LL TAKE THE ONE WITH THE VANILLA ICE CREAM, PLEASE<\/span><br \/><span> 4: APPLE PIE IS THE BEST!<\/span><br \/><span> 5: THIS APPLE PIE IS SO GOOD, I CAN\u2019T EVEN!<\/span><br \/><span> 6: YOU\u2019RE NOT THE ONLY ONE WHO LOVES APPLE PIE<\/span><br \/><span> 7: IF YOU CAN\u2019T FIND THE RECIPE, JUST GOOGLE IT<\/span><br \/><span> 8: THE PIE IS GOOD, BUT IT\u2019S NOT AS GOOD AS MY MOM\u2019S<\/span><br \/><span> 9: I\u2019LL HAVE A SLICE OF THAT APPLE PIE, PLEASE<\/span><br \/><span>10: WE\u2019RE GOING TO NEED A BIGGER PIE<\/span><\/p>\n<\/blockquote>\n<p id=\"c2e6\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">OK, these are pretty good. One thing I learned is that\u00a0<strong class=\"kc gm\">GTP-3 Da Vinci can be funny!\u00a0<\/strong>For example, caption number 2 seems to refer to the \u201ceasy as pie\u201d idiom.<\/p>\n<p id=\"cb9f\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">Note that GPT-3, like all AI models trained on a large corpus of text, will reflect societal biases. Occasionally the system will produce text that may be inappropriate or offensive. OpenAI has a feature to label generated text with one of three warning levels: 0 \u2013 the text is safe, 1 \u2013 this text is sensitive, or 2 \u2013 this text is unsafe. My code will show a warning for any of the generated captions that are flagged as sensitive or unsafe.<\/p>\n<h2 id=\"5b43\" class=\"nc le gl bf lf nd ne hm li nf ng hp ll hq nh hs lp ht ni hv lt hw nj hy lx nk hi\" data-selectable-paragraph=\"\"><span class=\"ez-toc-section\" id=\"GPT-Neo\"><\/span>GPT-Neo<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p id=\"8d1f\" class=\"ka kb gl kc b hk lz ke kf hn ma kh ki kj mb kl km kn mc kp kq kr md kt ku kv ge hi\" data-selectable-paragraph=\"\">GPT-Neo is a transformer model created primarily by developers known as sdtblck and leogao2 on GitHub. The <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.eleuther.ai\/projects\/gpt-neo\/\">project<\/a> is an implementation of \u201cGPT-2 and GPT-3-style models using the mesh-tensorflow library.\u201d So far, their system is the size of OpenAI\u2019s GPT-3 Ada, their smallest model. But GPT-Neo is available for free. I used the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/huggingface\/transformers\">Huggingface Transformers<\/a>\u00a0interface to access GPT-Neo from my Python code.<\/p>\n<p id=\"1056\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">Since GPT-Neo doesn\u2019t have \u201cinstruct\u201d versions of their pre-trained models, I had to write a \u201cfew-shot\u201d prompt in order to get the system to generate captions for memes using examples. Here\u2019s the prompt I wrote using Disaster Girl and Grumpy Cat memes with example captions.<\/p>\n<blockquote>\n<p class=\"ky kz la lb lc nm nn no\"><span id=\"bb2d\" class=\"hi nc le gl np b dn nq nr s ns\" data-selectable-paragraph=\"\">Create a funny caption for a meme.\u00a0<\/span><\/p>\n<p class=\"ky kz la lb lc nm nn no\"><span id=\"264e\" class=\"hi nc le gl np b dn nt nu nv nw nx nr s ns\" data-selectable-paragraph=\"\">Theme: disaster girl<br \/><\/span><span id=\"264e\" class=\"hi nc le gl np b dn nt nu nv nw nx nr s ns\" data-selectable-paragraph=\"\">Image description: A picture of a girl looking at us as her house burns down<br \/><\/span><span id=\"264e\" class=\"hi nc le gl np b dn nt nu nv nw nx nr s ns\" data-selectable-paragraph=\"\">Caption: There was a spider. It\u2019s gone now.<\/span><\/p>\n<p class=\"ky kz la lb lc nm nn no\"><span id=\"91d0\" class=\"hi nc le gl np b dn nt nu nv nw nx nr s ns\" data-selectable-paragraph=\"\">Theme: grumpy cat<br \/>Image description: A face of a cat who looks unhappy<br \/><\/span><span id=\"91d0\" class=\"hi nc le gl np b dn nt nu nv nw nx nr s ns\" data-selectable-paragraph=\"\">Caption: I don\u2019t like Mondays.<\/span><\/p>\n<p class=\"ky kz la lb lc nm nn no\"><span id=\"34e3\" class=\"hi nc le gl np b dn nt nu nv nw nx nr s ns\" data-selectable-paragraph=\"\">Theme: apple pie.<br \/><\/span><span id=\"34e3\" class=\"hi nc le gl np b dn nt nu nv nw nx nr s ns\" data-selectable-paragraph=\"\">Image description: Simple and easy apple pie served with vanilla ice cream, on a gingham tablecloth in Lysekil, Sweden.<br \/>Caption:<\/span><\/p>\n<\/blockquote>\n<p class=\"ky kz la lb lc nm nn no\"><span>After setting the temperature parameter to 0.7 and the top_p to 1.0, I pass the prompt into GPT-Neo to generate new captions. Here\u2019s the code to generate a caption.<\/span><\/p>\n<blockquote><p><span>from transformers import pipeline, AutoTokenizer<\/span><br \/><span>generator = pipeline(\u2018text-generation\u2019,<\/span><br \/><span> device=0,<\/span><br \/><span> model=\u2019EleutherAI\/gpt-neo-2.7B\u2019)<\/span><br \/><span>results = generator(prompt,<\/span><br \/><span> do_sample=True,<\/span><br \/><span> min_length=50,<\/span><br \/><span> max_length=150,<\/span><br \/><span> temperature=0.7,<\/span><br \/><span> top_p=1.0,<\/span><br \/><span> pad_token_id=gpt_neo_tokenizer.eos_token_id)<\/span><\/p>\n<\/blockquote>\n<p><span>Here are the sample results.<\/span><\/p>\n<blockquote>\n<p><span> 1: I LOVE APPLE PIE<\/span><br \/><span> 2: I CAN\u2019T. I\u2019M NOT ALLOWED<\/span><br \/><span> 3: I LOVE THE SIMPLICITY OF AN APPLE PIE<\/span><br \/><span> 4: APPLE PIE. THE ONLY THING BETTER THAN THIS IS A HOT BATH<\/span><br \/><span> 5: I\u2019M A PIE. YOU\u2019RE A PIE<\/span><br \/><span> 6: I LOVE PIE, AND THIS IS A GOOD ONE<\/span><br \/><span> 7: I LOVE APPLES, BUT I\u2019M NOT VERY GOOD AT BAKING<\/span><br \/><span> 8: THE PIE IS DELICIOUS, BUT THE ICE CREAM IS NOT<\/span><br \/><span> 9: I LOVE APPLE PIE. IT\u2019S THE BEST<\/span><br \/><span>10: THE BEST FOOD IS WHEN YOU CAN TASTE THE DIFFERENCE BETWEEN THE FOOD AND THE TABLECLOTH<\/span><\/p>\n<\/blockquote>\n<p id=\"26c1\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">Hmmm. These are not as good as the GPT-3 captions. Most of them are quite simple and not very funny. Number 10 is just plain absurd. But number 4 seems to be OK. Let\u2019s use this as our caption.<\/p>\n<p id=\"eb65\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">The final step is to compose the meme by writing the caption into the background image.<\/p>\n<figure class=\"post-image post-mediaBleed aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1355975 js-lazy\" alt=\"Meme by AI-Memer\" width=\"512\" height=\"384\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter.png\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter.png 512w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter-280x210.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter-360x270.png 360w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter-180x135.png 180w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter-368x276.png 368w\"\/><figcaption><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/thenextweb.com\/news\/#\" data-url=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Feditorial.thenextweb.com%2Fneural%2F2021%2F06%2F08%2Fhow-to-build-your-own-meme-generator-with-machine-learning%2F&amp;via=thenextweb&amp;related=thenextweb&amp;text=Check out this picture on: Meme by AI-Memer, Image by John Nuttall, Caption by OpenAI GPT-3, License: CC BY-SA 4.0\" data-title=\"Share Meme by AI-Memer, Image by John Nuttall, Caption by OpenAI GPT-3, License: CC BY-SA 4.0 on Twitter\" data-width=\"685\" data-height=\"500\" class=\"post-image-share popitup\" title=\"Share Meme by AI-Memer, Image by John Nuttall, Caption by OpenAI GPT-3, License: CC BY-SA 4.0 on Twitter\"><i class=\"icon icon--inline icon--twitter--dark\"\/><\/a>Meme by AI-Memer, Image by John Nuttall, Caption by OpenAI GPT-3, License: CC BY-SA 4.0<\/figcaption><noscript><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1355975\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter.png\" alt=\"Meme by AI-Memer\" width=\"512\" height=\"384\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter.png 512w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter-280x210.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter-360x270.png 360w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter-180x135.png 180w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/typewriter-368x276.png 368w\"\/><\/noscript><\/figure>\n<h2 id=\"8b62\" class=\"ld le gl bf lf lg lh ke li lj lk kh ll lm ln lo lp lq lr ls lt lu lv lw lx ly hi\"><span class=\"ez-toc-section\" id=\"Typesetting_memes\"><\/span>Typesetting memes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p id=\"9e51\" class=\"ka kb gl kc b hk lz ke kf hn ma kh ki kj mb kl km kn mc kp kq kr md kt ku kv ge hi\" data-selectable-paragraph=\"\">Adding the captions to memes is fairly straightforward. Most memes are composed using the Impact font <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.laurenceking.com\/product\/the-visual-history-of-type\/\">designed by Geoffrey Lee<\/a> in 1965. For AI-Memer, I used some code <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/blog.lipsumarium.com\/caption-memes-in-python\">by Emmanuel Pire<\/a> for positioning and rendering the caption into the background image. I give the user the option to adjust the size of the font and place the caption at the top or bottom of the image.<\/p>\n<p id=\"0af8\" class=\"ka kb gl kc b hk kd ke kf hn kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv ge hi\" data-selectable-paragraph=\"\">Here are our two memes. The caption on the left was generated by GPT-3 and the one on the right was generated by GPT-Neo.<\/p>\n<h2 id=\"0c32\" class=\"ld le gl bf lf lg lh ke li lj lk kh ll lm ln lo lp lq lr ls lt lu lv lw lx ly hi\"><span class=\"ez-toc-section\" id=\"Discussion\"><\/span>Discussion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p id=\"b2b1\" class=\"ka kb gl kc b hk lz ke kf hn ma kh ki kj mb kl km kn mc kp kq kr md kt ku kv ge hi\" data-selectable-paragraph=\"\">With this project, I learned that large-scale language-generation models can create good captions for memes given a description of the image. Although many of the generated captions are straightforward, occasionally they can be very clever and funny. The GPT-3 Da Vinci model, in particular, seems to create clever memes frequently, demonstrating both a command of the language with a seemingly deep understanding of cultural history.<\/p>\n<h2 class=\"ka kb gl kc b hk lz ke kf hn ma kh ki kj mb kl km kn mc kp kq kr md kt ku kv ge hi\"><span class=\"ez-toc-section\" id=\"Next_steps\"><\/span>Next steps<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p class=\"ka kb gl kc b hk lz ke kf hn ma kh ki kj mb kl km kn mc kp kq kr md kt ku kv ge hi\" data-selectable-paragraph=\"\">Although the results are pretty good, there is definitely room for improvement. For example, the choices for background images seem somewhat limited, especially for pop culture. This may be due to the fact that I am restricting the search to use only freely licensed photos. I don\u2019t know if a US court has weighed in yet on whether or not the background images in memes can be deemed to be fair use or not, so I\u2019ll leave that question to the lawyers.<\/p>\n<p class=\"ka kb gl kc b hk lz ke kf hn ma kh ki kj mb kl km kn mc kp kq kr md kt ku kv ge hi\" data-selectable-paragraph=\"\">The developers behind GPT-Neo at EleutherAI are continuing to build and train bigger language models. Their next model is called <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.eleuther.ai\/projects\/gpt-neox\">GPT-NeoX<\/a>. They say their \u201cprimary goal is to train an equivalent model to the full-sized GPT\u2060-\u20603 and make it available to the public under an open license.\u201d<\/p>\n<figure class=\"ky kz la lb lc jd fr fs paragraph-image\">\n<div class=\"fr fs kx\">\n<div class=\"ml s at mm\">\n<div class=\"ny mo s\">\n<div class=\"ew mg el ez ev mh v mi mj mk\">\n<figure class=\"ky kz la lb lc jd fr fs paragraph-image\">\n<div class=\"fr fs kx\">\n<div class=\"ml s at mm\">\n<div class=\"oc mo s\">\n<figure class=\"post-image post-mediaBleed aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"qr ws el ez ev mh v c js-lazy\" role=\"presentation\" sizes=\"auto, 512px\" alt=\"\" width=\"512\" height=\"370\" src=\"https:\/\/miro.medium.com\/max\/512\/1*dMArjtTP6xYdWuI6bNZliA.png\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*dMArjtTP6xYdWuI6bNZliA.png 276w, https:\/\/miro.medium.com\/max\/512\/1*dMArjtTP6xYdWuI6bNZliA.png 512w\"\/><figcaption><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/thenextweb.com\/news\/#\" data-url=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Feditorial.thenextweb.com%2Fneural%2F2021%2F06%2F08%2Fhow-to-build-your-own-meme-generator-with-machine-learning%2F&amp;via=thenextweb&amp;related=thenextweb&amp;text=Check out this picture on: Meme by AI-Memer, Image by N\/A, Caption by OpenAI GPT-3, License: CC BY-SA 4.0\" data-title=\"Share Meme by AI-Memer, Image by N\/A, Caption by OpenAI GPT-3, License: CC BY-SA 4.0 on Twitter\" data-width=\"685\" data-height=\"500\" class=\"post-image-share popitup\" title=\"Share Meme by AI-Memer, Image by N\/A, Caption by OpenAI GPT-3, License: CC BY-SA 4.0 on Twitter\"><i class=\"icon icon--inline icon--twitter--dark\"\/><\/a>Meme by AI-Memer, Image by N\/A, Caption by OpenAI GPT-3, License: CC BY-SA 4.0<\/figcaption><noscript><img loading=\"lazy\" decoding=\"async\" class=\"qr ws el ez ev mh v c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/512\/1*dMArjtTP6xYdWuI6bNZliA.png\" alt=\"\" width=\"512\" height=\"370\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*dMArjtTP6xYdWuI6bNZliA.png 276w, https:\/\/miro.medium.com\/max\/512\/1*dMArjtTP6xYdWuI6bNZliA.png 512w\"\/><\/noscript><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<\/div>\n<p><script async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong>\n<\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/thenextweb.com\/news\/how-to-build-your-own-meme-generator-with-machine-learning\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to build your own meme generator with machine learning&#8221; Generating captions I use two different implementations of GPT to generate the captions. There\u2019s the latest GPT-3 Da Vinci model from OpenAI that does an excellent job, but you have to be enrolled in their beta program to use it. And there\u2019s the open-source GPT-Neo&#8230;<\/p>\n","protected":false},"author":1,"featured_media":269053,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/img-cdn.tnwcdn.com\/image\/neural?filter_last=1&fit=1280,640&url=https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2021\/06\/AI-Memer_-very-angry-troll_1_1.jpg&signature=7b440faa7e76bf127d2491d4b61a975b","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-269052","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/269052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=269052"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/269052\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/269053"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=269052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=269052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=269052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}