Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 7.3k
Add support for Magcache #12744
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Add support for Magcache #12744
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
8dbb673
add magcache
AlanPonnachan a8a57c6
formatting
AlanPonnachan cbf4b5e
Merge branch 'main' into feat/mag-cache
AlanPonnachan a6a9fb4
add magcache support with calibration mode
AlanPonnachan bb0a069
Merge branch 'main' into feat/mag-cache
AlanPonnachan 37f8826
add imports
AlanPonnachan 0a05bec
improvements
AlanPonnachan 535a14e
Merge branch 'main' into feat/mag-cache
AlanPonnachan ebbebbe
Apply style fixes
github-actions[bot] 00e9b96
fix kandinsky errors
AlanPonnachan 3603e6c
Merge branch 'main' into feat/mag-cache
AlanPonnachan a282057
add tests and documentation
AlanPonnachan f672d37
Merge branch 'main' into feat/mag-cache
AlanPonnachan a3a9d15
Apply style fixes
github-actions[bot] 163ac73
improvements
AlanPonnachan 233e99f
Merge branch 'main' into feat/mag-cache
AlanPonnachan 2cfefb5
Merge branch 'main' into feat/mag-cache
AlanPonnachan abec8c0
Merge branch 'main' into feat/mag-cache
sayakpaul cc9685f
Apply style fixes
github-actions[bot] acc5371
Merge branch 'main' into feat/mag-cache
sayakpaul ce8c8e6
make fix-copies.
sayakpaul d60f3cb
Merge pull request #1 from huggingface/AlanPonnachan-feat/mag-cache
AlanPonnachan 6a69fcf
Merge branch 'main' into feat/mag-cache
AlanPonnachan a9d736e
Merge branch 'main' into feat/mag-cache
sayakpaul af04ddd
Merge branch 'main' into feat/mag-cache
sayakpaul 6bd5726
minor fixes
AlanPonnachan 825ecac
Merge branch 'main' into feat/mag-cache
AlanPonnachan 864fa2a
Merge branch 'main' into feat/mag-cache
sayakpaul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -26,6 +26,7 @@ class AttentionProcessorMetadata: | ||
| class TransformerBlockMetadata: | ||
| return_hidden_states_index: int = None | ||
| return_encoder_hidden_states_index: int = None | ||
| hidden_states_argument_name: str = "hidden_states" | ||
| _cls: Type = None | ||
| _cached_parameter_indices: Dict[str, int] = None | ||
| @@ -169,7 +170,7 @@ def _register_attention_processors_metadata(): | ||
| def _register_transformer_blocks_metadata(): | ||
| from ..models.attention import BasicTransformerBlock | ||
| from ..models.attention import BasicTransformerBlock, JointTransformerBlock | ||
| from ..models.transformers.cogvideox_transformer_3d import CogVideoXBlock | ||
| from ..models.transformers.transformer_bria import BriaTransformerBlock | ||
| from ..models.transformers.transformer_cogview4 import CogView4TransformerBlock | ||
| @@ -184,6 +185,7 @@ def _register_transformer_blocks_metadata(): | ||
| HunyuanImageSingleTransformerBlock, | ||
| HunyuanImageTransformerBlock, | ||
| ) | ||
| from ..models.transformers.transformer_kandinsky import Kandinsky5TransformerDecoderBlock | ||
| from ..models.transformers.transformer_ltx import LTXVideoTransformerBlock | ||
| from ..models.transformers.transformer_mochi import MochiTransformerBlock | ||
| from ..models.transformers.transformer_qwenimage import QwenImageTransformerBlock | ||
| @@ -331,6 +333,24 @@ def _register_transformer_blocks_metadata(): | ||
| ), | ||
| ) | ||
| TransformerBlockRegistry.register( | ||
| model_class=JointTransformerBlock, | ||
| metadata=TransformerBlockMetadata( | ||
| return_hidden_states_index=1, | ||
| return_encoder_hidden_states_index=0, | ||
| ), | ||
| ) | ||
sayakpaul marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # Kandinsky 5.0 (Kandinsky5TransformerDecoderBlock) | ||
| TransformerBlockRegistry.register( | ||
| model_class=Kandinsky5TransformerDecoderBlock, | ||
| metadata=TransformerBlockMetadata( | ||
| return_hidden_states_index=0, | ||
| return_encoder_hidden_states_index=None, | ||
| hidden_states_argument_name="visual_embed", | ||
| ), | ||
| ) | ||
| # fmt: off | ||
| def _skip_attention___ret___hidden_states(self, *args, **kwargs): | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.