Unverified Commit 86294d3c authored by co63oc's avatar co63oc Committed by GitHub
Browse files

Fix typos in docs and comments (#11416)



* Fix typos in docs and comments

* Apply style fixes

---------
Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
Co-authored-by: default avatargithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
parent d70f8ee1
...@@ -739,7 +739,7 @@ class StableDiffusionControlNetXSPipeline( ...@@ -739,7 +739,7 @@ class StableDiffusionControlNetXSPipeline(
callback_on_step_end_tensor_inputs (`List`, *optional*): callback_on_step_end_tensor_inputs (`List`, *optional*):
The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list
will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the
`._callback_tensor_inputs` attribute of your pipeine class. `._callback_tensor_inputs` attribute of your pipeline class.
Examples: Examples:
Returns: Returns:
......
...@@ -880,7 +880,7 @@ class StableDiffusionXLControlNetXSPipeline( ...@@ -880,7 +880,7 @@ class StableDiffusionXLControlNetXSPipeline(
callback_on_step_end_tensor_inputs (`List`, *optional*): callback_on_step_end_tensor_inputs (`List`, *optional*):
The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list
will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the
`._callback_tensor_inputs` attribute of your pipeine class. `._callback_tensor_inputs` attribute of your pipeline class.
Examples: Examples:
......
...@@ -97,7 +97,7 @@ class DanceDiffusionPipeline(DiffusionPipeline): ...@@ -97,7 +97,7 @@ class DanceDiffusionPipeline(DiffusionPipeline):
for i, audio in enumerate(audios): for i, audio in enumerate(audios):
write(f"maestro_test_{i}.wav", pipe.unet.sample_rate, audio.transpose()) write(f"maestro_test_{i}.wav", pipe.unet.sample_rate, audio.transpose())
# To dislay in google colab # To display in google colab
import IPython.display as ipd import IPython.display as ipd
for audio in audios: for audio in audios:
......
...@@ -509,7 +509,8 @@ class StableDiffusionModelEditingPipeline( ...@@ -509,7 +509,8 @@ class StableDiffusionModelEditingPipeline(
The destination prompt. Must contain all words from `source_prompt` with additional ones to specify the The destination prompt. Must contain all words from `source_prompt` with additional ones to specify the
target edit. target edit.
lamb (`float`, *optional*, defaults to 0.1): lamb (`float`, *optional*, defaults to 0.1):
The lambda parameter specifying the regularization intesity. Smaller values increase the editing power. The lambda parameter specifying the regularization intensity. Smaller values increase the editing
power.
restart_params (`bool`, *optional*, defaults to True): restart_params (`bool`, *optional*, defaults to True):
Restart the model parameters to their pre-trained version before editing. This is done to avoid edit Restart the model parameters to their pre-trained version before editing. This is done to avoid edit
compounding. When it is `False`, edits accumulate. compounding. When it is `False`, edits accumulate.
......
...@@ -1097,7 +1097,7 @@ class UNetFlatConditionModel(ModelMixin, ConfigMixin): ...@@ -1097,7 +1097,7 @@ class UNetFlatConditionModel(ModelMixin, ConfigMixin):
cross_attention_kwargs (`dict`, *optional*): cross_attention_kwargs (`dict`, *optional*):
A kwargs dictionary that if specified is passed along to the [`AttnProcessor`]. A kwargs dictionary that if specified is passed along to the [`AttnProcessor`].
added_cond_kwargs: (`dict`, *optional*): added_cond_kwargs: (`dict`, *optional*):
A kwargs dictionary containin additional embeddings that if specified are added to the embeddings that A kwargs dictionary containing additional embeddings that if specified are added to the embeddings that
are passed along to the UNet blocks. are passed along to the UNet blocks.
down_block_additional_residuals (`tuple` of `torch.Tensor`, *optional*): down_block_additional_residuals (`tuple` of `torch.Tensor`, *optional*):
additional residuals to be added to UNet long skip connections from down blocks to up blocks for additional residuals to be added to UNet long skip connections from down blocks to up blocks for
......
...@@ -478,7 +478,7 @@ class AnimateDiffFreeNoiseMixin: ...@@ -478,7 +478,7 @@ class AnimateDiffFreeNoiseMixin:
Must be one of ["shuffle_context", "repeat_context", "random"]. Must be one of ["shuffle_context", "repeat_context", "random"].
- "shuffle_context" - "shuffle_context"
Shuffles a fixed batch of `context_length` latents to create a final latent of size Shuffles a fixed batch of `context_length` latents to create a final latent of size
`num_frames`. This is usually the best setting for most generation scenarious. However, there `num_frames`. This is usually the best setting for most generation scenarios. However, there
might be visible repetition noticeable in the kinds of motion/animation generated. might be visible repetition noticeable in the kinds of motion/animation generated.
- "repeated_context" - "repeated_context"
Repeats a fixed batch of `context_length` latents to create a final latent of size Repeats a fixed batch of `context_length` latents to create a final latent of size
......
...@@ -462,7 +462,7 @@ class I2VGenXLPipeline( ...@@ -462,7 +462,7 @@ class I2VGenXLPipeline(
image_latents = image_latents.unsqueeze(2) image_latents = image_latents.unsqueeze(2)
# Append a position mask for each subsequent frame # Append a position mask for each subsequent frame
# after the intial image latent frame # after the initial image latent frame
frame_position_mask = [] frame_position_mask = []
for frame_idx in range(num_frames - 1): for frame_idx in range(num_frames - 1):
scale = (frame_idx + 1) / (num_frames - 1) scale = (frame_idx + 1) / (num_frames - 1)
......
...@@ -496,7 +496,7 @@ class KandinskyInpaintPipeline(DiffusionPipeline): ...@@ -496,7 +496,7 @@ class KandinskyInpaintPipeline(DiffusionPipeline):
"As of diffusers==0.19.0 this behavior has been inverted. Now white pixels are repainted and black pixels are preserved. " "As of diffusers==0.19.0 this behavior has been inverted. Now white pixels are repainted and black pixels are preserved. "
"This way, Kandinsky's masking behavior is aligned with Stable Diffusion. " "This way, Kandinsky's masking behavior is aligned with Stable Diffusion. "
"THIS means that you HAVE to invert the input mask to have the same behavior as before as explained in https://github.com/huggingface/diffusers/pull/4207. " "THIS means that you HAVE to invert the input mask to have the same behavior as before as explained in https://github.com/huggingface/diffusers/pull/4207. "
"This warning will be surpressed after the first inference call and will be removed in diffusers>0.23.0" "This warning will be suppressed after the first inference call and will be removed in diffusers>0.23.0"
) )
self._warn_has_been_called = True self._warn_has_been_called = True
......
...@@ -386,7 +386,7 @@ class KandinskyV22InpaintPipeline(DiffusionPipeline): ...@@ -386,7 +386,7 @@ class KandinskyV22InpaintPipeline(DiffusionPipeline):
"As of diffusers==0.19.0 this behavior has been inverted. Now white pixels are repainted and black pixels are preserved. " "As of diffusers==0.19.0 this behavior has been inverted. Now white pixels are repainted and black pixels are preserved. "
"This way, Kandinsky's masking behavior is aligned with Stable Diffusion. " "This way, Kandinsky's masking behavior is aligned with Stable Diffusion. "
"THIS means that you HAVE to invert the input mask to have the same behavior as before as explained in https://github.com/huggingface/diffusers/pull/4207. " "THIS means that you HAVE to invert the input mask to have the same behavior as before as explained in https://github.com/huggingface/diffusers/pull/4207. "
"This warning will be surpressed after the first inference call and will be removed in diffusers>0.23.0" "This warning will be suppressed after the first inference call and will be removed in diffusers>0.23.0"
) )
self._warn_has_been_called = True self._warn_has_been_called = True
......
...@@ -668,7 +668,7 @@ class Embedding(torch.nn.Module): ...@@ -668,7 +668,7 @@ class Embedding(torch.nn.Module):
# Embeddings. # Embeddings.
words_embeddings = self.word_embeddings(input_ids) words_embeddings = self.word_embeddings(input_ids)
embeddings = words_embeddings embeddings = words_embeddings
# Data format change to avoid explicit tranposes : [b s h] --> [s b h]. # Data format change to avoid explicit transposes : [b s h] --> [s b h].
embeddings = embeddings.transpose(0, 1).contiguous() embeddings = embeddings.transpose(0, 1).contiguous()
# If the input flag for fp32 residual connection is set, convert for float. # If the input flag for fp32 residual connection is set, convert for float.
if self.fp32_residual_connection: if self.fp32_residual_connection:
......
...@@ -1458,7 +1458,7 @@ def compute_noise_ddim(scheduler, prev_latents, latents, timestep, noise_pred, e ...@@ -1458,7 +1458,7 @@ def compute_noise_ddim(scheduler, prev_latents, latents, timestep, noise_pred, e
# 6. compute "direction pointing to x_t" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf # 6. compute "direction pointing to x_t" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
pred_sample_direction = (1 - alpha_prod_t_prev - std_dev_t**2) ** (0.5) * noise_pred pred_sample_direction = (1 - alpha_prod_t_prev - std_dev_t**2) ** (0.5) * noise_pred
# modifed so that updated xtm1 is returned as well (to avoid error accumulation) # modified so that updated xtm1 is returned as well (to avoid error accumulation)
mu_xt = alpha_prod_t_prev ** (0.5) * pred_original_sample + pred_sample_direction mu_xt = alpha_prod_t_prev ** (0.5) * pred_original_sample + pred_sample_direction
if variance > 0.0: if variance > 0.0:
noise = (prev_latents - mu_xt) / (variance ** (0.5) * eta) noise = (prev_latents - mu_xt) / (variance ** (0.5) * eta)
......
...@@ -1742,7 +1742,7 @@ def compute_noise_ddim(scheduler, prev_latents, latents, timestep, noise_pred, e ...@@ -1742,7 +1742,7 @@ def compute_noise_ddim(scheduler, prev_latents, latents, timestep, noise_pred, e
# 6. compute "direction pointing to x_t" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf # 6. compute "direction pointing to x_t" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
pred_sample_direction = (1 - alpha_prod_t_prev - std_dev_t**2) ** (0.5) * noise_pred pred_sample_direction = (1 - alpha_prod_t_prev - std_dev_t**2) ** (0.5) * noise_pred
# modifed so that updated xtm1 is returned as well (to avoid error accumulation) # modified so that updated xtm1 is returned as well (to avoid error accumulation)
mu_xt = alpha_prod_t_prev ** (0.5) * pred_original_sample + pred_sample_direction mu_xt = alpha_prod_t_prev ** (0.5) * pred_original_sample + pred_sample_direction
if variance > 0.0: if variance > 0.0:
noise = (prev_latents - mu_xt) / (variance ** (0.5) * eta) noise = (prev_latents - mu_xt) / (variance ** (0.5) * eta)
......
...@@ -426,7 +426,7 @@ class MarigoldImageProcessor(ConfigMixin): ...@@ -426,7 +426,7 @@ class MarigoldImageProcessor(ConfigMixin):
if isinstance(img, np.ndarray): if isinstance(img, np.ndarray):
img = torch.from_numpy(img) img = torch.from_numpy(img)
if not torch.is_floating_point(img): if not torch.is_floating_point(img):
raise ValueError(f"{prefix}: unexected dtype={img.dtype}.") raise ValueError(f"{prefix}: unexpected dtype={img.dtype}.")
else: else:
raise ValueError(f"{prefix}: unexpected type={type(img)}.") raise ValueError(f"{prefix}: unexpected type={type(img)}.")
if val_min != 0.0 or val_max != 1.0: if val_min != 0.0 or val_max != 1.0:
...@@ -464,7 +464,7 @@ class MarigoldImageProcessor(ConfigMixin): ...@@ -464,7 +464,7 @@ class MarigoldImageProcessor(ConfigMixin):
if torch.is_tensor(img): if torch.is_tensor(img):
img = img.cpu().numpy() img = img.cpu().numpy()
if not np.issubdtype(img.dtype, np.floating): if not np.issubdtype(img.dtype, np.floating):
raise ValueError(f"{prefix}: unexected dtype={img.dtype}.") raise ValueError(f"{prefix}: unexpected dtype={img.dtype}.")
if val_min != 0.0 or val_max != 1.0: if val_min != 0.0 or val_max != 1.0:
img = (img - val_min) / (val_max - val_min) img = (img - val_min) / (val_max - val_min)
img = (img * (2**16 - 1)).astype(np.uint16) img = (img * (2**16 - 1)).astype(np.uint16)
......
...@@ -176,7 +176,7 @@ class OmniGenPipeline( ...@@ -176,7 +176,7 @@ class OmniGenPipeline(
get the continue embedding of input images by VAE get the continue embedding of input images by VAE
Args: Args:
input_pixel_values: normlized pixel of input images input_pixel_values: normalized pixel of input images
device: device:
Returns: torch.Tensor Returns: torch.Tensor
""" """
......
...@@ -115,7 +115,7 @@ EXAMPLE_DOC_STRING = """ ...@@ -115,7 +115,7 @@ EXAMPLE_DOC_STRING = """
... with torch.no_grad(), torch.autocast("cuda"): ... with torch.no_grad(), torch.autocast("cuda"):
... depth_map = depth_estimator(image).predicted_depth ... depth_map = depth_estimator(image).predicted_depth
... depth_map = torch.nn.fuctional.interpolate( ... depth_map = torch.nn.functional.interpolate(
... depth_map.unsqueeze(1), ... depth_map.unsqueeze(1),
... size=(1024, 1024), ... size=(1024, 1024),
... mode="bicubic", ... mode="bicubic",
......
...@@ -1038,7 +1038,7 @@ class ShapERenderer(ModelMixin, ConfigMixin): ...@@ -1038,7 +1038,7 @@ class ShapERenderer(ModelMixin, ConfigMixin):
textures = _convert_srgb_to_linear(textures) textures = _convert_srgb_to_linear(textures)
textures = textures.float() textures = textures.float()
# 3.3 augument the mesh with texture data # 3.3 augment the mesh with texture data
assert len(textures.shape) == 3 and textures.shape[-1] == len(texture_channels), ( assert len(textures.shape) == 3 and textures.shape[-1] == len(texture_channels), (
f"expected [meta_batch x inner_batch x texture_channels] field results, but got {textures.shape}" f"expected [meta_batch x inner_batch x texture_channels] field results, but got {textures.shape}"
) )
......
...@@ -524,9 +524,9 @@ class StableCascadeDecoderPipeline(DiffusionPipeline): ...@@ -524,9 +524,9 @@ class StableCascadeDecoderPipeline(DiffusionPipeline):
latents = self.vqgan.config.scale_factor * latents latents = self.vqgan.config.scale_factor * latents
images = self.vqgan.decode(latents).sample.clamp(0, 1) images = self.vqgan.decode(latents).sample.clamp(0, 1)
if output_type == "np": if output_type == "np":
images = images.permute(0, 2, 3, 1).cpu().float().numpy() # float() as bfloat16-> numpy doesnt work images = images.permute(0, 2, 3, 1).cpu().float().numpy() # float() as bfloat16-> numpy doesn't work
elif output_type == "pil": elif output_type == "pil":
images = images.permute(0, 2, 3, 1).cpu().float().numpy() # float() as bfloat16-> numpy doesnt work images = images.permute(0, 2, 3, 1).cpu().float().numpy() # float() as bfloat16-> numpy doesn't work
images = self.numpy_to_pil(images) images = self.numpy_to_pil(images)
else: else:
images = latents images = latents
......
...@@ -626,11 +626,11 @@ class StableCascadePriorPipeline(DiffusionPipeline): ...@@ -626,11 +626,11 @@ class StableCascadePriorPipeline(DiffusionPipeline):
self.maybe_free_model_hooks() self.maybe_free_model_hooks()
if output_type == "np": if output_type == "np":
latents = latents.cpu().float().numpy() # float() as bfloat16-> numpy doesnt work latents = latents.cpu().float().numpy() # float() as bfloat16-> numpy doesn't work
prompt_embeds = prompt_embeds.cpu().float().numpy() # float() as bfloat16-> numpy doesnt work prompt_embeds = prompt_embeds.cpu().float().numpy() # float() as bfloat16-> numpy doesn't work
negative_prompt_embeds = ( negative_prompt_embeds = (
negative_prompt_embeds.cpu().float().numpy() if negative_prompt_embeds is not None else None negative_prompt_embeds.cpu().float().numpy() if negative_prompt_embeds is not None else None
) # float() as bfloat16-> numpy doesnt work ) # float() as bfloat16-> numpy doesn't work
if not return_dict: if not return_dict:
return ( return (
......
...@@ -1047,7 +1047,7 @@ class StableDiffusionAttendAndExcitePipeline(DiffusionPipeline, StableDiffusionM ...@@ -1047,7 +1047,7 @@ class StableDiffusionAttendAndExcitePipeline(DiffusionPipeline, StableDiffusionM
class GaussianSmoothing(torch.nn.Module): class GaussianSmoothing(torch.nn.Module):
""" """
Arguments: Arguments:
Apply gaussian smoothing on a 1d, 2d or 3d tensor. Filtering is performed seperately for each channel in the input Apply gaussian smoothing on a 1d, 2d or 3d tensor. Filtering is performed separately for each channel in the input
using a depthwise convolution. using a depthwise convolution.
channels (int, sequence): Number of channels of the input tensors. Output will channels (int, sequence): Number of channels of the input tensors. Output will
have this number of channels as well. have this number of channels as well.
......
...@@ -123,7 +123,7 @@ class StableDiffusionKDiffusionPipeline( ...@@ -123,7 +123,7 @@ class StableDiffusionKDiffusionPipeline(
super().__init__() super().__init__()
logger.info( logger.info(
f"{self.__class__} is an experimntal pipeline and is likely to change in the future. We recommend to use" f"{self.__class__} is an experimental pipeline and is likely to change in the future. We recommend to use"
" this pipeline for fast experimentation / iteration if needed, but advice to rely on existing pipelines" " this pipeline for fast experimentation / iteration if needed, but advice to rely on existing pipelines"
" as defined in https://huggingface.co/docs/diffusers/api/schedulers#implemented-schedulers for" " as defined in https://huggingface.co/docs/diffusers/api/schedulers#implemented-schedulers for"
" production settings." " production settings."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment