Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
diffusers
Commits
90250d9e
Unverified
Commit
90250d9e
authored
Apr 19, 2024
by
Dhruv Nair
Committed by
GitHub
Apr 18, 2024
Browse files
Cast height, width to int inside prepare latents (#7691)
update
parent
e5674015
Changes
63
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
132 additions
and
22 deletions
+132
-22
examples/community/composable_stable_diffusion.py
examples/community/composable_stable_diffusion.py
+6
-1
examples/community/gluegen.py
examples/community/gluegen.py
+6
-1
examples/community/instaflow_one_step.py
examples/community/instaflow_one_step.py
+6
-1
examples/community/ip_adapter_face_id.py
examples/community/ip_adapter_face_id.py
+6
-1
examples/community/latent_consistency_img2img.py
examples/community/latent_consistency_img2img.py
+6
-1
examples/community/latent_consistency_interpolate.py
examples/community/latent_consistency_interpolate.py
+6
-1
examples/community/latent_consistency_txt2img.py
examples/community/latent_consistency_txt2img.py
+6
-1
examples/community/lpw_stable_diffusion.py
examples/community/lpw_stable_diffusion.py
+6
-1
examples/community/lpw_stable_diffusion_xl.py
examples/community/lpw_stable_diffusion_xl.py
+12
-2
examples/community/pipeline_demofusion_sdxl.py
examples/community/pipeline_demofusion_sdxl.py
+6
-1
examples/community/pipeline_sdxl_style_aligned.py
examples/community/pipeline_sdxl_style_aligned.py
+12
-2
examples/community/pipeline_stable_diffusion_pag.py
examples/community/pipeline_stable_diffusion_pag.py
+6
-1
examples/community/pipeline_stable_diffusion_xl_controlnet_adapter.py
...munity/pipeline_stable_diffusion_xl_controlnet_adapter.py
+6
-1
examples/community/pipeline_stable_diffusion_xl_ipex.py
examples/community/pipeline_stable_diffusion_xl_ipex.py
+6
-1
examples/community/pipeline_zero1to3.py
examples/community/pipeline_zero1to3.py
+6
-1
examples/community/stable_diffusion_controlnet_inpaint.py
examples/community/stable_diffusion_controlnet_inpaint.py
+6
-1
examples/community/stable_diffusion_ipex.py
examples/community/stable_diffusion_ipex.py
+6
-1
examples/community/stable_diffusion_reference.py
examples/community/stable_diffusion_reference.py
+6
-1
examples/research_projects/promptdiffusion/pipeline_prompt_diffusion.py
...rch_projects/promptdiffusion/pipeline_prompt_diffusion.py
+6
-1
examples/research_projects/rdm/pipeline_rdm.py
examples/research_projects/rdm/pipeline_rdm.py
+6
-1
No files found.
examples/community/composable_stable_diffusion.py
View file @
90250d9e
...
@@ -321,7 +321,12 @@ class ComposableStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin)
...
@@ -321,7 +321,12 @@ class ComposableStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin)
)
)
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
latents
is
None
:
if
latents
is
None
:
if
device
.
type
==
"mps"
:
if
device
.
type
==
"mps"
:
# randn does not work reproducibly on mps
# randn does not work reproducibly on mps
...
...
examples/community/gluegen.py
View file @
90250d9e
...
@@ -500,7 +500,12 @@ class GlueGenStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin, Lo
...
@@ -500,7 +500,12 @@ class GlueGenStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin, Lo
)
)
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/instaflow_one_step.py
View file @
90250d9e
...
@@ -468,7 +468,12 @@ class InstaFlowPipeline(
...
@@ -468,7 +468,12 @@ class InstaFlowPipeline(
)
)
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/ip_adapter_face_id.py
View file @
90250d9e
...
@@ -753,7 +753,12 @@ class IPAdapterFaceIDStableDiffusionPipeline(
...
@@ -753,7 +753,12 @@ class IPAdapterFaceIDStableDiffusionPipeline(
)
)
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/latent_consistency_img2img.py
View file @
90250d9e
...
@@ -177,7 +177,12 @@ class LatentConsistencyModelImg2ImgPipeline(DiffusionPipeline):
...
@@ -177,7 +177,12 @@ class LatentConsistencyModelImg2ImgPipeline(DiffusionPipeline):
latents
=
None
,
latents
=
None
,
generator
=
None
,
generator
=
None
,
):
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
not
isinstance
(
image
,
(
torch
.
Tensor
,
PIL
.
Image
.
Image
,
list
)):
if
not
isinstance
(
image
,
(
torch
.
Tensor
,
PIL
.
Image
.
Image
,
list
)):
raise
ValueError
(
raise
ValueError
(
...
...
examples/community/latent_consistency_interpolate.py
View file @
90250d9e
...
@@ -472,7 +472,12 @@ class LatentConsistencyModelWalkPipeline(
...
@@ -472,7 +472,12 @@ class LatentConsistencyModelWalkPipeline(
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/latent_consistency_txt2img.py
View file @
90250d9e
...
@@ -163,7 +163,12 @@ class LatentConsistencyModelPipeline(DiffusionPipeline):
...
@@ -163,7 +163,12 @@ class LatentConsistencyModelPipeline(DiffusionPipeline):
return
image
,
has_nsfw_concept
return
image
,
has_nsfw_concept
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
latents
is
None
:
if
latents
is
None
:
latents
=
torch
.
randn
(
shape
,
dtype
=
dtype
).
to
(
device
)
latents
=
torch
.
randn
(
shape
,
dtype
=
dtype
).
to
(
device
)
else
:
else
:
...
...
examples/community/lpw_stable_diffusion.py
View file @
90250d9e
...
@@ -726,7 +726,12 @@ class StableDiffusionLongPromptWeightingPipeline(
...
@@ -726,7 +726,12 @@ class StableDiffusionLongPromptWeightingPipeline(
):
):
if
image
is
None
:
if
image
is
None
:
batch_size
=
batch_size
*
num_images_per_prompt
batch_size
=
batch_size
*
num_images_per_prompt
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/lpw_stable_diffusion_xl.py
View file @
90250d9e
...
@@ -1060,7 +1060,12 @@ class SDXLLongPromptWeightingPipeline(
...
@@ -1060,7 +1060,12 @@ class SDXLLongPromptWeightingPipeline(
batch_size
*=
num_images_per_prompt
batch_size
*=
num_images_per_prompt
if
image
is
None
:
if
image
is
None
:
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
@@ -1140,7 +1145,12 @@ class SDXLLongPromptWeightingPipeline(
...
@@ -1140,7 +1145,12 @@ class SDXLLongPromptWeightingPipeline(
return
latents
return
latents
else
:
else
:
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/pipeline_demofusion_sdxl.py
View file @
90250d9e
...
@@ -477,7 +477,12 @@ class DemoFusionSDXLPipeline(
...
@@ -477,7 +477,12 @@ class DemoFusionSDXLPipeline(
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/pipeline_sdxl_style_aligned.py
View file @
90250d9e
...
@@ -919,7 +919,12 @@ class StyleAlignedSDXLPipeline(
...
@@ -919,7 +919,12 @@ class StyleAlignedSDXLPipeline(
batch_size
*=
num_images_per_prompt
batch_size
*=
num_images_per_prompt
if
image
is
None
:
if
image
is
None
:
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
@@ -999,7 +1004,12 @@ class StyleAlignedSDXLPipeline(
...
@@ -999,7 +1004,12 @@ class StyleAlignedSDXLPipeline(
return
latents
return
latents
else
:
else
:
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/pipeline_stable_diffusion_pag.py
View file @
90250d9e
...
@@ -857,7 +857,12 @@ class StableDiffusionPAGPipeline(
...
@@ -857,7 +857,12 @@ class StableDiffusionPAGPipeline(
)
)
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/pipeline_stable_diffusion_xl_controlnet_adapter.py
View file @
90250d9e
...
@@ -751,7 +751,12 @@ class StableDiffusionXLControlNetAdapterPipeline(
...
@@ -751,7 +751,12 @@ class StableDiffusionXLControlNetAdapterPipeline(
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/pipeline_stable_diffusion_xl_ipex.py
View file @
90250d9e
...
@@ -614,7 +614,12 @@ class StableDiffusionXLPipelineIpex(
...
@@ -614,7 +614,12 @@ class StableDiffusionXLPipelineIpex(
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/pipeline_zero1to3.py
View file @
90250d9e
...
@@ -497,7 +497,12 @@ class Zero1to3StableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
...
@@ -497,7 +497,12 @@ class Zero1to3StableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
)
)
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/stable_diffusion_controlnet_inpaint.py
View file @
90250d9e
...
@@ -635,7 +635,12 @@ class StableDiffusionControlNetInpaintPipeline(DiffusionPipeline, StableDiffusio
...
@@ -635,7 +635,12 @@ class StableDiffusionControlNetInpaintPipeline(DiffusionPipeline, StableDiffusio
)
)
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/stable_diffusion_ipex.py
View file @
90250d9e
...
@@ -533,7 +533,12 @@ class StableDiffusionIPEXPipeline(
...
@@ -533,7 +533,12 @@ class StableDiffusionIPEXPipeline(
)
)
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/community/stable_diffusion_reference.py
View file @
90250d9e
...
@@ -609,7 +609,12 @@ class StableDiffusionReferencePipeline(
...
@@ -609,7 +609,12 @@ class StableDiffusionReferencePipeline(
Returns:
Returns:
torch.Tensor: The prepared latent vectors.
torch.Tensor: The prepared latent vectors.
"""
"""
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/research_projects/promptdiffusion/pipeline_prompt_diffusion.py
View file @
90250d9e
...
@@ -789,7 +789,12 @@ class PromptDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
...
@@ -789,7 +789,12 @@ class PromptDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
examples/research_projects/rdm/pipeline_rdm.py
View file @
90250d9e
...
@@ -123,7 +123,12 @@ class RDMPipeline(DiffusionPipeline, StableDiffusionMixin):
...
@@ -123,7 +123,12 @@ class RDMPipeline(DiffusionPipeline, StableDiffusionMixin):
return
image_embeddings
return
image_embeddings
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
def
prepare_latents
(
self
,
batch_size
,
num_channels_latents
,
height
,
width
,
dtype
,
device
,
generator
,
latents
=
None
):
shape
=
(
batch_size
,
num_channels_latents
,
height
//
self
.
vae_scale_factor
,
width
//
self
.
vae_scale_factor
)
shape
=
(
batch_size
,
num_channels_latents
,
int
(
height
)
//
self
.
vae_scale_factor
,
int
(
width
)
//
self
.
vae_scale_factor
,
)
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
if
isinstance
(
generator
,
list
)
and
len
(
generator
)
!=
batch_size
:
raise
ValueError
(
raise
ValueError
(
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
f
"You have passed a list of generators of length
{
len
(
generator
)
}
, but requested an effective batch"
...
...
Prev
1
2
3
4
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment