Reader small image

You're reading from  Transformers for Natural Language Processing and Computer Vision - Third Edition

Product typeBook
Published inFeb 2024
Reading LevelN/a
PublisherPackt
ISBN-139781805128724
Edition3rd Edition
Languages
Tools
Right arrow
Author (1)
Denis Rothman
Denis Rothman
author image
Denis Rothman

Denis Rothman graduated from Sorbonne University and Paris-Diderot University, designing one of the very first word2matrix patented embedding and patented AI conversational agents. He began his career authoring one of the first AI cognitive Natural Language Processing (NLP) chatbots applied as an automated language teacher for Moet et Chandon and other companies. He authored an AI resource optimizer for IBM and apparel producers. He then authored an Advanced Planning and Scheduling (APS) solution used worldwide.
Read more about Denis Rothman

Right arrow

Part I: Defining text-to-image with Stable Diffusion

We will explore at a very low level the main Python files of the Keras version of Stable Diffusion, as shown in Figure 17.2. The complete code can be found at: https://github.com/keras-team/keras-cv/tree/master/keras_cv/models/stable_diffusion:

A diagram of a flowchart  Description automatically generated

Figure 17.2: Stable Diffusion, Keras implementation

Figure 17.2 shows the Stable Diffusion architecture of the code we will explore that can be summed up in five phases:

  1. Text embedding.
  2. Random image creation.
  3. Stable Diffusion downsampling.
  4. Decoder upsampling.
  5. Output image.

The Keras Stable Diffusion code itself is only 500 lines long!

We will describe each function’s function, make a high-level mathematical representation, and find the Python classes that execute the process.

We will end the analysis by running a Keras notebook illustrating their talented compact code approach.

1. Text embedding using a transformer...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Transformers for Natural Language Processing and Computer Vision - Third Edition
Published in: Feb 2024Publisher: PacktISBN-13: 9781805128724

Author (1)

author image
Denis Rothman

Denis Rothman graduated from Sorbonne University and Paris-Diderot University, designing one of the very first word2matrix patented embedding and patented AI conversational agents. He began his career authoring one of the first AI cognitive Natural Language Processing (NLP) chatbots applied as an automated language teacher for Moet et Chandon and other companies. He authored an AI resource optimizer for IBM and apparel producers. He then authored an Advanced Planning and Scheduling (APS) solution used worldwide.
Read more about Denis Rothman