Skip to content
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

Add pipeline_stable_diffusion_xl_attentive_eraser #10579

Merged
merged 9 commits into from
Jan 24, 2025

Conversation

Anonym0u3
Copy link
Contributor

What does this PR do?

add pipeline_stable_diffusion_xl_attentive_eraser
#10415
@hlky

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

Copy link
Collaborator

@hlky hlky left a comment

Choose a reason for hiding this comment

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

Thanks @Anonym0u3. Could you run make style?

@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.

@Anonym0u3
Copy link
Contributor Author

Hi @hlky , I sincerely apologize for missing the code style check. I have now run blackisort and flake8 tools to check and update the code style. If there are any additional issues or further adjustments needed, please let me know, and I’ll address them promptly.
Additionally can you help me upload the example images here so that I can use the image link in the usage documentation, thanks!

Thanks @Anonym0u3. Could you run make style?

@hlky
Copy link
Collaborator

hlky commented Jan 14, 2025

We use ruff, generally for contributing we recommend using a venv and doing pip install -e ".[dev]", then there is a Makefile with style, fix-copies etc.

You can also do pip install ruff==0.1.5 then ruff check examples scripts src tests utils benchmarks setup.py --fix --unsafe-fixes.

Can we add the example output to the Hub PR/docs?

@Anonym0u3
Copy link
Contributor Author

@hlky Thank you for your detailed instructions! I have successfully run make style as recommended and updated the example output in the documentation.

Anonym0u3 and others added 2 commits January 16, 2025 22:00
Co-authored-by: Other Contributor <[email protected]>
Co-authored-by: Other Contributor <[email protected]>
@Anonym0u3
Copy link
Contributor Author

Hi @hlky , I’m excited to share that my paper has been accepted as an Oral presentation at AAAI 2025! To reflect this update, I’ve submitted a new PR with the relevant documentation changes. Please let me know if there are any additional adjustments needed or if you have any feedback on the code. Looking forward to your review!

@Anonym0u3 Anonym0u3 requested a review from hlky January 24, 2025 11:34
Copy link
Collaborator

@hlky hlky left a comment

Choose a reason for hiding this comment

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

Thanks @Anonym0u3

logger = logging.get_logger(__name__) # pylint: disable=invalid-name


EXAMPLE_DOC_STRING = """
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we change this to the example from the docs?

Comment on lines 177 to 179
print("AAS at denoising steps: ", self.step_idx)
print("AAS at U-Net layers: ", self.layer_idx)
print("start AAS")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
print("AAS at denoising steps: ", self.step_idx)
print("AAS at U-Net layers: ", self.layer_idx)
print("start AAS")

"""
if is_cross or self.cur_step not in self.step_idx or self.cur_att_layer // 2 not in self.layer_idx:
return super().forward(q, k, v, sim, attn, is_cross, place_in_unet, num_heads, **kwargs)
# B = q.shape[0] // num_heads // 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# B = q.shape[0] // num_heads // 2

return super().forward(q, k, v, sim, attn, is_cross, place_in_unet, num_heads, **kwargs)
# B = q.shape[0] // num_heads // 2
H = int(np.sqrt(q.shape[1]))
# H = W = int(np.sqrt(q.shape[1]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# H = W = int(np.sqrt(q.shape[1]))

Comment on lines 320 to 326
# checkpoint. TOD(Yiyi) - need to clean this up later
deprecation_message = "The prepare_mask_and_masked_image method is deprecated and will be removed in a future version. Please use VaeImageProcessor.preprocess instead"
deprecate(
"prepare_mask_and_masked_image",
"0.30.0",
deprecation_message,
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# checkpoint. TOD(Yiyi) - need to clean this up later
deprecation_message = "The prepare_mask_and_masked_image method is deprecated and will be removed in a future version. Please use VaeImageProcessor.preprocess instead"
deprecate(
"prepare_mask_and_masked_image",
"0.30.0",
deprecation_message,
)

This function is still used in other community examples so it's ok to remove the deprecation message here. Alternatively refactor to use VaeImageProcessor.preprocess.

Co-authored-by: Other Contributor <[email protected]>
@Anonym0u3
Copy link
Contributor Author

Hi, @hlky, I sincerely apologize for the delay caused by my oversight last week in not submitting the review request on time. As a beginner, I truly appreciate your patience and understanding throughout this process.

I’ve carefully reviewed your feedback and have addressed all the suggested changes in a new commit. Please let me know if there’s anything else I need to do before this PR can be merged into the main codebase.

Once again, thank you so much for your valuable feedback and guidance!

@Anonym0u3 Anonym0u3 requested a review from hlky January 24, 2025 13:11
@hlky
Copy link
Collaborator

hlky commented Jan 24, 2025

Should be good to go after CI passes. Can you run make style again?

Co-authored-by: Other Contributor <[email protected]>
@Anonym0u3
Copy link
Contributor Author

Thanks. I checked the code and ran the make style again.

Copy link
Collaborator

@hlky hlky left a comment

Choose a reason for hiding this comment

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

Thanks @Anonym0u3

@hlky hlky merged commit 87252d8 into huggingface:main Jan 24, 2025
9 checks passed
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.

3 participants