Skip to content
Merged
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
14 changes: 5 additions & 9 deletions src/diffusers/guiders/guider_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,13 @@ def _prepare_batch(
`BaseGuidance` class. It prepares the batch based on the provided tuple index.
Args:
input_fields (`dict[str, str | tuple[str, str]]`):
A dictionary where the keys are the names of the fields that will be used to store the data once it is
prepared with `prepare_inputs`. The values can be either a string or a tuple of length 2, which is used
to look up the required data provided for preparation. If a string is provided, it will be used as the
conditional data (or unconditional if used with a guidance method that requires it). If a tuple of
length 2 is provided, the first element must be the conditional data identifier and the second element
must be the unconditional data identifier or None.
data (`BlockState`):
The input data to be prepared.
data (`dict[str, torch.Tensor | tuple[torch.Tensor, torch.Tensor]]`):
The input data to be prepared. Tensor values are used as-is, and tuple values are indexed with
`tuple_index`.
tuple_index (`int`):
The index to use when accessing input fields that are tuples.
identifier (`str`):
The identifier of the prepared batch, stored under the guider's identifier key.
Returns:
`BlockState`: The prepared batch of data.
Expand Down
1 change: 0 additions & 1 deletion src/diffusers/hooks/taylorseer_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ def _apply_taylorseer_cache_hook(
Registers the TaylorSeer hook on the specified nn.Module.
Args:
name: Name of the module.
module: The nn.Module to be hooked.
config: Cache configuration.
is_inactive: Whether this module should operate in "inactive" mode.
Expand Down
4 changes: 2 additions & 2 deletions src/diffusers/loaders/lora_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2319,11 +2319,11 @@ def save_lora_weights(
Arguments:
save_directory (`str` or `os.PathLike`):
Directory to save LoRA parameters to. Will be created if it doesn't exist.
unet_lora_layers (`dict[str, torch.nn.Module]` or `dict[str, torch.Tensor]`):
State dict of the LoRA layers corresponding to the `unet`.
text_encoder_lora_layers (`dict[str, torch.nn.Module]` or `dict[str, torch.Tensor]`):
State dict of the LoRA layers corresponding to the `text_encoder`. Must explicitly pass the text
encoder LoRA state dict because it comes from 🤗 Transformers.
transformer_lora_layers (`dict[str, torch.nn.Module]` or `dict[str, torch.Tensor]`):
State dict of the LoRA layers corresponding to the `transformer`.
is_main_process (`bool`, *optional*, defaults to `True`):
Whether the process calling this is the main process or not. Useful during distributed training and you
need to call this function on all processes. In this case, set `is_main_process=True` only on the main
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/modular_pipelines/modular_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2911,7 +2911,7 @@ def _dict_to_component_spec(name: str, spec_dict: dict[str, Any]) -> ComponentSp
Args:
name (str):
The name of the component.
specdict (dict[str, Any]):
spec_dict (dict[str, Any]):
A dictionary containing the component specification data.
Returns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,15 +650,15 @@ def get_guidance_scale_embedding(self, w, embedding_dim=512, dtype=torch.float32
See https://github.com/google-research/vdm/blob/dc27b98a554f65cdc654b800da5aa1846545d41b/model_vdm.py#L298
Args:
timesteps (`torch.Tensor`):
generate embedding vectors at these timesteps
w (`torch.Tensor`):
generate embedding vectors with a specified guidance scale to subsequently enrich timestep embeddings
embedding_dim (`int`, *optional*, defaults to 512):
dimension of the embeddings to generate
dtype:
data type of the generated embeddings
Returns:
`torch.Tensor`: Embedding vectors with shape `(len(timesteps), embedding_dim)`
`torch.Tensor`: Embedding vectors with shape `(len(w), embedding_dim)`
"""
assert len(w.shape) == 1
w = w * 1000.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,15 +722,15 @@ def get_guidance_scale_embedding(self, w, embedding_dim=512, dtype=torch.float32
See https://github.com/google-research/vdm/blob/dc27b98a554f65cdc654b800da5aa1846545d41b/model_vdm.py#L298
Args:
timesteps (`torch.Tensor`):
generate embedding vectors at these timesteps
w (`torch.Tensor`):
generate embedding vectors with a specified guidance scale to subsequently enrich timestep embeddings
embedding_dim (`int`, *optional*, defaults to 512):
dimension of the embeddings to generate
dtype:
data type of the generated embeddings
Returns:
`torch.Tensor`: Embedding vectors with shape `(len(timesteps), embedding_dim)`
`torch.Tensor`: Embedding vectors with shape `(len(w), embedding_dim)`
"""
assert len(w.shape) == 1
w = w * 1000.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ def encode_prompt(
torch device
num_videos_per_prompt (`int`):
number of images that should be generated per prompt
do_classifier_free_guidance (`bool`):
whether to use classifier free guidance or not
negative_prompt (`str` or `list[str]`, *optional*):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`negative_prompt_embeds` instead. Ignored when not using guidance (i.e., ignored if `guidance_scale` is
Expand Down
1 change: 0 additions & 1 deletion src/diffusers/pipelines/deprecated/shap_e/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ def intersect(
origin: [batch_size, *shape, 3]
direction: [batch_size, *shape, 3]
t0_lower: Optional [batch_size, *shape, 1] lower bound of t0 when intersecting this volume.
params: Optional meta parameters in case Volume is parametric
epsilon: to stabilize calculations
Return:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,6 @@ def dual_guided(
guidance_scale (`float`, *optional*, defaults to 7.5):
A higher guidance scale value encourages the model to generate images closely linked to the text
`prompt` at the expense of lower image quality. Guidance scale is enabled when `guidance_scale > 1`.
negative_prompt (`str` or `list[str]`, *optional*):
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`).
num_images_per_prompt (`int`, *optional*, defaults to 1):
The number of images to generate per prompt.
eta (`float`, *optional*, defaults to 0.0):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,6 @@ def encode_prompt(
argument.
prompt_embeds_mask (`torch.Tensor`, *optional*):
Pre-generated text mask. If not provided, text mask will be generated from `prompt` input argument.
prompt_embeds_2 (`torch.Tensor`, *optional*):
Pre-generated glyph text embeddings from ByT5. If not provided, will be generated from `prompt` input
argument using self.tokenizer_2 and self.text_encoder_2.
prompt_embeds_mask_2 (`torch.Tensor`, *optional*):
Pre-generated glyph text mask from ByT5. If not provided, will be generated from `prompt` input
argument using self.tokenizer_2 and self.text_encoder_2.
"""
device = device or self._execution_device

Expand Down
6 changes: 3 additions & 3 deletions src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,8 +1199,6 @@ def download_from_original_stable_diffusion_ckpt(
model_type (`str`, *optional*, defaults to `None`):
The pipeline type. `None` to automatically infer, or one of `["FrozenOpenCLIPEmbedder",
"FrozenCLIPEmbedder", "PaintByExample"]`.
is_img2img (`bool`, *optional*, defaults to `False`):
Whether the model should be loaded as an img2img pipeline.
extract_ema (`bool`, *optional*, defaults to `False`): Only relevant for
checkpoints that have both EMA and non-EMA weights. Whether to extract the EMA weights or not. Defaults to
`False`. Pass `True` to extract the EMA weights. EMA weights usually yield higher quality images for
Expand Down Expand Up @@ -1243,7 +1241,9 @@ def download_from_original_stable_diffusion_ckpt(
- `v2`: Config file for Stable Diffusion v2
- `xl`: Config file for Stable Diffusion XL
- `xl_refiner`: Config file for Stable Diffusion XL Refiner
return: A StableDiffusionPipeline object representing the passed-in `.ckpt`/`.safetensors` file.
Returns:
A StableDiffusionPipeline object representing the passed-in `.ckpt`/`.safetensors` file.
"""

# import pipelines here to avoid circular import error when using from_single_file method
Expand Down
3 changes: 0 additions & 3 deletions src/diffusers/quantizers/quantization_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ def to_json_file(self, json_file_path: str | os.PathLike):
Args:
json_file_path (`str` or `os.PathLike`):
Path to the JSON file in which this configuration instance's parameters will be saved.
use_diff (`bool`, *optional*, defaults to `True`):
If set to `True`, only the difference between the config instance and the default
`QuantizationConfig()` is serialized to JSON file.
"""
with open(json_file_path, "w", encoding="utf-8") as writer:
config_dict = self.to_dict()
Expand Down
4 changes: 2 additions & 2 deletions src/diffusers/utils/peft_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ def check_peft_version(min_version: str) -> None:
Checks if the version of PEFT is compatible.
Args:
version (`str`):
The version of PEFT to check against.
min_version (`str`):
The minimum version of PEFT to check against.
"""
if not is_peft_available():
raise ValueError(f"PEFT is not installed. Please install it with `pip install -U '{deps['peft']}'`")
Expand Down