Skip to content

Commit

Permalink
Merge pull request #162 from seruva19/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
seruva19 authored Dec 10, 2023
2 parents f18d753 + 89dc4a9 commit ab5d26d
Show file tree
Hide file tree
Showing 50 changed files with 3,442 additions and 98 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vscode
.idea
.local
/venv
**/__pycache__
**/.installed
Expand Down
89 changes: 19 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@

# Kubin: Web-GUI for [Kandinsky 2.x](https://github.com/ai-forever/Kandinsky-2/)
# Kubin

## Description

Web-GUI for Kandinsky text-to-image diffusion models ([Kandinsky2](https://github.com/ai-forever/Kandinsky-2/), [Kandinsky3](https://github.com/ai-forever/Kandinsky-3)).

## Disclaimer

🚧 WIP 🚧 NOT PRODUCTION-READY 🚧

## Roadmap

Supports versions 2.0, 2.1, 2.2 <br>
Supported models: 2.0, 2.1, 2.2, 3.0 <br>
✔ Txt2img <br>
✔ Img2img <br>
✔ Mixing <br>
Expand All @@ -17,82 +21,27 @@
✔ Diffusers pipeline <br>
✔ Low-VRAM options <br>
✔ Support for extensions <br>
✔ ext. Image browser<br>
✔ ext. Fine-tuning <br>
✔ ext. LoRA training and inference <br>
✔ ext. Style library <br>
✔ ext. Upscaling <br>
✔ ext. Img2mesh <br>
✔ ext. Interrogation <br>
✔ ext. Segmentation <br>
✔ ext. Animation <br>
✔ ext. [Image browser](https://github.com/seruva19/kubin-extensions) <br>
✔ ext. [Fine-tuning](https://github.com/seruva19/kubin-extensions) <br>
✔ ext. [LoRA training and inference](https://github.com/seruva19/kubin-extensions) <br>
✔ ext. [Style library](https://github.com/seruva19/kubin-extensions) <br>
✔ ext. [Upscaling](https://github.com/seruva19/kubin-extensions) <br>
✔ ext. [Img2mesh](https://github.com/seruva19/kubin-extensions) <br>
✔ ext. [Interrogation](https://github.com/seruva19/kubin-extensions) <br>
✔ ext. [Segmentation](https://github.com/seruva19/kubin-extensions) <br>
✔ ext. [Animation](https://github.com/seruva19/kubin-extensions) <br>
🕒 Advanced prompt syntax <br>
🕒 Prompt weighting <br>
🕒 Checkpoint conversion <br>
🕒 ext. Area composition <br>

## Kandinsky 3

## Screenshots (outdated)
<details>
<summary>Click to expand</summary>

### Txt2img tab

![img](/sshots/t2i.png)

### Txt2img tab (with ControlNet)

![img](/sshots/t2i_cnet.png)

### Img2img tab

![img](/sshots/i2i.png)
Read [here](https://github.com/seruva19/kubin/wiki/Docs#kandinsky-3).

### Mix tab
## Screenshot

![img](/sshots/mix.png)

### Inpainting tab

![img](/sshots/inpaint.png)

### Outpainting tab

![img](/sshots/outpaint.png)

### Upscaler extension tab

![img](/sshots/upscale.png)

### Segmentation extension tab

![img](/sshots/segmentation.png)

### Mesh generator extension tab

![img](/sshots/mesh.png)

### Interrogator extension tab

![img](/sshots/interrogate.png)

### Image browser extension tab

![img](/sshots/image_browser.png)

### Training extension tab

![img](/sshots/training.png)

### Extensions tab

![img](/sshots/extensions.png)

### Settings tab

![img](/sshots/settings.png)

</details>
![img](/sshots/screenshot.png)

## Google Colab

Expand Down
23 changes: 21 additions & 2 deletions client/css.1.modifiers.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ body:not([class*="pipeline-diffusers-kd22"]) .diffusers-kd22-control {
body[class*="pipeline-"][class*="-kd20"] [class*="unsupported_20"],
body[class*="pipeline-native-kd21"] [class*="unsupported_21"],
body[class*="pipeline-diffusers-kd21"] [class*="unsupported_d21"],
body[class*="pipeline-"][class*="-kd22"] [class*="unsupported_22"] {
body[class*="pipeline-"][class*="-kd22"] [class*="unsupported_22"],
body[class*="pipeline-native-kd30"] [class*="unsupported_30"],
body[class*="pipeline-diffusers-kd30"] [class*="unsupported_d30"] {
display: none;
}

Expand All @@ -22,10 +24,23 @@ body[class*="pipeline-"][class*="-kd20"] .ui-tabs>.tab-nav>button:nth-child(5) {
display: none;
}

body[class*="pipeline-native-kd30"] .ui-tabs>.tab-nav>button:nth-child(2),
body[class*="pipeline-native-kd30"] .ui-tabs>.tab-nav>button:nth-child(3),
body[class*="pipeline-native-kd30"] .ui-tabs>.tab-nav>button:nth-child(5) {
display: none;
}

body[class*="pipeline-diffusers-kd30"] .ui-tabs>.tab-nav>button:nth-child(3),
body[class*="pipeline-diffusers-kd30"] .ui-tabs>.tab-nav>button:nth-child(4),
body[class*="pipeline-diffusers-kd30"] .ui-tabs>.tab-nav>button:nth-child(5) {
display: none;
}


body[class*="pipeline-"][class*="-kd20"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2),
body[class*="pipeline-diffusers-kd21"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2),
body[class*="pipeline-"][class*="-kd22"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2) {
body[class*="pipeline-"][class*="-kd22"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2),
body[class*="pipeline-"][class*="-kd30"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2) {
display: none;
}

Expand Down Expand Up @@ -106,4 +121,8 @@ body.gradio-full .gradio-container {

.kubin-accordion .label-wrap>span>span.added-condition.active {
display: inline;
}

.inpaint_params>.stretch:first-child>.block {
height: 600px !important;
}
23 changes: 21 additions & 2 deletions client/dist/bundle.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ body:not([class*="pipeline-diffusers-kd22"]) .diffusers-kd22-control {
body[class*="pipeline-"][class*="-kd20"] [class*="unsupported_20"],
body[class*="pipeline-native-kd21"] [class*="unsupported_21"],
body[class*="pipeline-diffusers-kd21"] [class*="unsupported_d21"],
body[class*="pipeline-"][class*="-kd22"] [class*="unsupported_22"] {
body[class*="pipeline-"][class*="-kd22"] [class*="unsupported_22"],
body[class*="pipeline-native-kd30"] [class*="unsupported_30"],
body[class*="pipeline-diffusers-kd30"] [class*="unsupported_d30"] {
display: none;
}

Expand All @@ -125,10 +127,23 @@ body[class*="pipeline-"][class*="-kd20"] .ui-tabs>.tab-nav>button:nth-child(5) {
display: none;
}

body[class*="pipeline-native-kd30"] .ui-tabs>.tab-nav>button:nth-child(2),
body[class*="pipeline-native-kd30"] .ui-tabs>.tab-nav>button:nth-child(3),
body[class*="pipeline-native-kd30"] .ui-tabs>.tab-nav>button:nth-child(5) {
display: none;
}

body[class*="pipeline-diffusers-kd30"] .ui-tabs>.tab-nav>button:nth-child(3),
body[class*="pipeline-diffusers-kd30"] .ui-tabs>.tab-nav>button:nth-child(4),
body[class*="pipeline-diffusers-kd30"] .ui-tabs>.tab-nav>button:nth-child(5) {
display: none;
}


body[class*="pipeline-"][class*="-kd20"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2),
body[class*="pipeline-diffusers-kd21"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2),
body[class*="pipeline-"][class*="-kd22"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2) {
body[class*="pipeline-"][class*="-kd22"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2),
body[class*="pipeline-"][class*="-kd30"] .settings-tabs>.tabs>.tab-nav>button:nth-child(2) {
display: none;
}

Expand Down Expand Up @@ -210,6 +225,10 @@ body.gradio-full .gradio-container {
.kubin-accordion .label-wrap>span>span.added-condition.active {
display: inline;
}

.inpaint_params>.stretch:first-child>.block {
height: 600px !important;
}
html.has-lightbox {
overflow-x: hidden;
}
Expand Down
12 changes: 10 additions & 2 deletions notebooks/kubin-colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"#@title Model\n",
"\n",
"model = '2.2-diffusers' #@param [\"2.0\", \"2.1\", \"2.1-diffusers\", \"2.2-diffusers\"]"
"model = '2.2-diffusers' #@param [\"2.0\", \"2.1\", \"2.1-diffusers\", \"2.2-diffusers\", \"3.0\", \"3.0-diffusers\"]"
]
},
{
Expand Down Expand Up @@ -43,7 +43,14 @@
"\n",
"if model == \"2.2-diffusers\":\n",
" model_name = \"kd22\"\n",
" use_diffusers = True\n"
" use_diffusers = True\n",
"\n",
"if model == \"3.0\":\n",
" model_name = \"kd30\"\n",
"\n",
"if model == \"3.0-diffusers\":\n",
" model_name = \"kd30\"\n",
" use_diffusers = True"
]
},
{
Expand Down Expand Up @@ -155,6 +162,7 @@
"%cd /content\n",
"\n",
"!git clone -b {branch} https://github.com/seruva19/kubin.git\n",
"!git clone https://github.com/seruva19/kubin-extensions.git /content/kubin/extensions\n",
"%cd /content/kubin\n",
"\n",
"if checkout_to_commit != '':\n",
Expand Down
1 change: 1 addition & 0 deletions notebooks/kubin-kaggle.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"%cd /kaggle/working\n",
"\n",
"!git clone -b {\"dev\" if use_dev else \"main\"} https://github.com/seruva19/kubin.git \n",
"!git clone https://github.com/seruva19/kubin-extensions.git /kaggle/working/kubin/extensions\n",
"%cd /kaggle/working/kubin\n",
"\n",
"!pip install -r requirements.txt"
Expand Down
10 changes: 1 addition & 9 deletions notebooks/kubin-paperspace.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"%cd /{kd2_dir}\n",
"\n",
"!git clone -b {\"dev\" if use_dev else \"main\"} https://github.com/seruva19/kubin.git\n",
"!git clone https://github.com/seruva19/kubin-extensions.git /{kd2_dir}/kubin/extensions\n",
"%cd /{kd2_dir}/kubin\n",
"\n",
"!pip install -r requirements.txt\n",
Expand All @@ -52,15 +53,6 @@
" !python -m xformers.info"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install pydantic==2.0.2"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
git+https://github.com/ai-forever/Kandinsky-2.git@33c3176
git+https://github.com/openai/CLIP.git@a1d0717
diffusers==0.20.2
transformers==4.31.0
accelerate==0.21.0
diffusers==0.24.0
transformers==4.35.2
accelerate==0.25.0
opencv-python==4.8.0.74
gradio==3.39.0
gradio==3.50.2
psutil==5.9.5
deepdiff==6.3.1
torchsde==0.2.5
Expand Down
10 changes: 10 additions & 0 deletions src/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ def with_pipeline(self):

self.model = Model_Diffusers(self.params)

elif pipeline == "diffusers" and model_name == "kd30":
from models.model_diffusers30.model_30 import Model_Diffusers3

self.model = Model_Diffusers3(self.params)

elif pipeline == "native" and model_name == "kd30":
from models.model_30.model_kd30 import Model_KD3

self.model = Model_KD3(self.params)

elif pipeline == "native" and model_name == "kd21":
from models.model_21.model_kd21 import Model_KD21

Expand Down
Loading

0 comments on commit ab5d26d

Please sign in to comment.