From 4a93b9653eb040b29776335fd3ca8f53de9c1b8b Mon Sep 17 00:00:00 2001 From: Ishtiaq Ahmed Date: Wed, 2 Dec 2026 15:09:37 +0500 Subject: [PATCH] Fix docstring parameters that functions don't take --- src/diffusers/guiders/guider_utils.py | 14 +++++--------- src/diffusers/hooks/taylorseer_cache.py | 1 - src/diffusers/loaders/lora_pipeline.py | 4 ++-- .../modular_pipelines/modular_pipeline.py | 2 +- .../alt_diffusion/pipeline_alt_diffusion.py | 6 +++--- .../pipeline_alt_diffusion_img2img.py | 6 +++--- .../deprecated/i2vgen_xl/pipeline_i2vgen_xl.py | 2 -- .../pipelines/deprecated/shap_e/renderer.py | 1 - .../pipeline_versatile_diffusion.py | 3 --- .../hunyuan_image/pipeline_hunyuanimage_refiner.py | 6 ------ .../stable_diffusion/convert_from_ckpt.py | 6 +++--- src/diffusers/quantizers/quantization_config.py | 3 --- src/diffusers/utils/peft_utils.py | 4 ++-- 13 files changed, 19 insertions(+), 39 deletions(-) diff --git a/src/diffusers/guiders/guider_utils.py b/src/diffusers/guiders/guider_utils.py index 4af7abbe212e..302ec0cdc7b3 100644 --- a/src/diffusers/guiders/guider_utils.py +++ b/src/diffusers/guiders/guider_utils.py @@ -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. diff --git a/src/diffusers/hooks/taylorseer_cache.py b/src/diffusers/hooks/taylorseer_cache.py index 21367a2b8358..110cdf605f79 100644 --- a/src/diffusers/hooks/taylorseer_cache.py +++ b/src/diffusers/hooks/taylorseer_cache.py @@ -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. diff --git a/src/diffusers/loaders/lora_pipeline.py b/src/diffusers/loaders/lora_pipeline.py index ab690d209477..a566bf4ce496 100644 --- a/src/diffusers/loaders/lora_pipeline.py +++ b/src/diffusers/loaders/lora_pipeline.py @@ -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 diff --git a/src/diffusers/modular_pipelines/modular_pipeline.py b/src/diffusers/modular_pipelines/modular_pipeline.py index fe10d3d9f433..dfa700af4765 100644 --- a/src/diffusers/modular_pipelines/modular_pipeline.py +++ b/src/diffusers/modular_pipelines/modular_pipeline.py @@ -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: diff --git a/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py b/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py index d69bcc4424d0..b4fb2f227224 100644 --- a/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py +++ b/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py @@ -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 diff --git a/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py b/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py index 8d6862f433a6..90ca465d45ca 100644 --- a/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py +++ b/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py @@ -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 diff --git a/src/diffusers/pipelines/deprecated/i2vgen_xl/pipeline_i2vgen_xl.py b/src/diffusers/pipelines/deprecated/i2vgen_xl/pipeline_i2vgen_xl.py index 7712743e6bdd..c6b458f0941c 100644 --- a/src/diffusers/pipelines/deprecated/i2vgen_xl/pipeline_i2vgen_xl.py +++ b/src/diffusers/pipelines/deprecated/i2vgen_xl/pipeline_i2vgen_xl.py @@ -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 diff --git a/src/diffusers/pipelines/deprecated/shap_e/renderer.py b/src/diffusers/pipelines/deprecated/shap_e/renderer.py index 73e913ed4380..0a934206ee93 100644 --- a/src/diffusers/pipelines/deprecated/shap_e/renderer.py +++ b/src/diffusers/pipelines/deprecated/shap_e/renderer.py @@ -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: diff --git a/src/diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion.py b/src/diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion.py index 101a1b72e7f9..64615c91f310 100644 --- a/src/diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion.py +++ b/src/diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion.py @@ -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): diff --git a/src/diffusers/pipelines/hunyuan_image/pipeline_hunyuanimage_refiner.py b/src/diffusers/pipelines/hunyuan_image/pipeline_hunyuanimage_refiner.py index 3729df8e8893..67c775c58385 100644 --- a/src/diffusers/pipelines/hunyuan_image/pipeline_hunyuanimage_refiner.py +++ b/src/diffusers/pipelines/hunyuan_image/pipeline_hunyuanimage_refiner.py @@ -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 diff --git a/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py b/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py index 820ffe4e121f..42189bff0ae3 100644 --- a/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py +++ b/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py @@ -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 @@ -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 diff --git a/src/diffusers/quantizers/quantization_config.py b/src/diffusers/quantizers/quantization_config.py index 5e3b0c018b35..289763f1037a 100644 --- a/src/diffusers/quantizers/quantization_config.py +++ b/src/diffusers/quantizers/quantization_config.py @@ -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() diff --git a/src/diffusers/utils/peft_utils.py b/src/diffusers/utils/peft_utils.py index 7e3f865d6cef..08c2b02a3ffc 100644 --- a/src/diffusers/utils/peft_utils.py +++ b/src/diffusers/utils/peft_utils.py @@ -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']}'`")