Spaces:
Runtime error
Runtime error
Linoy Tsaban
commited on
Commit
·
68f9d7d
1
Parent(s):
54787fd
Update pipeline_semantic_stable_diffusion_img2img_solver.py
Browse files
pipeline_semantic_stable_diffusion_img2img_solver.py
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
class AttentionStore():
|
| 2 |
@staticmethod
|
| 3 |
def get_empty_store():
|
|
|
|
| 1 |
+
import inspect
|
| 2 |
+
import warnings
|
| 3 |
+
from itertools import repeat
|
| 4 |
+
from typing import Callable, List, Optional, Union
|
| 5 |
+
|
| 6 |
+
import torch
|
| 7 |
+
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
|
| 8 |
+
|
| 9 |
+
from diffusers.image_processor import VaeImageProcessor
|
| 10 |
+
from diffusers.models import AutoencoderKL, UNet2DConditionModel
|
| 11 |
+
from diffusers.models.attention_processor import AttnProcessor, Attention
|
| 12 |
+
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
|
| 13 |
+
from diffusers.schedulers import DDIMScheduler
|
| 14 |
+
from scheduling_dpmsolver_multistep_inject import DPMSolverMultistepSchedulerInject
|
| 15 |
+
# from diffusers.utils import logging, randn_tensor
|
| 16 |
+
from diffusers.utils import logging
|
| 17 |
+
from diffusers.utils.torch_utils import randn_tensor
|
| 18 |
+
from diffusers.pipelines.pipeline_utils import DiffusionPipeline
|
| 19 |
+
from diffusers.pipelines.semantic_stable_diffusion import SemanticStableDiffusionPipelineOutput
|
| 20 |
+
|
| 21 |
+
import numpy as np
|
| 22 |
+
from PIL import Image
|
| 23 |
+
from tqdm import tqdm
|
| 24 |
+
import torch.nn.functional as F
|
| 25 |
+
import math
|
| 26 |
+
from collections.abc import Iterable
|
| 27 |
+
|
| 28 |
+
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
|
| 29 |
+
|
| 30 |
+
|
| 31 |
class AttentionStore():
|
| 32 |
@staticmethod
|
| 33 |
def get_empty_store():
|