Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/diffusers/pipelines/controlnet/pipeline_controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down Expand Up @@ -1060,6 +1062,8 @@ def __call__(
xm.mark_step()

if not output_type == "latent":
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents / self.vae.config.scaling_factor, return_dict=False, generator=generator)[
0
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ def decode_latents(self, latents):
deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False)

latents = 1 / self.vae.config.scaling_factor * latents
if torch.cuda.is_available() and torch.version.hip:
latents = latents.to(dtype=self.vae.dtype)
image = self.vae.decode(latents, return_dict=False)[0]
image = (image / 2 + 0.5).clamp(0, 1)
# we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
Expand Down