CINXE.COM
Generative Deep Learning
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="Keras documentation"> <meta name="author" content="Keras Team"> <link rel="shortcut icon" href="https://keras.io/img/favicon.ico"> <link rel="canonical" href="https://keras.io/examples/generative/" /> <!-- Social --> <meta property="og:title" content="Keras documentation: Generative Deep Learning"> <meta property="og:image" content="https://keras.io/img/logo-k-keras-wb.png"> <meta name="twitter:title" content="Keras documentation: Generative Deep Learning"> <meta name="twitter:image" content="https://keras.io/img/k-keras-social.png"> <meta name="twitter:card" content="summary"> <title>Generative Deep Learning</title> <!-- Bootstrap core CSS --> <link href="/css/bootstrap.min.css" rel="stylesheet"> <!-- Custom fonts for this template --> <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700;800&display=swap" rel="stylesheet"> <!-- Custom styles for this template --> <link href="/css/docs.css" rel="stylesheet"> <link href="/css/monokai.css" rel="stylesheet"> <!-- Google Tag Manager --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-5DNGF4N'); </script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-175165319-128', 'auto'); ga('send', 'pageview'); </script> <!-- End Google Tag Manager --> <script async defer src="https://buttons.github.io/buttons.js"></script> </head> <body> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5DNGF4N" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <div class='k-page'> <div class="k-nav" id="nav-menu"> <a href='/'><img src='/img/logo-small.png' class='logo-small' /></a> <div class="nav flex-column nav-pills" role="tablist" aria-orientation="vertical"> <a class="nav-link" href="/about/" role="tab" aria-selected="">About Keras</a> <a class="nav-link" href="/getting_started/" role="tab" aria-selected="">Getting started</a> <a class="nav-link" href="/guides/" role="tab" aria-selected="">Developer guides</a> <a class="nav-link" href="/api/" role="tab" aria-selected="">Keras 3 API documentation</a> <a class="nav-link" href="/2.18/api/" role="tab" aria-selected="">Keras 2 API documentation</a> <a class="nav-link active" href="/examples/" role="tab" aria-selected="">Code examples</a> <a class="nav-sublink" href="/examples/vision/">Computer Vision</a> <a class="nav-sublink" href="/examples/nlp/">Natural Language Processing</a> <a class="nav-sublink" href="/examples/structured_data/">Structured Data</a> <a class="nav-sublink" href="/examples/timeseries/">Timeseries</a> <a class="nav-sublink active" href="/examples/generative/">Generative Deep Learning</a> <a class="nav-sublink2" href="/examples/generative/ddim/">Denoising Diffusion Implicit Models</a> <a class="nav-sublink2" href="/examples/generative/random_walks_with_stable_diffusion/">A walk through latent space with Stable Diffusion</a> <a class="nav-sublink2" href="/examples/generative/dreambooth/">DreamBooth</a> <a class="nav-sublink2" href="/examples/generative/ddpm/">Denoising Diffusion Probabilistic Models</a> <a class="nav-sublink2" href="/examples/generative/fine_tune_via_textual_inversion/">Teach StableDiffusion new concepts via Textual Inversion</a> <a class="nav-sublink2" href="/examples/generative/finetune_stable_diffusion/">Fine-tuning Stable Diffusion</a> <a class="nav-sublink2" href="/examples/generative/vae/">Variational AutoEncoder</a> <a class="nav-sublink2" href="/examples/generative/dcgan_overriding_train_step/">GAN overriding Model.train_step</a> <a class="nav-sublink2" href="/examples/generative/wgan_gp/">WGAN-GP overriding Model.train_step</a> <a class="nav-sublink2" href="/examples/generative/conditional_gan/">Conditional GAN</a> <a class="nav-sublink2" href="/examples/generative/cyclegan/">CycleGAN</a> <a class="nav-sublink2" href="/examples/generative/gan_ada/">Data-efficient GANs with Adaptive Discriminator Augmentation</a> <a class="nav-sublink2" href="/examples/generative/deep_dream/">Deep Dream</a> <a class="nav-sublink2" href="/examples/generative/gaugan/">GauGAN for conditional image generation</a> <a class="nav-sublink2" href="/examples/generative/pixelcnn/">PixelCNN</a> <a class="nav-sublink2" href="/examples/generative/stylegan/">Face image generation with StyleGAN</a> <a class="nav-sublink2" href="/examples/generative/vq_vae/">Vector-Quantized Variational Autoencoders</a> <a class="nav-sublink2" href="/examples/generative/neural_style_transfer/">Neural style transfer</a> <a class="nav-sublink2" href="/examples/generative/adain/">Neural Style Transfer with AdaIN</a> <a class="nav-sublink2" href="/examples/generative/gpt2_text_generation_with_keras_hub/">GPT2 Text Generation with KerasHub</a> <a class="nav-sublink2" href="/examples/generative/text_generation_gpt/">GPT text generation from scratch with KerasHub</a> <a class="nav-sublink2" href="/examples/generative/text_generation_with_miniature_gpt/">Text generation with a miniature GPT</a> <a class="nav-sublink2" href="/examples/generative/lstm_character_level_text_generation/">Character-level text generation with LSTM</a> <a class="nav-sublink2" href="/examples/generative/text_generation_fnet/">Text Generation using FNet</a> <a class="nav-sublink2" href="/examples/generative/molecule_generation/">Drug Molecule Generation with VAE</a> <a class="nav-sublink2" href="/examples/generative/wgan-graphs/">WGAN-GP with R-GCN for the generation of small molecular graphs</a> <a class="nav-sublink2" href="/examples/generative/random_walks_with_stable_diffusion_3/">A walk through latent space with Stable Diffusion 3</a> <a class="nav-sublink2" href="/examples/generative/real_nvp/">Density estimation using Real NVP</a> <a class="nav-sublink" href="/examples/audio/">Audio Data</a> <a class="nav-sublink" href="/examples/rl/">Reinforcement Learning</a> <a class="nav-sublink" href="/examples/graph/">Graph Data</a> <a class="nav-sublink" href="/examples/keras_recipes/">Quick Keras Recipes</a> <a class="nav-link" href="/keras_tuner/" role="tab" aria-selected="">KerasTuner: Hyperparameter Tuning</a> <a class="nav-link" href="/keras_hub/" role="tab" aria-selected="">KerasHub: Pretrained Models</a> <a class="nav-link" href="/keras_cv/" role="tab" aria-selected="">KerasCV: Computer Vision Workflows</a> <a class="nav-link" href="/keras_nlp/" role="tab" aria-selected="">KerasNLP: Natural Language Workflows</a> </div> </div> <div class='k-main'> <div class='k-main-top'> <script> function displayDropdownMenu() { e = document.getElementById("nav-menu"); if (e.style.display == "block") { e.style.display = "none"; } else { e.style.display = "block"; document.getElementById("dropdown-nav").style.display = "block"; } } function resetMobileUI() { if (window.innerWidth <= 840) { document.getElementById("nav-menu").style.display = "none"; document.getElementById("dropdown-nav").style.display = "block"; } else { document.getElementById("nav-menu").style.display = "block"; document.getElementById("dropdown-nav").style.display = "none"; } var navmenu = document.getElementById("nav-menu"); var menuheight = navmenu.clientHeight; var kmain = document.getElementById("k-main-id"); kmain.style.minHeight = (menuheight + 100) + 'px'; } window.onresize = resetMobileUI; window.addEventListener("load", (event) => { resetMobileUI() }); </script> <div id='dropdown-nav' onclick="displayDropdownMenu();"> <svg viewBox="-20 -20 120 120" width="60" height="60"> <rect width="100" height="20"></rect> <rect y="30" width="100" height="20"></rect> <rect y="60" width="100" height="20"></rect> </svg> </div> <form class="bd-search d-flex align-items-center k-search-form" id="search-form"> <input type="search" class="k-search-input" id="search-input" placeholder="Search Keras documentation..." aria-label="Search Keras documentation..." autocomplete="off"> <button class="k-search-btn"> <svg width="13" height="13" viewBox="0 0 13 13"><title>search</title><path d="m4.8495 7.8226c0.82666 0 1.5262-0.29146 2.0985-0.87438 0.57232-0.58292 0.86378-1.2877 0.87438-2.1144 0.010599-0.82666-0.28086-1.5262-0.87438-2.0985-0.59352-0.57232-1.293-0.86378-2.0985-0.87438-0.8055-0.010599-1.5103 0.28086-2.1144 0.87438-0.60414 0.59352-0.8956 1.293-0.87438 2.0985 0.021197 0.8055 0.31266 1.5103 0.87438 2.1144 0.56172 0.60414 1.2665 0.8956 2.1144 0.87438zm4.4695 0.2115 3.681 3.6819-1.259 1.284-3.6817-3.7 0.0019784-0.69479-0.090043-0.098846c-0.87973 0.76087-1.92 1.1413-3.1207 1.1413-1.3553 0-2.5025-0.46363-3.4417-1.3909s-1.4088-2.0686-1.4088-3.4239c0-1.3553 0.4696-2.4966 1.4088-3.4239 0.9392-0.92727 2.0864-1.3969 3.4417-1.4088 1.3553-0.011889 2.4906 0.45771 3.406 1.4088 0.9154 0.95107 1.379 2.0924 1.3909 3.4239 0 1.2126-0.38043 2.2588-1.1413 3.1385l0.098834 0.090049z"></path></svg> </button> </form> <script> var form = document.getElementById('search-form'); form.onsubmit = function(e) { e.preventDefault(); var query = document.getElementById('search-input').value; window.location.href = '/search.html?query=' + query; return False } </script> </div> <div class='k-main-inner' id='k-main-id'> <div class='k-location-slug'> <span class="k-location-slug-pointer">►</span> <a href='/examples/'>Code examples</a> / Generative Deep Learning </div> <div class='k-content'> <h2><a href="/examples/generative/">Generative Deep Learning</a></h2> <h3 class="example-subcategory-title">Image generation</h3> <a href="/examples/generative/ddim"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Denoising Diffusion Implicit Models </div> </div> </a> <a href="/examples/generative/random_walks_with_stable_diffusion"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> A walk through latent space with Stable Diffusion </div> </div> </a> <a href="/examples/generative/dreambooth"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> DreamBooth </div> </div> </a> <a href="/examples/generative/ddpm"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Denoising Diffusion Probabilistic Models </div> </div> </a> <a href="/examples/generative/fine_tune_via_textual_inversion"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Teach StableDiffusion new concepts via Textual Inversion </div> </div> </a> <a href="/examples/generative/finetune_stable_diffusion"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Fine-tuning Stable Diffusion </div> </div> </a> <a href="/examples/generative/vae"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Variational AutoEncoder </div> </div> </a> <a href="/examples/generative/dcgan_overriding_train_step"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> GAN overriding Model.train_step </div> </div> </a> <a href="/examples/generative/wgan_gp"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> WGAN-GP overriding Model.train_step </div> </div> </a> <a href="/examples/generative/conditional_gan"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Conditional GAN </div> </div> </a> <a href="/examples/generative/cyclegan"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> CycleGAN </div> </div> </a> <a href="/examples/generative/gan_ada"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Data-efficient GANs with Adaptive Discriminator Augmentation </div> </div> </a> <a href="/examples/generative/deep_dream"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Deep Dream </div> </div> </a> <a href="/examples/generative/gaugan"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> GauGAN for conditional image generation </div> </div> </a> <a href="/examples/generative/pixelcnn"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> PixelCNN </div> </div> </a> <a href="/examples/generative/stylegan"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Face image generation with StyleGAN </div> </div> </a> <a href="/examples/generative/vq_vae"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Vector-Quantized Variational Autoencoders </div> </div> </a> <h3 class="example-subcategory-title">Style transfer</h3> <a href="/examples/generative/neural_style_transfer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Neural style transfer </div> </div> </a> <a href="/examples/generative/adain"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Neural Style Transfer with AdaIN </div> </div> </a> <h3 class="example-subcategory-title">Text generation</h3> <a href="/examples/generative/gpt2_text_generation_with_keras_hub"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> GPT2 Text Generation with KerasHub </div> </div> </a> <a href="/examples/generative/text_generation_gpt"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> GPT text generation from scratch with KerasHub </div> </div> </a> <a href="/examples/generative/text_generation_with_miniature_gpt"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Text generation with a miniature GPT </div> </div> </a> <a href="/examples/generative/lstm_character_level_text_generation"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Character-level text generation with LSTM </div> </div> </a> <a href="/examples/generative/text_generation_fnet"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Text Generation using FNet </div> </div> </a> <h3 class="example-subcategory-title">Graph generation</h3> <a href="/examples/generative/molecule_generation"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Drug Molecule Generation with VAE </div> </div> </a> <a href="/examples/generative/wgan-graphs"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> WGAN-GP with R-GCN for the generation of small molecular graphs </div> </div> </a> <h3 class="example-subcategory-title">Other</h3> <a href="/examples/generative/random_walks_with_stable_diffusion_3"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> A walk through latent space with Stable Diffusion 3 </div> </div> </a> <a href="/examples/generative/real_nvp"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Density estimation using Real NVP </div> </div> </a> <hr> </div> </div> </div> </div> </body> <footer style="float: left; width: 100%; padding: 1em; border-top: solid 1px #bbb;"> <a href="https://policies.google.com/terms">Terms</a> | <a href="https://policies.google.com/privacy">Privacy</a> </footer> </html>