Spaces:
Runtime error
Runtime error
title: "ERA SESSION20 - Stable Diffusion: Generative Art with Guidance" | |
emoji: π | |
colorFrom: indigo | |
colorTo: pink | |
sdk: gradio | |
sdk_version: 3.48.0 | |
app_file: app.py | |
pinned: false | |
license: mit | |
**Styles Used:** | |
1. [Oil style](https://huggingface.co/sd-concepts-library/oil-style) | |
2. [Xyz](https://huggingface.co/sd-concepts-library/xyz) | |
3. [Allante](https://huggingface.co/sd-concepts-library/style-of-marc-allante) | |
4. [Moebius](https://huggingface.co/sd-concepts-library/moebius) | |
5. [Polygons](https://huggingface.co/sd-concepts-library/low-poly-hd-logos-icons) | |
### Result of Experiments with different styles: | |
**Prompt:** `"a cat and dog in the style of cs"` \ | |
_"cs" in the prompt refers to "custom style" whose embedding is replaced by each of the concept embeddings shown below_ | |
 | |
--- | |
**Prompt:** `"dolphin swimming on Mars in the style of cs"` | |
 | |
### Result of Experiments with Guidance loss functions: | |
**Prompt:** `"a mouse in the style of cs"` | |
**Loss Function:** | |
```python | |
def loss_fn(images): | |
return images.mean() | |
``` | |
 | |
--- | |
```python | |
def loss_fn(images): | |
return -images.median()/3 | |
``` | |
 | |
--- | |
```python | |
def loss_fn(images): | |
error = (images - images.min()) / 255*(images.max() - images.min()) | |
return error.mean() | |
``` | |
 | |
--- | |
**Prompt:** `"angry german shephard in the style of cs"` | |
```python | |
def loss_fn(images): | |
error1 = torch.abs(images[:, 0] - 0.9) | |
error2 = torch.abs(images[:, 1] - 0.9) | |
error3 = torch.abs(images[:, 2] - 0.9) | |
return ( | |
torch.sin(error1.mean()) + torch.sin(error2.mean()) + torch.sin(error3.mean()) | |
) / 3 | |
``` | |
 | |
--- | |
**Prompt:** `"A campfire (oil on canvas)"` | |
```python | |
def loss_fn(images): | |
error1 = torch.abs(images[:, 0] - 0.9) | |
error2 = torch.abs(images[:, 1] - 0.9) | |
error3 = torch.abs(images[:, 2] - 0.9) | |
return ( | |
torch.sin((error1 * error2 * error3)).mean() | |
+ torch.cos((error1 * error2 * error3)).mean() | |
) | |
``` | |
 | |
--- | |
```python | |
def loss_fn(images): | |
error1 = torch.abs(images[:, 0] - 0.9) | |
error2 = torch.abs(images[:, 1] - 0.9) | |
error3 = torch.abs(images[:, 2] - 0.9) | |
return ( | |
torch.sin(error1.mean()) + torch.sin(error2.mean()) + torch.sin(error3.mean()) | |
) / 3 | |
``` | |
 | |