Skip to content

Modify the implementation of retrieve_timesteps in CogView4-Control. #11125

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

Merged
merged 56 commits into from
Mar 23, 2025

Conversation

zRzRzRzRzRzRzR
Copy link
Contributor

Use CogView4 Models one

@@ -100,10 +100,19 @@ def retrieve_timesteps(
`Tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
second element is the number of inference steps.
"""
accepts_timesteps = "timesteps" in set(inspect.signature(scheduler.set_timesteps).parameters.keys())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update the # Copied from comment to point to CogView4 pipeline file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that how I understand it?

@@ -68,7 +68,7 @@ def calculate_shift(
return mu


# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.retrieve_timesteps
# Copied from diffusers.pipelines.cogview4.pipeline_cogview4.retrieve_timesteps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the change here is correct @zRzRzRzRzRzRzR

@@ -100,10 +100,20 @@ def retrieve_timesteps(
`Tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
second element is the number of inference steps.
"""
# Copied from diffusers.pipelines.cogview4.pipeline_cogview4.retrieve_timesteps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copied from diffusers.pipelines.cogview4.pipeline_cogview4.retrieve_timesteps

This is not needed. Please also run make fix-copies after removing this to ensure that both the implementation in this file and in pipeline_cogview4.py is the same 🤗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have completed the verification, running make fix-copies did not produce any errors or other improvement suggestions

@zRzRzRzRzRzRzR
Copy link
Contributor Author

I have completed the modification. @a-r-r-o-w can check if there are any other places that need to be modified.

Comment on lines 536 to 537
Examples:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zRzRzRzRzRzRzR These should not be removed, otherwise the tests will fail: https://github.com/huggingface/diffusers/actions/runs/14009637640/job/39228136089?pr=11125#step:15:64

Let's add this back and we should be good to merge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@HuggingFaceDocBuilderDev

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.

@a-r-r-o-w
Copy link
Member

@bot /style

Copy link
Contributor

Style fixes have been applied. View the workflow run here.

@a-r-r-o-w a-r-r-o-w merged commit 1d37f42 into huggingface:main Mar 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants