-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Base of modular backend #6606
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
RyanJDick
merged 27 commits into
invoke-ai:main
from
StAlKeR7779:stalker7779/backend_base
Jul 19, 2024
Merged
Base of modular backend #6606
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9cc852c
Base code from draft PR
StAlKeR7779 0bc6037
A bit rework conditioning convert to unet kwargs
StAlKeR7779 87e96e1
Rename modifiers to callbacks, convert order to int, a bit unify inje…
StAlKeR7779 bd8ae5d
Simplify guidance modes
StAlKeR7779 3a9dda9
Renames
StAlKeR7779 7e00526
Remove overrides logic for now
StAlKeR7779 e961dd1
Remove remains of priority logic
StAlKeR7779 499e4d4
Add preview extension to check logic
StAlKeR7779 d623bd4
Fix condtionings logic
StAlKeR7779 fd8d1c1
Remove 'del' operator overload
StAlKeR7779 9f088d1
Multiple small fixes
StAlKeR7779 608cbe3
Separate inputs in denoise context
StAlKeR7779 cec345c
Change attention processor apply logic
StAlKeR7779 b7c6c63
Added some comments
StAlKeR7779 cd1bc15
Rename sequential as private variable
StAlKeR7779 ae6d4fb
Move out _concat_conditionings_for_batch submethods
StAlKeR7779 03e22c2
Convert conditioning_mode to enum
StAlKeR7779 137202b
Remove patch_unet logic for now
StAlKeR7779 79e35bd
Minor fixes
StAlKeR7779 2c2ec8f
Comments, a bit refactor
StAlKeR7779 3f79467
Ruff format
StAlKeR7779 2ef3b49
Add run cancelling logic to extension manager
StAlKeR7779 710dc6b
Merge branch 'main' into stalker7779/backend_base
StAlKeR7779 0c56d4a
Ryan's suggested changes to extension manager/extensions
StAlKeR7779 83a86ab
Add unit tests for ExtensionsManager and ExtensionBase.
RyanJDick 39e10d8
Add invocation cancellation logic to patchers
StAlKeR7779 78d2b1b
Merge branch 'main' into stalker-backend_base
RyanJDick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass, field | ||
from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union | ||
|
||
import torch | ||
from diffusers import UNet2DConditionModel | ||
from diffusers.schedulers.scheduling_utils import SchedulerMixin, SchedulerOutput | ||
|
||
if TYPE_CHECKING: | ||
from invokeai.backend.stable_diffusion.diffusion.conditioning_data import TextConditioningData | ||
|
||
|
||
@dataclass | ||
class UNetKwargs: | ||
StAlKeR7779 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sample: torch.Tensor | ||
timestep: Union[torch.Tensor, float, int] | ||
encoder_hidden_states: torch.Tensor | ||
|
||
class_labels: Optional[torch.Tensor] = None | ||
timestep_cond: Optional[torch.Tensor] = None | ||
attention_mask: Optional[torch.Tensor] = None | ||
cross_attention_kwargs: Optional[Dict[str, Any]] = None | ||
added_cond_kwargs: Optional[Dict[str, torch.Tensor]] = None | ||
down_block_additional_residuals: Optional[Tuple[torch.Tensor]] = None | ||
mid_block_additional_residual: Optional[torch.Tensor] = None | ||
down_intrablock_additional_residuals: Optional[Tuple[torch.Tensor]] = None | ||
encoder_attention_mask: Optional[torch.Tensor] = None | ||
# return_dict: bool = True | ||
|
||
|
||
@dataclass | ||
class DenoiseContext: | ||
StAlKeR7779 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
latents: torch.Tensor | ||
scheduler_step_kwargs: dict[str, Any] | ||
conditioning_data: TextConditioningData | ||
noise: Optional[torch.Tensor] | ||
seed: int | ||
timesteps: torch.Tensor | ||
init_timestep: torch.Tensor | ||
StAlKeR7779 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
scheduler: SchedulerMixin | ||
unet: Optional[UNet2DConditionModel] = None | ||
|
||
orig_latents: Optional[torch.Tensor] = None | ||
step_index: Optional[int] = None | ||
timestep: Optional[torch.Tensor] = None | ||
unet_kwargs: Optional[UNetKwargs] = None | ||
step_output: Optional[SchedulerOutput] = None | ||
|
||
latent_model_input: Optional[torch.Tensor] = None | ||
conditioning_mode: Optional[str] = None | ||
negative_noise_pred: Optional[torch.Tensor] = None | ||
positive_noise_pred: Optional[torch.Tensor] = None | ||
noise_pred: Optional[torch.Tensor] = None | ||
|
||
extra: dict = field(default_factory=dict) | ||
|
||
def __delattr__(self, name: str): | ||
setattr(self, name, None) | ||
StAlKeR7779 marked this conversation as resolved.
Show resolved
Hide resolved
|
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
Oops, something went wrong.
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.