{"id":45,"date":"2022-06-27T04:46:47","date_gmt":"2022-06-27T04:46:47","guid":{"rendered":"https:\/\/formatswap.com\/blog\/?p=45"},"modified":"2023-05-28T22:14:10","modified_gmt":"2023-05-28T22:14:10","slug":"how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow","status":"publish","type":"post","link":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/","title":{"rendered":"How to Generate Images From Text Prompts with Python and TensorFlow"},"content":{"rendered":"\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"304\" height=\"304\" loading=\"lazy\" data-id=\"49\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31.png\" alt=\"example pic\" class=\"wp-image-49\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31.png 304w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31-300x300.png 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31-150x150.png 150w\" sizes=\"auto, (max-width: 304px) 100vw, 304px\" \/><figcaption class=\"wp-element-caption\">Example #1<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"304\" height=\"304\" loading=\"lazy\" data-id=\"50\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/59.png\" alt=\"example pic\" class=\"wp-image-50\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/59.png 304w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/59-300x300.png 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/59-150x150.png 150w\" sizes=\"auto, (max-width: 304px) 100vw, 304px\" \/><figcaption class=\"wp-element-caption\">Example #2<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"304\" height=\"304\" loading=\"lazy\" data-id=\"51\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/64.png\" alt=\"example pic\" class=\"wp-image-51\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/64.png 304w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/64-300x300.png 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/64-150x150.png 150w\" sizes=\"auto, (max-width: 304px) 100vw, 304px\" \/><figcaption class=\"wp-element-caption\">Example #3<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"304\" height=\"304\" loading=\"lazy\" data-id=\"52\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/70.png\" alt=\"example pic\" class=\"wp-image-52\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/70.png 304w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/70-300x300.png 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/70-150x150.png 150w\" sizes=\"auto, (max-width: 304px) 100vw, 304px\" \/><figcaption class=\"wp-element-caption\">Example #4<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"304\" height=\"304\" loading=\"lazy\" data-id=\"53\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/81-1.png\" alt=\"example pic\" class=\"wp-image-53\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/81-1.png 304w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/81-1-300x300.png 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/81-1-150x150.png 150w\" sizes=\"auto, (max-width: 304px) 100vw, 304px\" \/><figcaption class=\"wp-element-caption\">Example #5<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"336\" height=\"336\" loading=\"lazy\" data-id=\"54\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/a-dream-of-a-forest-1.png\" alt=\"a dream of a forest\" class=\"wp-image-54\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/a-dream-of-a-forest-1.png 336w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/a-dream-of-a-forest-1-300x300.png 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/a-dream-of-a-forest-1-150x150.png 150w\" sizes=\"auto, (max-width: 336px) 100vw, 336px\" \/><figcaption class=\"wp-element-caption\">Example #6<\/figcaption><\/figure>\n<\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>In this tutorial you will learn how to generate images from text prompts using Python, VQGAN, and neural networks. You can create some very interesting machine learning generated artwork using this software. The possibility are limitless when it comes to the different types of images you can generate. This article will be using Ubuntu 22.04 for the operating system. However any Ubuntu based version of Linux should work. Keep in mind you will want to make sure to have a graphics card with at least 6GB of VRAM. If not you will have to generate lower resolution images. If creating machine learning generated artwork sounds interesting to you continue reading this tutorial below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Install Required Dependencies<\/h2>\n\n\n\n<p>The first thing to do is install Anaconda. You can find the latest version and instructions <a href=\"https:\/\/www.anaconda.com\/products\/individual#Downloads\">HERE<\/a>. This tutorial has been tested on Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04, and Ubuntu 22.04.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Create the Conda Environment<\/h2>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>conda create --name vqgan python=3.9\nconda activate vqgan<\/code><\/pre>\n\n\n\n<p>Next you will set up the Conda environment. This is where you will run VQGAN from.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Install Pytorch in the new environment:<\/h2>\n\n\n\n<p>Note: This installs the CUDA version of Pytorch for Nvidia graphics cards. If you are using an AMD graphics card, read our AMD section at the bottom of the article.<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https:\/\/download.pytorch.org\/whl\/torch_stable.html<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Install other required Python packages:<\/h2>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>pip install ftfy regex tqdm omegaconf pytorch-lightning IPython kornia imageio imageio-ffmpeg einops torch_optimizer<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Clone the required VQGAN repositories: <\/h2>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>git clone 'https:\/\/github.com\/nerdyrodent\/VQGAN-CLIP'\ncd VQGAN-CLIP\ngit clone 'https:\/\/github.com\/openai\/CLIP'\ngit clone 'https:\/\/github.com\/CompVis\/taming-transformers'\npip install taming-transformers &amp;&amp; pip install CLIP\npip install setuptools==59.5.0<\/code><\/pre>\n\n\n\n<p>Now you need to clone the git repository&#8217;s. After cloning install taming-transformers and CLIP using pip. Finally install setuptools==59.5.0. This is required as the latest version of setuptools will not work with VQGAN.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Download at least 1 VQGAN pretrained model<\/h2>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>mkdir checkpoints\n\ncurl -L -o checkpoints\/vqgan_imagenet_f16_16384.yaml -C - 'https:\/\/heibox.uni-heidelberg.de\/d\/a7530b09fed84f80a887\/files\/?p=%2Fconfigs%2Fmodel.yaml&amp;dl=1' #ImageNet 16384\ncurl -L -o checkpoints\/vqgan_imagenet_f16_16384.ckpt -C - 'https:\/\/heibox.uni-heidelberg.de\/d\/a7530b09fed84f80a887\/files\/?p=%2Fckpts%2Flast.ckpt&amp;dl=1' #ImageNet 16384<\/code><\/pre>\n\n\n\n<p>Choose at least one of the above pretrained models, and download it using the curl command. I recommend downloading both of the models so that you can try each to see which works best. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Pretrained Model Information<\/h3>\n\n\n\n<p>Visit <a href=\"https:\/\/github.com\/CompVis\/taming-transformers#overview-of-pretrained-models\">https:\/\/github.com\/CompVis\/taming-transformers#overview-of-pretrained-models<\/a> to learn more about VQGAN pre-trained models, including download links. The model .yaml and .ckpt files need to be the <code>checkpoints<\/code> directory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Generating VQGAN image from basic text prompt<\/h2>\n\n\n\n<p>You have now finished installing VQGAN. You are ready to begin generating images. To generate an image from text, specify your text prompt as shown in the example below.<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>python generate.py -p \"A illustration of a pineapple in a fruit bowl\"<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"368\" height=\"368\" loading=\"lazy\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/pineapple-in-fruit-bowl.jpg\" alt=\"pineapple in bowl\" class=\"wp-image-65\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/pineapple-in-fruit-bowl.jpg 368w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/pineapple-in-fruit-bowl-300x300.jpg 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/pineapple-in-fruit-bowl-150x150.jpg 150w\" sizes=\"auto, (max-width: 368px) 100vw, 368px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Generating VQGAN image from multiple prompts <\/h2>\n\n\n\n<p>You are also able to generate images from split text prompts. In the below example you can see I am using four different descriptors to generate the image.<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>python generate.py -p \"A painting of a pineapple in a fruit bowl | psychedelic | surreal:0.5 | weird:0.25\"<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"368\" height=\"368\" loading=\"lazy\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/pineapple-in-fruit-bowl-psyc.jpg\" alt=\"A painting of a pineapple in a fruit bowl\" class=\"wp-image-64\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/pineapple-in-fruit-bowl-psyc.jpg 368w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/pineapple-in-fruit-bowl-psyc-300x300.jpg 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/pineapple-in-fruit-bowl-psyc-150x150.jpg 150w\" sizes=\"auto, (max-width: 368px) 100vw, 368px\" \/><\/figure>\n<\/div>\n\n\n<p>Additionally you can use an input image as one of your split prompt inputs. This will use the supplied image as a sample during the generation process.<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>python generate.py -p \"A picture of a bathroom with a portrait of Van Gogh\" -ip \"samples\/VanGogh.jpg | samples\/Bedroom.png\"<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"368\" height=\"368\" loading=\"lazy\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/A-picture-of-a-bathroom-with-a-portrait-of-Van-Gogh.jpg\" alt=\"A picture of a bathroom with a portrait of Van Gogh\" class=\"wp-image-63\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/A-picture-of-a-bathroom-with-a-portrait-of-Van-Gogh.jpg 368w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/A-picture-of-a-bathroom-with-a-portrait-of-Van-Gogh-300x300.jpg 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/A-picture-of-a-bathroom-with-a-portrait-of-Van-Gogh-150x150.jpg 150w\" sizes=\"auto, (max-width: 368px) 100vw, 368px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Generating VQGAN &#8220;story mode&#8221; images<\/h2>\n\n\n\n<p>Story mode allows you to create a story from multiple text prompts using the carrot symbol. This will generate you a .mp4 video file. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>python generate.py -p \"A painting of a apple|photo:-1 ^ a painting of a banana ^ a painting of a grape ^ a painting of a watermelon ^ a photograph of strawberry\" -cpe 1500 -zvid -i 6000 -zse 10 -vl 20 -zsc 1.005 -opt Adagrad -lr 0.15 -se 6000<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"336\" height=\"336\" loading=\"lazy\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/story-mode.gif\" alt=\"A painting of a apple\" class=\"wp-image-67\"\/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">VQGAN Feedback loop animation&#8217;s<\/h2>\n\n\n\n<p>You are able to generate multiple images into a video. The script makes slight changes to each image creating a warping effect. The &#8220;150&#8221; at the end of the line is the number of frames. &#8220;blackhole.png&#8221; is your output filename. This will produce a .mp4 file named &#8220;video.mp4&#8221; by default. Example below:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>.\/zoom.sh \"A painting of a green firetruck spinning through a black hole\" blackhole.png 150<\/code><\/pre>\n\n\n\n<p>The ImageMagick package is requred to generate mp4 animated loop videos. If you don&#8217;t have it installed, you can install it using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>sudo apt install imagemagick<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"336\" height=\"336\" loading=\"lazy\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/green-firetruck-black-hole.gif\" alt=\"green fire truck spinning in black hole\" class=\"wp-image-75\"\/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Generating multiple random images<\/h2>\n\n\n\n<p>You can also supply multiple phrases to be used at random to generate multiple images. There is a random list of words in the &#8220;.\/zoom.sh&#8221; file. Edit this file if you want to change the words used in the random phrase generator. Here is an example of the random images put into a collage.<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>chmod +x .\/zoom.sh\n.\/zoom.sh<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"1008\" height=\"1008\" loading=\"lazy\" src=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/collage-2.jpg\" alt=\"multiple image example\" class=\"wp-image-77\" srcset=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/collage-2.jpg 1008w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/collage-2-300x300.jpg 300w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/collage-2-150x150.jpg 150w, https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/collage-2-768x768.jpg 768w\" sizes=\"auto, (max-width: 1008px) 100vw, 1008px\" \/><figcaption class=\"wp-element-caption\">Left to right #1-#9<\/figcaption><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>#1 &#8216;A pencil art sketch of a criticizing pickle and a menu in the style of strange colors and Futurism&#8217;<\/li>\n\n\n\n<li>#2 &#8216;A painting of a wild hotel and a flower in the style of Constructionist and Edgar Degas&#8217;<\/li>\n\n\n\n<li>#3 &#8216;A spray painting of a awaiting computer and a bedroom in the style of Edgar Degas and Art Nouveau&#8217;<\/li>\n\n\n\n<li>#4 &#8216;A photograph of a benefiting AR-15 and a pickle in the style of Modern art and Edgar Degas&#8217;<\/li>\n\n\n\n<li>#5 &#8216;A sculpture of a undertaking computer and a figurine in the style of Pop Art and Picasso&#8217;<\/li>\n\n\n\n<li>#6 &#8216;A painting of a tree on a dresser in the style of Surreal Art and Claude Monet&#8217;<\/li>\n\n\n\n<li>#7 &#8216;A pencil art sketch of a touching statue and a AR-15 in the style of Surreal Art and Claude Monet&#8217;<\/li>\n\n\n\n<li>#8 &#8216;A pencil art sketch of a adding table and a fish in the style of Surreal Art and Art Nouveau&#8217;<\/li>\n\n\n\n<li>#9 &#8216;An illustration of a raining lamp and a spanner in the style of Pop Art and Michelangelo Caravaggio&#8217;<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Advanced settings<\/h2>\n\n\n\n<p>There are many advanced flags you can use in the VQGAN program. To view all of the options from the terminal use the -h flag.<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>python generate.py -h<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>usage: generate.py &#91;-h] &#91;-p PROMPTS] &#91;-ip IMAGE_PROMPTS] &#91;-i MAX_ITERATIONS] &#91;-se DISPLAY_FREQ]\n&#91;-s SIZE SIZE] &#91;-ii INIT_IMAGE] &#91;-in INIT_NOISE] &#91;-iw INIT_WEIGHT] &#91;-m CLIP_MODEL]\n&#91;-conf VQGAN_CONFIG] &#91;-ckpt VQGAN_CHECKPOINT] &#91;-nps &#91;NOISE_PROMPT_SEEDS ...]]\n&#91;-npw &#91;NOISE_PROMPT_WEIGHTS ...]] &#91;-lr STEP_SIZE] &#91;-cuts CUTN] &#91;-cutp CUT_POW] &#91;-sd SEED]\n&#91;-opt {Adam,AdamW,Adagrad,Adamax,DiffGrad,AdamP,RAdam,RMSprop}] &#91;-o OUTPUT] &#91;-vid] &#91;-zvid]\n&#91;-zs ZOOM_START] &#91;-zse ZOOM_FREQUENCY] &#91;-zsc ZOOM_SCALE] &#91;-cpe PROMPT_FREQUENCY]\n&#91;-vl VIDEO_LENGTH] &#91;-ofps OUTPUT_VIDEO_FPS] &#91;-ifps INPUT_VIDEO_FPS] &#91;-d]\n&#91;-aug {Ji,Sh,Gn,Pe,Ro,Af,Et,Ts,Cr,Er,Re} &#91;{Ji,Sh,Gn,Pe,Ro,Af,Et,Ts,Cr,Er,Re} ...]]\n&#91;-cd CUDA_DEVICE]<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>optional arguments:\n  -h, --help            show this help message and exit\n  -p PROMPTS, --prompts PROMPTS\n                        Text prompts\n  -ip IMAGE_PROMPTS, --image_prompts IMAGE_PROMPTS\n                        Image prompts \/ target image\n  -i MAX_ITERATIONS, --iterations MAX_ITERATIONS\n                        Number of iterations\n  -se DISPLAY_FREQ, --save_every DISPLAY_FREQ\n                        Save image iterations\n  -s SIZE SIZE, --size SIZE SIZE\n                        Image size (width height) (default: &#91;512, 512])\n  -ii INIT_IMAGE, --init_image INIT_IMAGE\n                        Initial image\n  -in INIT_NOISE, --init_noise INIT_NOISE\n                        Initial noise image (pixels or gradient)\n  -iw INIT_WEIGHT, --init_weight INIT_WEIGHT\n                        Initial weight\n  -m CLIP_MODEL, --clip_model CLIP_MODEL\n                        CLIP model (e.g. ViT-B\/32, ViT-B\/16)\n  -conf VQGAN_CONFIG, --vqgan_config VQGAN_CONFIG\n                        VQGAN config\n  -ckpt VQGAN_CHECKPOINT, --vqgan_checkpoint VQGAN_CHECKPOINT\n                        VQGAN checkpoint\n  -nps &#91;NOISE_PROMPT_SEEDS ...], --noise_prompt_seeds &#91;NOISE_PROMPT_SEEDS ...]\n                        Noise prompt seeds\n  -npw &#91;NOISE_PROMPT_WEIGHTS ...], --noise_prompt_weights &#91;NOISE_PROMPT_WEIGHTS ...]\n                        Noise prompt weights\n  -lr STEP_SIZE, --learning_rate STEP_SIZE\n                        Learning rate\n  -cuts CUTN, --num_cuts CUTN\n                        Number of cuts\n  -cutp CUT_POW, --cut_power CUT_POW\n                        Cut power\n  -sd SEED, --seed SEED\n                        Seed\n  -opt, --optimiser {Adam,AdamW,Adagrad,Adamax,DiffGrad,AdamP,RAdam,RMSprop}\n                        Optimiser\n  -o OUTPUT, --output OUTPUT\n                        Output file\n  -vid, --video         Create video frames?\n  -zvid, --zoom_video   Create zoom video?\n  -zs ZOOM_START, --zoom_start ZOOM_START\n                        Zoom start iteration\n  -zse ZOOM_FREQUENCY, --zoom_save_every ZOOM_FREQUENCY\n                        Save zoom image iterations\n  -zsc ZOOM_SCALE, --zoom_scale ZOOM_SCALE\n                        Zoom scale\n  -cpe PROMPT_FREQUENCY, --change_prompt_every PROMPT_FREQUENCY\n                        Prompt change frequency\n  -vl VIDEO_LENGTH, --video_length VIDEO_LENGTH\n                        Video length in seconds\n  -ofps OUTPUT_VIDEO_FPS, --output_video_fps OUTPUT_VIDEO_FPS\n                        Create an interpolated video (Nvidia GPU only) with this fps (min 10. best set to 30 or 60)\n  -ifps INPUT_VIDEO_FPS, --input_video_fps INPUT_VIDEO_FPS\n                        When creating an interpolated video, use this as the input fps to interpolate from (&gt;0 &amp; &lt;ofps)\n  -d, --deterministic   Enable cudnn.deterministic?\n  -aug, --augments {Ji,Sh,Gn,Pe,Ro,Af,Et,Ts,Cr,Er,Re} &#91;{Ji,Sh,Gn,Pe,Ro,Af,Et,Ts,Cr,Er,Re} ...]\n                        Enabled augments\n  -cd CUDA_DEVICE, --cuda_device CUDA_DEVICE\n                        Cuda device to use<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">AMD GPU Instructions<\/h2>\n\n\n\n<p>If you have an AMD graphics card you are able to use ROCm instead of CUDA. You can check if your card supports TensorFlow here: <a href=\"https:\/\/github.com\/RadeonOpenCompute\/ROCm#supported-gpus\">https:\/\/github.com\/RadeonOpenCompute\/ROCm#supported-gpus<\/a><\/p>\n\n\n\n<p>Install ROCm accordng to the instructions and don&#8217;t forget to add the user to the video group as detailed in the link: <a href=\"https:\/\/docs.amd.com\/bundle\/ROCm-Installation-Guide-v5.1\/page\/How_to_Install_ROCm.html\">https:\/\/docs.amd.com\/bundle\/ROCm-Installation-Guide-v5.1\/page\/How_to_Install_ROCm.html<\/a><\/p>\n\n\n\n<p>The usage and set up instructions above are the same, except for the line where you install Pytorch. Instead of <code>pip install torch==1.9.0+cu111 ...<\/code>, use the one or two lines which are displayed here (select Pip -&gt; Python-&gt; ROCm): <a href=\"https:\/\/pytorch.org\/get-started\/locally\/\">https:\/\/pytorch.org\/get-started\/locally\/<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">RuntimeError: CUDA out of memory<\/h3>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>RuntimeError: CUDA out of memory. Tried to allocate 150.00 MiB (GPU 0; 23.70 GiB total capacity; 21.31 GiB already allocated; 78.56 MiB free; 21.70 GiB reserved in total by PyTorch)<\/code><\/pre>\n\n\n\n<p>Your request doesn&#8217;t fit into your GPU&#8217;s VRAM. Reduce the image size of the image by editing &#8220;generate.py&#8221;.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is the best optimizing agent?<\/h3>\n\n\n\n<p>The Adam agent is usually a good general purpose agent to use. If you would like more information see the <a href=\"https:\/\/github.com\/jettify\/pytorch-optimizer\">Pytorch Optimizer<\/a> and <a href=\"https:\/\/pytorch.org\/docs\/stable\/optim.html\">Optim<\/a> articles.  <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can I download and use all pre-trained models simultaneously?<\/h3>\n\n\n\n<p>Yes, all you need to do is set everything to true in the <strong>download_models.sh<\/strong> file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Errors during video generation<\/h3>\n\n\n\n<p>Try installing ffmpeg:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>sudo apt install ffmpeg<\/code><\/pre>\n\n\n\n<p><br>If you are running VQGAN with Ananconda try:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-cyan-blue-color has-black-background-color has-text-color has-background\"><code>conda install -c conda-forge ffmpeg<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Related resources<\/h2>\n\n\n\n<p>View more image examples on the <a href=\"https:\/\/twitter.com\/weformatswap\" target=\"_blank\" rel=\"noreferrer noopener\">FormatSwap Twitter<\/a>.<\/p>\n\n\n\n<p>Check our our <a href=\"https:\/\/formatswap.com\/blog\/product-guides\/the-best-mechanical-gaming-keyboards-to-purchase-in-2023\/\">The Best Mechanical Gaming Keyboards to Purchase in 2023<\/a> article.<\/p>\n\n\n\n<p>Read our <a href=\"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/deep-learning-image-style-transfer-tutorial-using-neural-style-pt\/\">Deep Learning Image Style Transfer Tutorial Using Neural Style Pt.<\/a><\/p>\n\n\n\n<p>View our other <a href=\"https:\/\/formatswap.com\/blog\/category\/machine-learning-tutorials\/\" target=\"_blank\" rel=\"noreferrer noopener\">Machine Learning Tutorials<\/a>.<\/p>\n\n\n\n<p>Learn <a href=\"https:\/\/formatswap.com\/blog\/windows-tutorials\/how-to-create-a-mapped-network-drive-in-windows-10\/\">How to Create a Mapped Network Drive in Windows 10.<\/a><\/p>\n\n\n\n<p>Click here to learn <a href=\"https:\/\/formatswap.com\/blog\/linux-tutorials\/how-to-install-mysql-on-ubuntu-server-22-04-lts\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Install MySQL on Ubuntu 22.04 LTS<\/a>.<\/p>\n\n\n\n<p>View all of our available online tools at <a href=\"https:\/\/formatswap.com\" target=\"_blank\" rel=\"noreferrer noopener\">Formatswap.com<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Questions<\/h3>\n\n\n\n<p>Feel free to leave a comment below if you have any further questions. Thank you for reading the tutorial.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial you will learn how to generate images from text prompts using Python, VQGAN, and neural networks. You can create some very interesting machine learning generated artwork using this software. The possibility are limitless when it comes to the different types of images you can generate. This article will be using Ubuntu 22.04 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[7],"tags":[9,8,10,11,12,13,14],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-machine-learning-tutorials","tag-deep-learning","tag-linux","tag-machine-learning","tag-python","tag-tensorflow","tag-torch","tag-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Generate Images From Text Prompts with Python and TensorFlow - Format Swap - Tech Tutorials<\/title>\n<meta name=\"description\" content=\"How to Generate Images From Text Prompts with VQGAN-Clip, Python, and TensorFlow. Machine learning \/ deep learning tutorial.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Generate Images From Text Prompts with Python and TensorFlow - Format Swap - Tech Tutorials\" \/>\n<meta property=\"og:description\" content=\"How to Generate Images From Text Prompts with VQGAN-Clip, Python, and TensorFlow. Machine learning \/ deep learning tutorial.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/\" \/>\n<meta property=\"og:site_name\" content=\"Format Swap - Tech Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-27T04:46:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-28T22:14:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/#\\\/schema\\\/person\\\/3d01ee8e1e4f3718cfcc57eeb8ad6188\"},\"headline\":\"How to Generate Images From Text Prompts with Python and TensorFlow\",\"datePublished\":\"2022-06-27T04:46:47+00:00\",\"dateModified\":\"2023-05-28T22:14:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/\"},\"wordCount\":1107,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/31.png\",\"keywords\":[\"deep learning\",\"linux\",\"machine learning\",\"python\",\"tensorflow\",\"torch\",\"tutorial\"],\"articleSection\":[\"Machine Learning Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/\",\"url\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/\",\"name\":\"How to Generate Images From Text Prompts with Python and TensorFlow - Format Swap - Tech Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/31.png\",\"datePublished\":\"2022-06-27T04:46:47+00:00\",\"dateModified\":\"2023-05-28T22:14:10+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/#\\\/schema\\\/person\\\/3d01ee8e1e4f3718cfcc57eeb8ad6188\"},\"description\":\"How to Generate Images From Text Prompts with VQGAN-Clip, Python, and TensorFlow. Machine learning \\\/ deep learning tutorial.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/#primaryimage\",\"url\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/31.png\",\"contentUrl\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/31.png\",\"width\":304,\"height\":304},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/machine-learning-tutorials\\\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Generate Images From Text Prompts with Python and TensorFlow\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/\",\"name\":\"Format Swap - Tech Tutorials\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/#\\\/schema\\\/person\\\/3d01ee8e1e4f3718cfcc57eeb8ad6188\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/55cb3548d8c931eac3f2facbca246c6bde86082f48ca304906d7da2214191b72?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/55cb3548d8c931eac3f2facbca246c6bde86082f48ca304906d7da2214191b72?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/55cb3548d8c931eac3f2facbca246c6bde86082f48ca304906d7da2214191b72?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\\\/\\\/formatswap.com\\\/blog\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCsIPLkRPTbbTaT8YX0Dh2-A\"],\"url\":\"https:\\\/\\\/formatswap.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Generate Images From Text Prompts with Python and TensorFlow - Format Swap - Tech Tutorials","description":"How to Generate Images From Text Prompts with VQGAN-Clip, Python, and TensorFlow. Machine learning \/ deep learning tutorial.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/","og_locale":"en_US","og_type":"article","og_title":"How to Generate Images From Text Prompts with Python and TensorFlow - Format Swap - Tech Tutorials","og_description":"How to Generate Images From Text Prompts with VQGAN-Clip, Python, and TensorFlow. Machine learning \/ deep learning tutorial.","og_url":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/","og_site_name":"Format Swap - Tech Tutorials","article_published_time":"2022-06-27T04:46:47+00:00","article_modified_time":"2023-05-28T22:14:10+00:00","og_image":[{"url":"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31.png","type":"","width":"","height":""}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/#article","isPartOf":{"@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/"},"author":{"name":"admin","@id":"https:\/\/formatswap.com\/blog\/#\/schema\/person\/3d01ee8e1e4f3718cfcc57eeb8ad6188"},"headline":"How to Generate Images From Text Prompts with Python and TensorFlow","datePublished":"2022-06-27T04:46:47+00:00","dateModified":"2023-05-28T22:14:10+00:00","mainEntityOfPage":{"@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/"},"wordCount":1107,"commentCount":0,"image":{"@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/#primaryimage"},"thumbnailUrl":"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31.png","keywords":["deep learning","linux","machine learning","python","tensorflow","torch","tutorial"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/","url":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/","name":"How to Generate Images From Text Prompts with Python and TensorFlow - Format Swap - Tech Tutorials","isPartOf":{"@id":"https:\/\/formatswap.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/#primaryimage"},"image":{"@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/#primaryimage"},"thumbnailUrl":"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31.png","datePublished":"2022-06-27T04:46:47+00:00","dateModified":"2023-05-28T22:14:10+00:00","author":{"@id":"https:\/\/formatswap.com\/blog\/#\/schema\/person\/3d01ee8e1e4f3718cfcc57eeb8ad6188"},"description":"How to Generate Images From Text Prompts with VQGAN-Clip, Python, and TensorFlow. Machine learning \/ deep learning tutorial.","breadcrumb":{"@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/#primaryimage","url":"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31.png","contentUrl":"https:\/\/formatswap.com\/blog\/wp-content\/uploads\/2022\/06\/31.png","width":304,"height":304},{"@type":"BreadcrumbList","@id":"https:\/\/formatswap.com\/blog\/machine-learning-tutorials\/how-to-generate-images-from-text-prompts-with-vqgan-clip-python-and-tensorflow\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/formatswap.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Generate Images From Text Prompts with Python and TensorFlow"}]},{"@type":"WebSite","@id":"https:\/\/formatswap.com\/blog\/#website","url":"https:\/\/formatswap.com\/blog\/","name":"Format Swap - Tech Tutorials","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/formatswap.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/formatswap.com\/blog\/#\/schema\/person\/3d01ee8e1e4f3718cfcc57eeb8ad6188","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/55cb3548d8c931eac3f2facbca246c6bde86082f48ca304906d7da2214191b72?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/55cb3548d8c931eac3f2facbca246c6bde86082f48ca304906d7da2214191b72?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/55cb3548d8c931eac3f2facbca246c6bde86082f48ca304906d7da2214191b72?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/formatswap.com\/blog","https:\/\/www.youtube.com\/channel\/UCsIPLkRPTbbTaT8YX0Dh2-A"],"url":"https:\/\/formatswap.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":4,"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"predecessor-version":[{"id":1284,"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions\/1284"}],"wp:attachment":[{"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/formatswap.com\/blog\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}