Spaces:
Runtime error
Runtime error
LuChengTHU
commited on
Commit
Β·
f8407d3
1
Parent(s):
a6d4e36
omit some models
Browse files- app.py +34 -23
- requirements.txt +2 -1
app.py
CHANGED
@@ -37,20 +37,21 @@ class Model:
|
|
37 |
|
38 |
models = [
|
39 |
Model("Custom model", "", ""),
|
|
|
40 |
Model("Stable-Diffusion-v1.4", "CompVis/stable-diffusion-v1-4", "The 1.4 version of official stable-diffusion"),
|
41 |
Model("Stable-Diffusion-v1.5", "runwayml/stable-diffusion-v1-5", "The 1.5 version of official stable-diffusion"),
|
42 |
Model("Arcane", "nitrosocke/Arcane-Diffusion", "arcane style "),
|
43 |
-
|
44 |
Model("Elden Ring", "nitrosocke/elden-ring-diffusion", "elden ring style "),
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
Model("Waifu", "hakurei/waifu-diffusion", ""),
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
]
|
55 |
|
56 |
last_mode = "txt2img"
|
@@ -208,18 +209,27 @@ with gr.Blocks(css=css) as demo:
|
|
208 |
f"""
|
209 |
<div class="finetuned-diffusion-div">
|
210 |
<div>
|
211 |
-
<h1>Finetuned Diffusion</h1>
|
212 |
</div>
|
|
|
213 |
<p>
|
214 |
-
|
215 |
-
<a href="https://huggingface.co/runwayml/stable-diffusion-v1-4">Stable-Diffusion-v1.4</a>, <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5">Stable-Diffusion-v1.5</a>, <a href="https://huggingface.co/nitrosocke/Arcane-Diffusion">Arcane</a>, <a href="https://huggingface.co/nitrosocke/archer-diffusion">Archer</a>, <a href="https://huggingface.co/nitrosocke/elden-ring-diffusion">Elden Ring</a>, <a href="https://huggingface.co/nitrosocke/spider-verse-diffusion">Spider-Verse</a>, <a href="https://huggingface.co/nitrosocke/modern-disney-diffusion">Modern Disney</a>, <a href="https://huggingface.co/nitrosocke/classic-anim-diffusion">Classic Disney</a>, <a href="https://huggingface.co/hakurei/waifu-diffusion">Waifu</a>, <a href="https://huggingface.co/lambdalabs/sd-pokemon-diffusers">PokΓ©mon</a>, <a href="https://huggingface.co/AstraliteHeart/pony-diffusion">Pony Diffusion</a>, <a href="https://huggingface.co/nousr/robo-diffusion">Robo Diffusion</a>, <a href="https://huggingface.co/DGSpitzer/Cyberpunk-Anime-Diffusion">Cyberpunk Anime</a>, <a href="https://huggingface.co/dallinmackay/Tron-Legacy-diffusion">Tron Legacy</a> + any other custom Diffusers 𧨠SD model hosted on HuggingFace π€.
|
216 |
</p>
|
217 |
-
<p>
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
219 |
</p>
|
220 |
</div>
|
221 |
"""
|
222 |
)
|
|
|
|
|
|
|
|
|
223 |
with gr.Row():
|
224 |
|
225 |
with gr.Column(scale=55):
|
@@ -248,7 +258,7 @@ with gr.Blocks(css=css) as demo:
|
|
248 |
|
249 |
with gr.Row():
|
250 |
guidance = gr.Slider(label="Guidance scale", value=7.5, maximum=15)
|
251 |
-
steps = gr.Slider(label="Steps", value=
|
252 |
|
253 |
with gr.Row():
|
254 |
width = gr.Slider(label="Width", value=512, minimum=64, maximum=1024, step=8)
|
@@ -271,16 +281,17 @@ with gr.Blocks(css=css) as demo:
|
|
271 |
|
272 |
|
273 |
# TODO: the docs here are wrong.
|
274 |
-
ex = gr.Examples([
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
|
|
281 |
|
282 |
gr.Markdown('''
|
283 |
-
Models by [@nitrosocke](https://huggingface.co/nitrosocke), [@haruu1367](https://twitter.com/haruu1367), [@Helixngc7293](https://twitter.com/DGSpitzer) and others. β€οΈ<br>
|
284 |
Space by: [![Twitter Follow](https://img.shields.io/twitter/follow/ChengLu05671218?label=%40ChengLu&style=social)](https://twitter.com/ChengLu05671218)
|
285 |
|
286 |
![visitors](https://visitor-badge.glitch.me/badge?page_id=LuChengTHU.dpmsolver_sdm)
|
|
|
37 |
|
38 |
models = [
|
39 |
Model("Custom model", "", ""),
|
40 |
+
# Model("Stable-Diffusion-v1.5", "../stable-diffusion-v1-5", "The 1.5 version of official stable-diffusion"),
|
41 |
Model("Stable-Diffusion-v1.4", "CompVis/stable-diffusion-v1-4", "The 1.4 version of official stable-diffusion"),
|
42 |
Model("Stable-Diffusion-v1.5", "runwayml/stable-diffusion-v1-5", "The 1.5 version of official stable-diffusion"),
|
43 |
Model("Arcane", "nitrosocke/Arcane-Diffusion", "arcane style "),
|
44 |
+
# Model("Archer", "nitrosocke/archer-diffusion", "archer style "),
|
45 |
Model("Elden Ring", "nitrosocke/elden-ring-diffusion", "elden ring style "),
|
46 |
+
# Model("Spider-Verse", "nitrosocke/spider-verse-diffusion", "spiderverse style "),
|
47 |
+
# Model("Modern Disney", "nitrosocke/mo-di-diffusion", "modern disney style "),
|
48 |
+
# Model("Classic Disney", "nitrosocke/classic-anim-diffusion", "classic disney style "),
|
49 |
Model("Waifu", "hakurei/waifu-diffusion", ""),
|
50 |
+
# Model("PokΓ©mon", "lambdalabs/sd-pokemon-diffusers", ""),
|
51 |
+
# Model("Pony Diffusion", "AstraliteHeart/pony-diffusion", ""),
|
52 |
+
# Model("Robo Diffusion", "nousr/robo-diffusion", ""),
|
53 |
+
# Model("Cyberpunk Anime", "DGSpitzer/Cyberpunk-Anime-Diffusion", "dgs illustration style "),
|
54 |
+
# Model("Tron Legacy", "dallinmackay/Tron-Legacy-diffusion", "trnlgcy ")
|
55 |
]
|
56 |
|
57 |
last_mode = "txt2img"
|
|
|
209 |
f"""
|
210 |
<div class="finetuned-diffusion-div">
|
211 |
<div>
|
212 |
+
<h1>Finetuned Diffusion with DPM-Solver (fastest sampler for diffusion models) </h1>
|
213 |
</div>
|
214 |
+
<br>
|
215 |
<p>
|
216 |
+
<a href="https://github.com/LuChengTHU/dpm-solver">DPM-Solver</a> (Neurips 2022 Oral) is a fast high-order solver customized for diffusion ODEs, which can generate high-quality samples by diffusion models within only 10-25 steps. DPM-Solver has an analytical formulation and is very easy to use for all types of Gaussian diffusion models, and includes <a href="https://arxiv.org/abs/2010.02502">DDIM</a> as a first-order special case.
|
|
|
217 |
</p>
|
218 |
+
<p>
|
219 |
+
We use <a href="https://github.com/huggingface/diffusers">Diffusers</a> to implement this demo, which currently supports the multistep DPM-Solver scheduler. For more details of DPM-Solver with Diffusers, check <a href="https://github.com/huggingface/diffusers/pull/1132">this pull request</a>.
|
220 |
+
</p>
|
221 |
+
<br>
|
222 |
+
<p>
|
223 |
+
Demo for sampling by DPM-Solver with several fine-tuned Stable Diffusion models, trained on different styles: <br>
|
224 |
+
<a href="https://huggingface.co/CompVis/stable-diffusion-v1-4">Stable-Diffusion-v1.4</a>, <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5">Stable-Diffusion-v1.5</a>, <a href="https://huggingface.co/nitrosocke/Arcane-Diffusion">Arcane</a>, <a href="https://huggingface.co/nitrosocke/archer-diffusion">Archer</a>, <a href="https://huggingface.co/nitrosocke/elden-ring-diffusion">Elden Ring</a>, <a href="https://huggingface.co/nitrosocke/spider-verse-diffusion">Spider-Verse</a>, <a href="https://huggingface.co/nitrosocke/modern-disney-diffusion">Modern Disney</a>, <a href="https://huggingface.co/nitrosocke/classic-anim-diffusion">Classic Disney</a>, <a href="https://huggingface.co/hakurei/waifu-diffusion">Waifu</a>, <a href="https://huggingface.co/lambdalabs/sd-pokemon-diffusers">PokΓ©mon</a>, <a href="https://huggingface.co/AstraliteHeart/pony-diffusion">Pony Diffusion</a>, <a href="https://huggingface.co/nousr/robo-diffusion">Robo Diffusion</a>, <a href="https://huggingface.co/DGSpitzer/Cyberpunk-Anime-Diffusion">Cyberpunk Anime</a>, <a href="https://huggingface.co/dallinmackay/Tron-Legacy-diffusion">Tron Legacy</a> + any other custom Diffusers 𧨠SD model hosted on HuggingFace π€.
|
225 |
</p>
|
226 |
</div>
|
227 |
"""
|
228 |
)
|
229 |
+
# TODO: the colab version is wrong.
|
230 |
+
# <p>Don't want to wait in queue? <a href="https://colab.research.google.com/gist/qunash/42112fb104509c24fd3aa6d1c11dd6e0/copy-of-fine-tuned-diffusion-gradio.ipynb"><img data-canonical-src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" src="https://camo.githubusercontent.com/84f0493939e0c4de4e6dbe113251b4bfb5353e57134ffd9fcab6b8714514d4d1/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667"></a></p>
|
231 |
+
# Running on <b>{device}</b>{(" in a <b>Google Colab</b>." if is_colab else "")}
|
232 |
+
# </p>
|
233 |
with gr.Row():
|
234 |
|
235 |
with gr.Column(scale=55):
|
|
|
258 |
|
259 |
with gr.Row():
|
260 |
guidance = gr.Slider(label="Guidance scale", value=7.5, maximum=15)
|
261 |
+
steps = gr.Slider(label="Steps", value=25, minimum=2, maximum=100, step=1)
|
262 |
|
263 |
with gr.Row():
|
264 |
width = gr.Slider(label="Width", value=512, minimum=64, maximum=1024, step=8)
|
|
|
281 |
|
282 |
|
283 |
# TODO: the docs here are wrong.
|
284 |
+
# ex = gr.Examples([
|
285 |
+
# [models[1].name, "jason bateman disassembling the demon core", 7.5, 50],
|
286 |
+
# # [models[1+2].name, "jason bateman disassembling the demon core", 7.5, 50],
|
287 |
+
# # [models[4+2].name, "portrait of dwayne johnson", 7.0, 75],
|
288 |
+
# # [models[5+2].name, "portrait of a beautiful alyx vance half life", 10, 50],
|
289 |
+
# # [models[6+2].name, "Aloy from Horizon: Zero Dawn, half body portrait, smooth, detailed armor, beautiful face, illustration", 7.0, 45],
|
290 |
+
# # [models[5+2].name, "fantasy portrait painting, digital art", 4.0, 30],
|
291 |
+
# ], [model_name, prompt, guidance, steps, seed], image_out, inference, cache_examples=False)
|
292 |
|
293 |
gr.Markdown('''
|
294 |
+
Models by [@nitrosocke](https://huggingface.co/nitrosocke), [@haruu1367](https://twitter.com/haruu1367), [@Helixngc7293](https://twitter.com/DGSpitzer) and others. Code are copied from [@anzorq's fintuned_diffusion](https://huggingface.co/spaces/anzorq/finetuned_diffusion/tree/main) β€οΈ<br>
|
295 |
Space by: [![Twitter Follow](https://img.shields.io/twitter/follow/ChengLu05671218?label=%40ChengLu&style=social)](https://twitter.com/ChengLu05671218)
|
296 |
|
297 |
![visitors](https://visitor-badge.glitch.me/badge?page_id=LuChengTHU.dpmsolver_sdm)
|
requirements.txt
CHANGED
@@ -3,4 +3,5 @@ torch
|
|
3 |
git+https://github.com/huggingface/diffusers.git
|
4 |
transformers
|
5 |
scipy
|
6 |
-
ftfy
|
|
|
|
3 |
git+https://github.com/huggingface/diffusers.git
|
4 |
transformers
|
5 |
scipy
|
6 |
+
ftfy
|
7 |
+
accelerate
|