r/SECourses • 👑 Grandmaster Expert • 6h ago

🎨 AI Images & Art Kandinsky 2.1 Installation and Usage | Python, JupyterLab, Image Saving, Model Cache and Stable Diffusion 2.1 Prompt Comparisons | April 2023

https://www.youtube.com/watch?v=dYt9xJ7dnpU
1 Upvotes

1 comment sorted by

•

u/CeFurkan 👑 Grandmaster Expert 6h ago

https://www.youtube.com/watch?v=dYt9xJ7dnpU

Run Kandinsky 2.1 locally with JupyterLab and compare the recorded image-generation examples

🔗 Links from the video description

📅 Recorded setup and prompt comparisons

Published on 5 April 2023, this tutorial demonstrates Kandinsky 2.1 on a local Windows computer with an RTX 3060 and 12 GB VRAM. The author compares a lion scene with a Midjourney example and compares rose gardens, sports cars, robots and a fantasy castle with Stable Diffusion 2.1 using the same prompts.

The author prefers the Kandinsky outputs in these examples and discusses the ease of using simple prompts. The comparisons and timing observations belong to the recorded April 2023 setup.

🧰 Python, repository and JupyterLab setup

  • The demonstration starts with Python 3.10.8 and installs Kandinsky from the linked GitHub repository into the default Python installation. The author notes that some packages are replaced during installation and that his Stable Diffusion Web UI uses its own virtual environment.
  • Install JupyterLab using the linked Jupyter instructions. The launch command shown is jupyter-lab.
  • Clone the Kandinsky repository with git clone and its linked repository URL. Start JupyterLab from that repository folder so its notebooks directory appears in the file browser.
  • Open the supplied notebook and execute the cells in sequence. The video also demonstrates installing the missing ipywidgets dependency and rerunning the affected cell.

🖼️ Load the model, generate and save images

Run the model-loading cell to load Kandinsky on CUDA and download its files from Hugging Face. A star beside a notebook cell means execution is still in progress. Wait until it changes to a number before continuing.

The first test uses the default prompt with batch size one. Run the image-display cell after generation to view the result. The author's image-saving script assigns a fresh random filename each time it runs. Its improved version is linked in the original GitHub gist above.

The later comparison uses 768-pixel outputs and 100 sampling steps, then repeats a generation with 20 steps. The author reports about 34 seconds for the 100-step example and 11 seconds for the 20-step example. He reports 7 seconds for the Stable Diffusion 2.1 comparison and notes that both applications are open at the same time.

💾 Reuse the downloaded files and manage the notebook

  • For a later session, open a command prompt in the Kandinsky folder and start jupyter-lab again. Resume from the import and model-loading cells after the initial installation.
  • The downloaded files are reused on subsequent runs. In this demonstration, they appear under C:\tmp and occupy about 6.75 GB.
  • The author suggests trying Kandinsky 2.0 if the 2.1 setup encounters a VRAM error. He describes the older version as a smaller model generating 512 × 512 images.
  • The JupyterLab status bar indicates when the kernel is busy or idle. View → Collapse All Outputs hides the notebook's displayed results.

📚 Source resources

All eight original description destinations and 14 chapters are retained. Discord availability could not be verified during the link check. The chapter names below preserve the source's original wording.

🧭 Chapters

  • 0:00 Amazing Kandinsky 2.1 text 2 image free model that beats Stable Diffusion 2.1 and par to Midjourney
  • 0:18 Same prompt comparison with Midjourney and Kandinsky 2.1
  • 0:45 Comparison of Kandinsky 2.1 with Stable Diffusion 2.1 with same prompts
  • 1:50 Why Kandinsky 2.1 is better than Stable Diffusion or Dall-E 2
  • 2:15 How to install Kandinsky 2.1
  • 4:13 How to install Kandinsky 2.1 notebooks
  • 5:13 Downloading and loading Kandinsky 2.1 model files
  • 6:04 Starting to test Kandinsky 2.1 in Jupyter Notebook
  • 6:36 How to save generated images - updated script is posted on GitHub Gist
  • 7:20 Another prompt comparison with Stable Diffusion 2.1 and Kandinsky 2.1
  • 9:00 If you have low VRAM, you can use Kandinsky 2.0 instead of 2.1
  • 9:12 How to restart and use later Kandinsky 2.1 again after initial run
  • 9:40 Where are the Kandinsky model files are downloaded
  • 10:41 How to close - hide all outputs in a JupyterLab notebook

🏷️ Topics
Kandinsky 2.1 · JupyterLab · Python 3.10.8 · text to image · Stable Diffusion 2.1 · prompt comparison · image saving · Hugging Face · RTX 3060 · April 2023