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

[Feature] Add Attention Injection for unet #1895

Merged
merged 9 commits into from
Jun 13, 2023

Conversation

liuwenran
Copy link
Collaborator

@liuwenran liuwenran commented Jun 9, 2023

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

Please briefly describe what modification is made in this PR.

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

add config in
configs/controlnet_animation/anythingv3_config.py

# method type : 'multi-frame rendering' or 'attention_injection'
inference_method = 'attention_injection'

and perform inference

from mmagic.apis import MMagicInferencer

# Create a MMEdit instance and infer
editor = MMagicInferencer(model_name='controlnet_animation')

prompt = 'your_prompt'
negative_prompt = 'your_negative_prompt'
video = 'your_video_path'
save_path = 'your_save_path'

editor.infer(
    video=video,
    prompt=prompt,
    negative_prompt=negative_prompt,
    controlnet_conditioning_scale=0.7,
    image_width=512,
    image_height=512,
    save_path=save_path,
    output_fps=10,)

Checklist

Before PR:

  • I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
  • Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
  • New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, including docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with some of those projects.
  • CLA has been signed and all committers have signed the CLA in this PR.

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Patch coverage: 9.39% and project coverage change: -0.31 ⚠️

Comparison is base (ac6cb54) 82.95% compared to head (765e4c6) 82.65%.

❗ Current head 765e4c6 differs from pull request most recent head d363657. Consider uploading reports for the commit d363657 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1895      +/-   ##
==========================================
- Coverage   82.95%   82.65%   -0.31%     
==========================================
  Files         412      413       +1     
  Lines       27673    27784     +111     
  Branches     4332     4361      +29     
==========================================
+ Hits        22956    22964       +8     
- Misses       3774     3876     +102     
- Partials      943      944       +1     
Flag Coverage Δ
unittests 82.65% <9.39%> (-0.31%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...pis/inferencers/controlnet_animation_inferencer.py 15.48% <0.00%> (-4.03%) ⬇️
mmagic/models/editors/controlnet/controlnet.py 48.35% <13.33%> (-1.82%) ⬇️
mmagic/models/archs/attention_injection.py 15.38% <15.38%> (ø)
mmagic/__init__.py 82.75% <100.00%> (-13.80%) ⬇️
mmagic/models/archs/__init__.py 93.02% <100.00%> (+0.16%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Z-Fran Z-Fran self-requested a review June 13, 2023 07:24
@liuwenran liuwenran merged commit ad442dd into open-mmlab:main Jun 13, 2023
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.

2 participants