fix pipeline compatibility with diffusers>=0.29

#7
Files changed (1) hide show
  1. pipeline.py +4 -1
pipeline.py CHANGED
@@ -8,7 +8,10 @@ from diffusers import UNet2DConditionModel
8
  from diffusers.configuration_utils import register_to_config
9
  from diffusers.models.attention import BasicTransformerBlock
10
  from diffusers.models.resnet import ResnetBlock2D, Downsample2D, Upsample2D
11
- from diffusers.models.transformer_2d import Transformer2DModelOutput
 
 
 
12
  from diffusers.pipelines.stable_diffusion import StableDiffusionSafetyChecker
13
  from diffusers.schedulers import KarrasDiffusionSchedulers
14
  from torch import nn
 
8
  from diffusers.configuration_utils import register_to_config
9
  from diffusers.models.attention import BasicTransformerBlock
10
  from diffusers.models.resnet import ResnetBlock2D, Downsample2D, Upsample2D
11
+ try:
12
+ from diffusers.models.transformer_2d import Transformer2DModelOutput
13
+ except ImportError:
14
+ from diffusers.models.transformers.transformer_2d import Transformer2DModelOutput
15
  from diffusers.pipelines.stable_diffusion import StableDiffusionSafetyChecker
16
  from diffusers.schedulers import KarrasDiffusionSchedulers
17
  from torch import nn