Spaces:
Runtime error
Runtime error
freemt commited on
Commit ·
4dc9e2b
1
Parent(s): 8ddf994
Update comment out fusing
Browse files- app-diffusers.py +1 -1
- app.py +5 -1
- example.py +2 -2
- example1.py +2 -2
app-diffusers.py
CHANGED
|
@@ -14,7 +14,7 @@ except ModuleNotFoundError:
|
|
| 14 |
import PIL
|
| 15 |
from diffusers import DiffusionPipeline
|
| 16 |
|
| 17 |
-
ldm = DiffusionPipeline.from_pretrained("
|
| 18 |
|
| 19 |
generator = torch.manual_seed(42)
|
| 20 |
|
|
|
|
| 14 |
import PIL
|
| 15 |
from diffusers import DiffusionPipeline
|
| 16 |
|
| 17 |
+
ldm = DiffusionPipeline.from_pretrained("fu sing/latent-diffusion-text2im-large")
|
| 18 |
|
| 19 |
generator = torch.manual_seed(42)
|
| 20 |
|
app.py
CHANGED
|
@@ -25,7 +25,11 @@ def generate_images(phrase: str, steps: int = 125):
|
|
| 25 |
num_images = 1
|
| 26 |
diversity = 6
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# Algo from spaces/Gradio-Blocks/latent_gpt2_story/blob/main/app.py
|
| 31 |
# generated_images = []
|
|
|
|
| 25 |
num_images = 1
|
| 26 |
diversity = 6
|
| 27 |
|
| 28 |
+
try:
|
| 29 |
+
image_bytes = image_gen(generated_text, steps, width, height, num_images, diversity)
|
| 30 |
+
except Exception as exc:
|
| 31 |
+
logger.error(exc)
|
| 32 |
+
return img, f"phrase: {phrase}, errors: str(exc). Try again."
|
| 33 |
|
| 34 |
# Algo from spaces/Gradio-Blocks/latent_gpt2_story/blob/main/app.py
|
| 35 |
# generated_images = []
|
example.py
CHANGED
|
@@ -7,8 +7,8 @@ import tqdm
|
|
| 7 |
torch_device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 8 |
|
| 9 |
# 1. Load models
|
| 10 |
-
scheduler = DDIMScheduler.from_config("
|
| 11 |
-
unet = UNetUnconditionalModel.from_pretrained("
|
| 12 |
|
| 13 |
# 2. Sample gaussian noise
|
| 14 |
generator = torch.manual_seed(23)
|
|
|
|
| 7 |
torch_device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 8 |
|
| 9 |
# 1. Load models
|
| 10 |
+
scheduler = DDIMScheduler.from_config("fu sing/ddpm-celeba-hq", tensor_format="pt")
|
| 11 |
+
unet = UNetUnconditionalModel.from_pretrained("fu sing/ddpm-celeba-hq", ddpm=True).to(torch_device)
|
| 12 |
|
| 13 |
# 2. Sample gaussian noise
|
| 14 |
generator = torch.manual_seed(23)
|
example1.py
CHANGED
|
@@ -11,11 +11,11 @@ https://github.com/CompVis/latent-diffusion/blob/main/scripts/txt2img.py
|
|
| 11 |
https://medium.com/tag/diffusion-models
|
| 12 |
|
| 13 |
!pip install einops
|
| 14 |
-
|
| 15 |
"""
|
| 16 |
from diffusers import DiffusionPipeline
|
| 17 |
|
| 18 |
-
ldm = DiffusionPipeline.from_pretrained("
|
| 19 |
|
| 20 |
generator = torch.manual_seed(42)
|
| 21 |
|
|
|
|
| 11 |
https://medium.com/tag/diffusion-models
|
| 12 |
|
| 13 |
!pip install einops
|
| 14 |
+
|
| 15 |
"""
|
| 16 |
from diffusers import DiffusionPipeline
|
| 17 |
|
| 18 |
+
ldm = DiffusionPipeline.from_pretrained("fu sing/latent-diffusion-text2im-large")
|
| 19 |
|
| 20 |
generator = torch.manual_seed(42)
|
| 21 |
|