Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
diffusers
Commits
bdd16116
Unverified
Commit
bdd16116
authored
Oct 02, 2023
by
Patrick von Platen
Committed by
GitHub
Oct 02, 2023
Browse files
[Schedulers] Fix callback steps (#5261)
* fix all * make fix copies * make fix copies
parent
c8b0f0eb
Changes
87
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
40 additions
and
20 deletions
+40
-20
examples/community/composable_stable_diffusion.py
examples/community/composable_stable_diffusion.py
+2
-1
examples/community/img2img_inpainting.py
examples/community/img2img_inpainting.py
+2
-1
examples/community/interpolate_stable_diffusion.py
examples/community/interpolate_stable_diffusion.py
+2
-1
examples/community/lpw_stable_diffusion.py
examples/community/lpw_stable_diffusion.py
+2
-1
examples/community/lpw_stable_diffusion_onnx.py
examples/community/lpw_stable_diffusion_onnx.py
+2
-1
examples/community/lpw_stable_diffusion_xl.py
examples/community/lpw_stable_diffusion_xl.py
+2
-1
examples/community/masked_stable_diffusion_img2img.py
examples/community/masked_stable_diffusion_img2img.py
+2
-1
examples/community/multilingual_stable_diffusion.py
examples/community/multilingual_stable_diffusion.py
+2
-1
examples/community/pipeline_prompt2prompt.py
examples/community/pipeline_prompt2prompt.py
+2
-1
examples/community/pipeline_zero1to3.py
examples/community/pipeline_zero1to3.py
+2
-1
examples/community/run_onnx_controlnet.py
examples/community/run_onnx_controlnet.py
+2
-1
examples/community/run_tensorrt_controlnet.py
examples/community/run_tensorrt_controlnet.py
+2
-1
examples/community/seed_resize_stable_diffusion.py
examples/community/seed_resize_stable_diffusion.py
+2
-1
examples/community/speech_to_image_diffusion.py
examples/community/speech_to_image_diffusion.py
+2
-1
examples/community/stable_diffusion_controlnet_img2img.py
examples/community/stable_diffusion_controlnet_img2img.py
+2
-1
examples/community/stable_diffusion_controlnet_inpaint.py
examples/community/stable_diffusion_controlnet_inpaint.py
+2
-1
examples/community/stable_diffusion_controlnet_inpaint_img2img.py
.../community/stable_diffusion_controlnet_inpaint_img2img.py
+2
-1
examples/community/stable_diffusion_controlnet_reference.py
examples/community/stable_diffusion_controlnet_reference.py
+2
-1
examples/community/stable_diffusion_ipex.py
examples/community/stable_diffusion_ipex.py
+2
-1
examples/community/stable_diffusion_reference.py
examples/community/stable_diffusion_reference.py
+2
-1
No files found.
examples/community/composable_stable_diffusion.py
View file @
bdd16116
...
@@ -562,7 +562,8 @@ class ComposableStableDiffusionPipeline(DiffusionPipeline):
...
@@ -562,7 +562,8 @@ class ComposableStableDiffusionPipeline(DiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
# 8. Post-processing
# 8. Post-processing
image
=
self
.
decode_latents
(
latents
)
image
=
self
.
decode_latents
(
latents
)
...
...
examples/community/img2img_inpainting.py
View file @
bdd16116
...
@@ -434,7 +434,8 @@ class ImageToImageInpaintingPipeline(DiffusionPipeline):
...
@@ -434,7 +434,8 @@ class ImageToImageInpaintingPipeline(DiffusionPipeline):
# call the callback, if provided
# call the callback, if provided
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
latents
=
1
/
0.18215
*
latents
latents
=
1
/
0.18215
*
latents
image
=
self
.
vae
.
decode
(
latents
).
sample
image
=
self
.
vae
.
decode
(
latents
).
sample
...
...
examples/community/interpolate_stable_diffusion.py
View file @
bdd16116
...
@@ -372,7 +372,8 @@ class StableDiffusionWalkPipeline(DiffusionPipeline):
...
@@ -372,7 +372,8 @@ class StableDiffusionWalkPipeline(DiffusionPipeline):
# call the callback, if provided
# call the callback, if provided
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
latents
=
1
/
0.18215
*
latents
latents
=
1
/
0.18215
*
latents
image
=
self
.
vae
.
decode
(
latents
).
sample
image
=
self
.
vae
.
decode
(
latents
).
sample
...
...
examples/community/lpw_stable_diffusion.py
View file @
bdd16116
...
@@ -1088,7 +1088,8 @@ class StableDiffusionLongPromptWeightingPipeline(
...
@@ -1088,7 +1088,8 @@ class StableDiffusionLongPromptWeightingPipeline(
progress_bar
.
update
()
progress_bar
.
update
()
if
i
%
callback_steps
==
0
:
if
i
%
callback_steps
==
0
:
if
callback
is
not
None
:
if
callback
is
not
None
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
if
is_cancelled_callback
is
not
None
and
is_cancelled_callback
():
if
is_cancelled_callback
is
not
None
and
is_cancelled_callback
():
return
None
return
None
...
...
examples/community/lpw_stable_diffusion_onnx.py
View file @
bdd16116
...
@@ -846,7 +846,8 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
...
@@ -846,7 +846,8 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
# call the callback, if provided
# call the callback, if provided
if
i
%
callback_steps
==
0
:
if
i
%
callback_steps
==
0
:
if
callback
is
not
None
:
if
callback
is
not
None
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
if
is_cancelled_callback
is
not
None
and
is_cancelled_callback
():
if
is_cancelled_callback
is
not
None
and
is_cancelled_callback
():
return
None
return
None
...
...
examples/community/lpw_stable_diffusion_xl.py
View file @
bdd16116
...
@@ -1182,7 +1182,8 @@ class SDXLLongPromptWeightingPipeline(DiffusionPipeline, FromSingleFileMixin, Lo
...
@@ -1182,7 +1182,8 @@ class SDXLLongPromptWeightingPipeline(DiffusionPipeline, FromSingleFileMixin, Lo
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
if
not
output_type
==
"latent"
:
if
not
output_type
==
"latent"
:
# make sure the VAE is in float32 mode, as it overflows in float16
# make sure the VAE is in float32 mode, as it overflows in float16
...
...
examples/community/masked_stable_diffusion_img2img.py
View file @
bdd16116
...
@@ -202,7 +202,8 @@ class MaskedStableDiffusionImg2ImgPipeline(StableDiffusionImg2ImgPipeline):
...
@@ -202,7 +202,8 @@ class MaskedStableDiffusionImg2ImgPipeline(StableDiffusionImg2ImgPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
if
not
output_type
==
"latent"
:
if
not
output_type
==
"latent"
:
scaled
=
latents
/
self
.
vae
.
config
.
scaling_factor
scaled
=
latents
/
self
.
vae
.
config
.
scaling_factor
...
...
examples/community/multilingual_stable_diffusion.py
View file @
bdd16116
...
@@ -407,7 +407,8 @@ class MultilingualStableDiffusion(DiffusionPipeline):
...
@@ -407,7 +407,8 @@ class MultilingualStableDiffusion(DiffusionPipeline):
# call the callback, if provided
# call the callback, if provided
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
latents
=
1
/
0.18215
*
latents
latents
=
1
/
0.18215
*
latents
image
=
self
.
vae
.
decode
(
latents
).
sample
image
=
self
.
vae
.
decode
(
latents
).
sample
...
...
examples/community/pipeline_prompt2prompt.py
View file @
bdd16116
...
@@ -254,7 +254,8 @@ class Prompt2PromptPipeline(StableDiffusionPipeline):
...
@@ -254,7 +254,8 @@ class Prompt2PromptPipeline(StableDiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
# 8. Post-processing
# 8. Post-processing
if
not
output_type
==
"latent"
:
if
not
output_type
==
"latent"
:
...
...
examples/community/pipeline_zero1to3.py
View file @
bdd16116
...
@@ -865,7 +865,8 @@ class Zero1to3StableDiffusionPipeline(DiffusionPipeline):
...
@@ -865,7 +865,8 @@ class Zero1to3StableDiffusionPipeline(DiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
# 8. Post-processing
# 8. Post-processing
has_nsfw_concept
=
None
has_nsfw_concept
=
None
...
...
examples/community/run_onnx_controlnet.py
View file @
bdd16116
...
@@ -815,7 +815,8 @@ class OnnxStableDiffusionControlNetImg2ImgPipeline(DiffusionPipeline):
...
@@ -815,7 +815,8 @@ class OnnxStableDiffusionControlNetImg2ImgPipeline(DiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
if
not
output_type
==
"latent"
:
if
not
output_type
==
"latent"
:
_latents
=
latents
.
cpu
().
detach
().
numpy
()
/
0.18215
_latents
=
latents
.
cpu
().
detach
().
numpy
()
/
0.18215
...
...
examples/community/run_tensorrt_controlnet.py
View file @
bdd16116
...
@@ -919,7 +919,8 @@ class TensorRTStableDiffusionControlNetImg2ImgPipeline(DiffusionPipeline):
...
@@ -919,7 +919,8 @@ class TensorRTStableDiffusionControlNetImg2ImgPipeline(DiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
if
not
output_type
==
"latent"
:
if
not
output_type
==
"latent"
:
_latents
=
latents
.
cpu
().
detach
().
numpy
()
/
0.18215
_latents
=
latents
.
cpu
().
detach
().
numpy
()
/
0.18215
...
...
examples/community/seed_resize_stable_diffusion.py
View file @
bdd16116
...
@@ -337,7 +337,8 @@ class SeedResizeStableDiffusionPipeline(DiffusionPipeline):
...
@@ -337,7 +337,8 @@ class SeedResizeStableDiffusionPipeline(DiffusionPipeline):
# call the callback, if provided
# call the callback, if provided
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
latents
=
1
/
0.18215
*
latents
latents
=
1
/
0.18215
*
latents
image
=
self
.
vae
.
decode
(
latents
).
sample
image
=
self
.
vae
.
decode
(
latents
).
sample
...
...
examples/community/speech_to_image_diffusion.py
View file @
bdd16116
...
@@ -242,7 +242,8 @@ class SpeechToImagePipeline(DiffusionPipeline):
...
@@ -242,7 +242,8 @@ class SpeechToImagePipeline(DiffusionPipeline):
# call the callback, if provided
# call the callback, if provided
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
latents
=
1
/
0.18215
*
latents
latents
=
1
/
0.18215
*
latents
image
=
self
.
vae
.
decode
(
latents
).
sample
image
=
self
.
vae
.
decode
(
latents
).
sample
...
...
examples/community/stable_diffusion_controlnet_img2img.py
View file @
bdd16116
...
@@ -951,7 +951,8 @@ class StableDiffusionControlNetImg2ImgPipeline(DiffusionPipeline):
...
@@ -951,7 +951,8 @@ class StableDiffusionControlNetImg2ImgPipeline(DiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
# If we do sequential model offloading, let's offload unet and controlnet
# If we do sequential model offloading, let's offload unet and controlnet
# manually for max memory savings
# manually for max memory savings
...
...
examples/community/stable_diffusion_controlnet_inpaint.py
View file @
bdd16116
...
@@ -1100,7 +1100,8 @@ class StableDiffusionControlNetInpaintPipeline(DiffusionPipeline):
...
@@ -1100,7 +1100,8 @@ class StableDiffusionControlNetInpaintPipeline(DiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
# If we do sequential model offloading, let's offload unet and controlnet
# If we do sequential model offloading, let's offload unet and controlnet
# manually for max memory savings
# manually for max memory savings
...
...
examples/community/stable_diffusion_controlnet_inpaint_img2img.py
View file @
bdd16116
...
@@ -1081,7 +1081,8 @@ class StableDiffusionControlNetInpaintImg2ImgPipeline(DiffusionPipeline):
...
@@ -1081,7 +1081,8 @@ class StableDiffusionControlNetInpaintImg2ImgPipeline(DiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
# If we do sequential model offloading, let's offload unet and controlnet
# If we do sequential model offloading, let's offload unet and controlnet
# manually for max memory savings
# manually for max memory savings
...
...
examples/community/stable_diffusion_controlnet_reference.py
View file @
bdd16116
...
@@ -802,7 +802,8 @@ class StableDiffusionControlNetReferencePipeline(StableDiffusionControlNetPipeli
...
@@ -802,7 +802,8 @@ class StableDiffusionControlNetReferencePipeline(StableDiffusionControlNetPipeli
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
# If we do sequential model offloading, let's offload unet and controlnet
# If we do sequential model offloading, let's offload unet and controlnet
# manually for max memory savings
# manually for max memory savings
...
...
examples/community/stable_diffusion_ipex.py
View file @
bdd16116
...
@@ -817,7 +817,8 @@ class StableDiffusionIPEXPipeline(DiffusionPipeline):
...
@@ -817,7 +817,8 @@ class StableDiffusionIPEXPipeline(DiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
if
output_type
==
"latent"
:
if
output_type
==
"latent"
:
image
=
latents
image
=
latents
...
...
examples/community/stable_diffusion_reference.py
View file @
bdd16116
...
@@ -770,7 +770,8 @@ class StableDiffusionReferencePipeline(StableDiffusionPipeline):
...
@@ -770,7 +770,8 @@ class StableDiffusionReferencePipeline(StableDiffusionPipeline):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
callback
(
i
,
t
,
latents
)
step_idx
=
i
//
getattr
(
self
.
scheduler
,
"order"
,
1
)
callback
(
step_idx
,
t
,
latents
)
if
not
output_type
==
"latent"
:
if
not
output_type
==
"latent"
:
image
=
self
.
vae
.
decode
(
latents
/
self
.
vae
.
config
.
scaling_factor
,
return_dict
=
False
)[
0
]
image
=
self
.
vae
.
decode
(
latents
/
self
.
vae
.
config
.
scaling_factor
,
return_dict
=
False
)[
0
]
...
...
Prev
1
2
3
4
5
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