Stable diffusion became more and more useful in different areas and levels: from professional (as data creation for machine learning) to final user (as creating holiday wishes, cards etc).

I am personally using ‘services’ for both professional and personal request and in most for visual data creation and it very much important for me to give a deep understand what I am using and use it correct and full.

Stable diffusion is sub type of Latent Diffusion model build from tree main modules

Untitled

In the second part let’s discover what is tokenizer


Tokenization called process of text conversation into encoded representation - tokens.

Untitled

There are different types of tokenization: Words, sentenses, phrases, single characters

This techiques is widely used in natural language processing (NLP) and large languges processing (LLP) and for generative stuff creation as well. In stable used transform called CLIP’s Text Encoder. CLIP stands for Contrastive Language–Image Pre-training and it links (unate) image latents and text tokens. The very important building of prompt, that it limited to 77 tokens only (for performence goals meanings). This very much important opening while you writing prompts

If the input prompt has fewer than 77 tokens, <end> tokens are added to the end of the sequence until it reaches 77 tokens. If the input prompt has more than 77 tokens, the first 77 tokens are retained and the rest are truncated

Run pure tokenizer and see what it’s part in image generation:

Google Colab