-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[Modular] better docstring #12932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Modular] better docstring #12932
Conversation
| ) | ||
|
|
||
| @property | ||
| def outputs(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the outputs property is only used for auto docstring rendering,
by default outputs is same as intermediate_outputs https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/modular_pipeline.py#L298
we can override here for better docstring
for example, if we want to print out the doc string for the denoise block for qwen layer model
from diffusers import ModularPipeline
pipe = ModularPipeline.from_pretrained("Qwen/Qwen-Image-Layered")
print(pipe.blocks.sub_blocks["denoise"].doc)on main it shows
class QwenImageLayeredCoreDenoiseStep
Core denoising workflow for QwenImage-Layered img2img task.
Components:
pachifier (`QwenImageLayeredPachifier`) [subfolder=]
scheduler (`FlowMatchEulerDiscreteScheduler`) [subfolder=]
guider (`ClassifierFreeGuidance`) [subfolder=]
transformer (`QwenImageTransformer2DModel`) [subfolder=]
Inputs:
num_images_per_prompt (`None`, *optional*, defaults to 1):
prompt_embeds (`None`):
prompt_embeds_mask (`None`):
negative_prompt_embeds (`None`, *optional*):
negative_prompt_embeds_mask (`None`, *optional*):
image_latents (`None`, *optional*):
latents (`None`, *optional*):
layers (`None`, *optional*, defaults to 4):
generator (`None`, *optional*):
num_inference_steps (`int`, *optional*, defaults to 50):
sigmas (`List`, *optional*):
attention_kwargs (`None`, *optional*):
**denoiser_input_fields (`None`, *optional*):
conditional model inputs for the denoiser: e.g. prompt_embeds, negative_prompt_embeds, etc.
Outputs:
batch_size (`int`):
Number of prompts, the final batch size of model inputs should be batch_size * num_images_per_prompt
dtype (`dtype`):
Data type of model tensor inputs (determined by `prompt_embeds`)
image_height (`int`):
The image height calculated from the image latents dimension
image_width (`int`):
The image width calculated from the image latents dimension
height (`int`):
The height of the image output
width (`int`):
The width of the image output
latents (`Tensor`):
The initial latents to use for the denoising process
timesteps (`Tensor`):
img_shapes (`List`):
The shapes of the image latents, used for RoPE calculation
txt_seq_lens (`List`):
The sequence lengths of the prompt embeds, used for RoPE calculation
negative_txt_seq_lens (`List`):
The sequence lengths of the negative prompt embeds, used for RoPE calculation
additional_t_cond (`Tensor`):
The additional t cond, used for RoPE calculation
with this change, in this PR branch
class QwenImageLayeredCoreDenoiseStep
Core denoising workflow for QwenImage-Layered img2img task.
Components:
pachifier (`QwenImageLayeredPachifier`) [subfolder=]
scheduler (`FlowMatchEulerDiscreteScheduler`) [subfolder=]
guider (`ClassifierFreeGuidance`) [subfolder=]
transformer (`QwenImageTransformer2DModel`) [subfolder=]
Inputs:
num_images_per_prompt (`None`, *optional*, defaults to 1):
prompt_embeds (`None`):
prompt_embeds_mask (`None`):
negative_prompt_embeds (`None`, *optional*):
negative_prompt_embeds_mask (`None`, *optional*):
image_latents (`None`, *optional*):
latents (`None`, *optional*):
layers (`None`, *optional*, defaults to 4):
generator (`None`, *optional*):
num_inference_steps (`int`, *optional*, defaults to 50):
sigmas (`List`, *optional*):
attention_kwargs (`None`, *optional*):
**denoiser_input_fields (`None`, *optional*):
conditional model inputs for the denoiser: e.g. prompt_embeds, negative_prompt_embeds, etc.
Outputs:
latents (`Tensor`):
The latents generated by the denoising step
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
No description provided.