Spaces:
Running on Zero
Running on Zero
[Admin maintenance] Support new ZeroGPU hardware
Browse filesThank you so much for having shared this Space with the community on this demo. We have upgraded the ZeroGPU infra-structure to run on modern blackwell architecture.
For that, we need to upgrade your demo to support that. This PR fixes your demo to work with the new architecture. As this is something we broke on our end, we may merge this PR autonomously. If this breaks unexpectedly or brings unintended consequences, feel free to revert, modify or otherwise. Any issues you can email apolinario@huggingface.co
- README.md +1 -1
- SDXL/diff_pipe.py +19 -21
- app.py +1 -1
- requirements.txt +5 -94
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 😻
|
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.49.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
SDXL/diff_pipe.py
CHANGED
|
@@ -22,23 +22,37 @@ from transformers import CLIPTextModel, CLIPTextModelWithProjection, CLIPTokeniz
|
|
| 22 |
import torchvision
|
| 23 |
|
| 24 |
from diffusers.image_processor import VaeImageProcessor
|
| 25 |
-
from diffusers.loaders import FromSingleFileMixin,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
from diffusers.models import AutoencoderKL, UNet2DConditionModel
|
| 27 |
from diffusers.models.attention_processor import (
|
| 28 |
AttnProcessor2_0,
|
| 29 |
-
LoRAAttnProcessor2_0,
|
| 30 |
-
LoRAXFormersAttnProcessor,
|
| 31 |
XFormersAttnProcessor,
|
| 32 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
from diffusers.schedulers import KarrasDiffusionSchedulers
|
| 34 |
from diffusers.utils import (
|
| 35 |
is_accelerate_available,
|
| 36 |
-
is_accelerate_version,
|
| 37 |
is_invisible_watermark_available,
|
| 38 |
logging,
|
| 39 |
-
randn_tensor,
|
| 40 |
replace_example_docstring,
|
| 41 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
from diffusers.pipelines.pipeline_utils import DiffusionPipeline
|
| 43 |
from diffusers.pipelines.stable_diffusion_xl import StableDiffusionXLPipelineOutput
|
| 44 |
|
|
@@ -634,23 +648,7 @@ class StableDiffusionXLDiffImg2ImgPipeline(DiffusionPipeline, FromSingleFileMixi
|
|
| 634 |
|
| 635 |
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_upscale.StableDiffusionUpscalePipeline.upcast_vae
|
| 636 |
def upcast_vae(self):
|
| 637 |
-
dtype = self.vae.dtype
|
| 638 |
self.vae.to(dtype=torch.float32)
|
| 639 |
-
use_torch_2_0_or_xformers = isinstance(
|
| 640 |
-
self.vae.decoder.mid_block.attentions[0].processor,
|
| 641 |
-
(
|
| 642 |
-
AttnProcessor2_0,
|
| 643 |
-
XFormersAttnProcessor,
|
| 644 |
-
LoRAXFormersAttnProcessor,
|
| 645 |
-
LoRAAttnProcessor2_0,
|
| 646 |
-
),
|
| 647 |
-
)
|
| 648 |
-
# if xformers or torch_2_0 is used attention block does not need
|
| 649 |
-
# to be in float32 which can save lots of memory
|
| 650 |
-
if use_torch_2_0_or_xformers:
|
| 651 |
-
self.vae.post_quant_conv.to(dtype)
|
| 652 |
-
self.vae.decoder.conv_in.to(dtype)
|
| 653 |
-
self.vae.decoder.mid_block.to(dtype)
|
| 654 |
|
| 655 |
@torch.no_grad()
|
| 656 |
@replace_example_docstring(EXAMPLE_DOC_STRING)
|
|
|
|
| 22 |
import torchvision
|
| 23 |
|
| 24 |
from diffusers.image_processor import VaeImageProcessor
|
| 25 |
+
from diffusers.loaders import FromSingleFileMixin, TextualInversionLoaderMixin
|
| 26 |
+
try:
|
| 27 |
+
from diffusers.loaders import StableDiffusionXLLoraLoaderMixin as LoraLoaderMixin
|
| 28 |
+
except ImportError:
|
| 29 |
+
from diffusers.loaders import LoraLoaderMixin
|
| 30 |
from diffusers.models import AutoencoderKL, UNet2DConditionModel
|
| 31 |
from diffusers.models.attention_processor import (
|
| 32 |
AttnProcessor2_0,
|
|
|
|
|
|
|
| 33 |
XFormersAttnProcessor,
|
| 34 |
)
|
| 35 |
+
try:
|
| 36 |
+
from diffusers.models.attention_processor import LoRAAttnProcessor2_0, LoRAXFormersAttnProcessor
|
| 37 |
+
except ImportError:
|
| 38 |
+
LoRAAttnProcessor2_0 = AttnProcessor2_0
|
| 39 |
+
LoRAXFormersAttnProcessor = XFormersAttnProcessor
|
| 40 |
from diffusers.schedulers import KarrasDiffusionSchedulers
|
| 41 |
from diffusers.utils import (
|
| 42 |
is_accelerate_available,
|
|
|
|
| 43 |
is_invisible_watermark_available,
|
| 44 |
logging,
|
|
|
|
| 45 |
replace_example_docstring,
|
| 46 |
)
|
| 47 |
+
try:
|
| 48 |
+
from diffusers.utils import is_accelerate_version
|
| 49 |
+
except ImportError:
|
| 50 |
+
def is_accelerate_version(op, ver):
|
| 51 |
+
return False
|
| 52 |
+
try:
|
| 53 |
+
from diffusers.utils.torch_utils import randn_tensor
|
| 54 |
+
except ImportError:
|
| 55 |
+
from diffusers.utils import randn_tensor
|
| 56 |
from diffusers.pipelines.pipeline_utils import DiffusionPipeline
|
| 57 |
from diffusers.pipelines.stable_diffusion_xl import StableDiffusionXLPipelineOutput
|
| 58 |
|
|
|
|
| 648 |
|
| 649 |
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_upscale.StableDiffusionUpscalePipeline.upcast_vae
|
| 650 |
def upcast_vae(self):
|
|
|
|
| 651 |
self.vae.to(dtype=torch.float32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 652 |
|
| 653 |
@torch.no_grad()
|
| 654 |
@replace_example_docstring(EXAMPLE_DOC_STRING)
|
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
import spaces
|
|
|
|
| 3 |
import torch
|
| 4 |
from torchvision import transforms
|
| 5 |
from SDXL.diff_pipe import StableDiffusionXLDiffImg2ImgPipeline
|
|
|
|
|
|
|
| 1 |
import spaces
|
| 2 |
+
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from torchvision import transforms
|
| 5 |
from SDXL.diff_pipe import StableDiffusionXLDiffImg2ImgPipeline
|
requirements.txt
CHANGED
|
@@ -1,94 +1,5 @@
|
|
| 1 |
-
accelerate
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
attrs==23.2.0
|
| 7 |
-
certifi==2023.11.17
|
| 8 |
-
charset-normalizer==3.3.2
|
| 9 |
-
click==8.1.7
|
| 10 |
-
colorama==0.4.6
|
| 11 |
-
contourpy==1.2.0
|
| 12 |
-
cycler==0.12.1
|
| 13 |
-
diffusers==0.19.3
|
| 14 |
-
exceptiongroup==1.2.0
|
| 15 |
-
fastapi==0.109.2
|
| 16 |
-
ffmpy==0.3.2
|
| 17 |
-
filelock==3.13.1
|
| 18 |
-
fonttools==4.49.0
|
| 19 |
-
fsspec==2023.10.0
|
| 20 |
-
gradio==4.19.1
|
| 21 |
-
gradio_client==0.10.0
|
| 22 |
-
h11==0.14.0
|
| 23 |
-
httpcore==1.0.3
|
| 24 |
-
httpx==0.26.0
|
| 25 |
-
huggingface-hub==0.19.4
|
| 26 |
-
idna==3.4
|
| 27 |
-
importlib-metadata==6.8.0
|
| 28 |
-
importlib-resources==6.1.1
|
| 29 |
-
Jinja2==3.1.2
|
| 30 |
-
jsonschema==4.21.1
|
| 31 |
-
jsonschema-specifications==2023.12.1
|
| 32 |
-
kiwisolver==1.4.5
|
| 33 |
-
markdown-it-py==3.0.0
|
| 34 |
-
MarkupSafe==2.1.3
|
| 35 |
-
matplotlib==3.8.3
|
| 36 |
-
mdurl==0.1.2
|
| 37 |
-
mpmath==1.3.0
|
| 38 |
-
networkx==3.2.1
|
| 39 |
-
numpy==1.26.2
|
| 40 |
-
nvidia-cublas-cu12==12.1.3.1
|
| 41 |
-
nvidia-cuda-cupti-cu12==12.1.105
|
| 42 |
-
nvidia-cuda-nvrtc-cu12==12.1.105
|
| 43 |
-
nvidia-cuda-runtime-cu12==12.1.105
|
| 44 |
-
nvidia-cudnn-cu12==8.9.2.26
|
| 45 |
-
nvidia-cufft-cu12==11.0.2.54
|
| 46 |
-
nvidia-curand-cu12==10.3.2.106
|
| 47 |
-
nvidia-cusolver-cu12==11.4.5.107
|
| 48 |
-
nvidia-cusparse-cu12==12.1.0.106
|
| 49 |
-
nvidia-nccl-cu12==2.18.1
|
| 50 |
-
nvidia-nvjitlink-cu12==12.3.101
|
| 51 |
-
nvidia-nvtx-cu12==12.1.105
|
| 52 |
-
orjson==3.9.14
|
| 53 |
-
packaging==23.2
|
| 54 |
-
pandas==2.2.0
|
| 55 |
-
Pillow==10.1.0
|
| 56 |
-
psutil==5.9.6
|
| 57 |
-
pydantic==2.6.1
|
| 58 |
-
pydantic_core==2.16.2
|
| 59 |
-
pydub==0.25.1
|
| 60 |
-
Pygments==2.17.2
|
| 61 |
-
pyparsing==3.1.1
|
| 62 |
-
python-dateutil==2.8.2
|
| 63 |
-
python-multipart==0.0.9
|
| 64 |
-
pytz==2024.1
|
| 65 |
-
PyYAML==6.0.1
|
| 66 |
-
referencing==0.33.0
|
| 67 |
-
regex==2023.10.3
|
| 68 |
-
requests==2.31.0
|
| 69 |
-
rich==13.7.0
|
| 70 |
-
rpds-py==0.18.0
|
| 71 |
-
ruff==0.2.2
|
| 72 |
-
safetensors==0.4.0
|
| 73 |
-
semantic-version==2.10.0
|
| 74 |
-
sentencepiece==0.1.99
|
| 75 |
-
shellingham==1.5.4
|
| 76 |
-
six==1.16.0
|
| 77 |
-
sniffio==1.3.0
|
| 78 |
-
starlette==0.36.3
|
| 79 |
-
sympy==1.12
|
| 80 |
-
tokenizers==0.15.0
|
| 81 |
-
tomlkit==0.12.0
|
| 82 |
-
toolz==0.12.1
|
| 83 |
-
torch==2.1.1
|
| 84 |
-
torchvision==0.16.1
|
| 85 |
-
tqdm==4.66.1
|
| 86 |
-
transformers==4.35.2
|
| 87 |
-
triton==2.1.0
|
| 88 |
-
typer==0.9.0
|
| 89 |
-
typing_extensions==4.8.0
|
| 90 |
-
tzdata==2024.1
|
| 91 |
-
urllib3==2.1.0
|
| 92 |
-
uvicorn==0.27.1
|
| 93 |
-
websockets==11.0.3
|
| 94 |
-
zipp==3.17.0
|
|
|
|
| 1 |
+
accelerate
|
| 2 |
+
diffusers
|
| 3 |
+
transformers
|
| 4 |
+
torchvision
|
| 5 |
+
sentencepiece
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|