|  | 
| 12 | 12 | # See the License for the specific language governing permissions and | 
| 13 | 13 | # limitations under the License. | 
| 14 | 14 | 
 | 
| 15 |  | -from typing import Any, Callable, Dict, List, Optional, Tuple, Union | 
|  | 15 | +from typing import Callable, Dict, Optional, Tuple, Union | 
| 16 | 16 | 
 | 
| 17 | 17 | import torch | 
| 18 | 18 | import torch.nn as nn | 
| 19 | 19 | import torch.nn.functional as F | 
| 20 | 20 | 
 | 
| 21 |  | -from ..utils import deprecate, logging | 
|  | 21 | +from ..utils import logging | 
| 22 | 22 | from ..utils.import_utils import is_torch_npu_available, is_torch_xla_available, is_xformers_available | 
| 23 |  | -from ..utils.torch_utils import maybe_allow_in_graph | 
| 24 |  | -from .activations import GEGLU, GELU, ApproximateGELU, FP32SiLU, LinearActivation, SwiGLU | 
| 25 |  | -from .attention_processor import Attention, AttentionProcessor, JointAttnProcessor2_0 | 
| 26 |  | -from .embeddings import SinusoidalPositionalEmbedding | 
| 27 |  | -from .normalization import AdaLayerNorm, AdaLayerNormContinuous, AdaLayerNormZero, RMSNorm, SD35AdaLayerNormZeroX | 
|  | 23 | +from .attention_processor import AttentionProcessor | 
| 28 | 24 | 
 | 
| 29 | 25 | 
 | 
| 30 | 26 | if is_xformers_available(): | 
| @@ -511,78 +507,130 @@ def norm_encoder_hidden_states(self, encoder_hidden_states: torch.Tensor) -> tor | 
| 511 | 507 | 
 | 
| 512 | 508 | def _chunked_feed_forward(*args, **kwargs): | 
| 513 | 509 |     """Backward compatibility stub. Use transformers.modeling_common._chunked_feed_forward instead.""" | 
|  | 510 | +    logger.warning( | 
|  | 511 | +        "Importing `_chunked_feed_forward` from `diffusers.models.attention` is deprecated and will be removed in a future version. " | 
|  | 512 | +        "Please use `from diffusers.models.transformers.modeling_common import _chunked_feed_forward` instead." | 
|  | 513 | +    ) | 
| 514 | 514 |     from .transformers.modeling_common import _chunked_feed_forward as _actual_chunked_feed_forward | 
|  | 515 | + | 
| 515 | 516 |     return _actual_chunked_feed_forward(*args, **kwargs) | 
| 516 | 517 | 
 | 
| 517 | 518 | 
 | 
| 518 | 519 | class GatedSelfAttentionDense: | 
| 519 | 520 |     r""" | 
| 520 | 521 |     Backward compatibility stub. Use transformers.modeling_common.GatedSelfAttentionDense instead. | 
| 521 | 522 |     """ | 
|  | 523 | + | 
| 522 | 524 |     def __new__(cls, *args, **kwargs): | 
|  | 525 | +        logger.warning( | 
|  | 526 | +            "Importing `GatedSelfAttentionDense` from `diffusers.models.attention` is deprecated and will be removed in a future version. " | 
|  | 527 | +            "Please use `from diffusers.models.transformers.modeling_common import GatedSelfAttentionDense` instead." | 
|  | 528 | +        ) | 
| 523 | 529 |         from .transformers.modeling_common import GatedSelfAttentionDense | 
|  | 530 | + | 
| 524 | 531 |         return GatedSelfAttentionDense(*args, **kwargs) | 
| 525 | 532 | 
 | 
| 526 | 533 | 
 | 
| 527 | 534 | class JointTransformerBlock: | 
| 528 | 535 |     r""" | 
| 529 | 536 |     Backward compatibility stub. Use transformers.modeling_common.JointTransformerBlock instead. | 
| 530 | 537 |     """ | 
|  | 538 | + | 
| 531 | 539 |     def __new__(cls, *args, **kwargs): | 
|  | 540 | +        logger.warning( | 
|  | 541 | +            "Importing `JointTransformerBlock` from `diffusers.models.attention` is deprecated and will be removed in a future version. " | 
|  | 542 | +            "Please use `from diffusers.models.transformers.modeling_common import JointTransformerBlock` instead." | 
|  | 543 | +        ) | 
| 532 | 544 |         from .transformers.modeling_common import JointTransformerBlock | 
|  | 545 | + | 
| 533 | 546 |         return JointTransformerBlock(*args, **kwargs) | 
| 534 | 547 | 
 | 
| 535 | 548 | 
 | 
| 536 | 549 | class BasicTransformerBlock: | 
| 537 | 550 |     r""" | 
| 538 | 551 |     Backward compatibility stub. Use transformers.modeling_common.BasicTransformerBlock instead. | 
| 539 | 552 |     """ | 
|  | 553 | + | 
| 540 | 554 |     def __new__(cls, *args, **kwargs): | 
|  | 555 | +        logger.warning( | 
|  | 556 | +            "Importing `BasicTransformerBlock` from `diffusers.models.attention` is deprecated and will be removed in a future version. " | 
|  | 557 | +            "Please use `from diffusers.models.transformers.modeling_common import BasicTransformerBlock` instead." | 
|  | 558 | +        ) | 
| 541 | 559 |         from .transformers.modeling_common import BasicTransformerBlock | 
|  | 560 | + | 
| 542 | 561 |         return BasicTransformerBlock(*args, **kwargs) | 
| 543 | 562 | 
 | 
| 544 | 563 | 
 | 
| 545 | 564 | class LuminaFeedForward: | 
| 546 | 565 |     r""" | 
| 547 | 566 |     Backward compatibility stub. Use transformers.modeling_common.LuminaFeedForward instead. | 
| 548 | 567 |     """ | 
|  | 568 | + | 
| 549 | 569 |     def __new__(cls, *args, **kwargs): | 
|  | 570 | +        logger.warning( | 
|  | 571 | +            "Importing `LuminaFeedForward` from `diffusers.models.attention` is deprecated and will be removed in a future version. " | 
|  | 572 | +            "Please use `from diffusers.models.transformers.modeling_common import LuminaFeedForward` instead." | 
|  | 573 | +        ) | 
| 550 | 574 |         from .transformers.modeling_common import LuminaFeedForward | 
|  | 575 | + | 
| 551 | 576 |         return LuminaFeedForward(*args, **kwargs) | 
| 552 | 577 | 
 | 
| 553 | 578 | 
 | 
| 554 | 579 | class TemporalBasicTransformerBlock: | 
| 555 | 580 |     r""" | 
| 556 | 581 |     Backward compatibility stub. Use transformers.modeling_common.TemporalBasicTransformerBlock instead. | 
| 557 | 582 |     """ | 
|  | 583 | + | 
| 558 | 584 |     def __new__(cls, *args, **kwargs): | 
|  | 585 | +        logger.warning( | 
|  | 586 | +            "Importing `TemporalBasicTransformerBlock` from `diffusers.models.attention` is deprecated and will be removed in a future version. " | 
|  | 587 | +            "Please use `from diffusers.models.transformers.modeling_common import TemporalBasicTransformerBlock` instead." | 
|  | 588 | +        ) | 
| 559 | 589 |         from .transformers.modeling_common import TemporalBasicTransformerBlock | 
|  | 590 | + | 
| 560 | 591 |         return TemporalBasicTransformerBlock(*args, **kwargs) | 
| 561 | 592 | 
 | 
| 562 | 593 | 
 | 
| 563 | 594 | class SkipFFTransformerBlock: | 
| 564 | 595 |     r""" | 
| 565 | 596 |     Backward compatibility stub. Use transformers.modeling_common.SkipFFTransformerBlock instead. | 
| 566 | 597 |     """ | 
|  | 598 | + | 
| 567 | 599 |     def __new__(cls, *args, **kwargs): | 
|  | 600 | +        logger.warning( | 
|  | 601 | +            "Importing `SkipFFTransformerBlock` from `diffusers.models.attention` is deprecated and will be removed in a future version. " | 
|  | 602 | +            "Please use `from diffusers.models.transformers.modeling_common import SkipFFTransformerBlock` instead." | 
|  | 603 | +        ) | 
| 568 | 604 |         from .transformers.modeling_common import SkipFFTransformerBlock | 
|  | 605 | + | 
| 569 | 606 |         return SkipFFTransformerBlock(*args, **kwargs) | 
| 570 | 607 | 
 | 
| 571 | 608 | 
 | 
| 572 | 609 | class FreeNoiseTransformerBlock: | 
| 573 | 610 |     r""" | 
| 574 | 611 |     Backward compatibility stub. Use transformers.modeling_common.FreeNoiseTransformerBlock instead. | 
| 575 | 612 |     """ | 
|  | 613 | + | 
| 576 | 614 |     def __new__(cls, *args, **kwargs): | 
|  | 615 | +        logger.warning( | 
|  | 616 | +            "Importing `FreeNoiseTransformerBlock` from `diffusers.models.attention` is deprecated and will be removed in a future version. " | 
|  | 617 | +            "Please use `from diffusers.models.transformers.modeling_common import FreeNoiseTransformerBlock` instead." | 
|  | 618 | +        ) | 
| 577 | 619 |         from .transformers.modeling_common import FreeNoiseTransformerBlock | 
| 578 |  | -        return FreeNoiseTransformerBlock(*args, **kwargs) | 
| 579 | 620 | 
 | 
|  | 621 | +        return FreeNoiseTransformerBlock(*args, **kwargs) | 
| 580 | 622 | 
 | 
| 581 | 623 | 
 | 
| 582 | 624 | class FeedForward: | 
| 583 | 625 |     r""" | 
| 584 | 626 |     Backward compatibility stub. Use transformers.modeling_common.FeedForward instead. | 
| 585 | 627 |     """ | 
|  | 628 | + | 
| 586 | 629 |     def __new__(cls, *args, **kwargs): | 
|  | 630 | +        logger.warning( | 
|  | 631 | +            "Importing `FeedForward` from `diffusers.models.attention` is deprecated and will be removed in a future version. " | 
|  | 632 | +            "Please use `from diffusers.models.transformers.modeling_common import FeedForward` instead." | 
|  | 633 | +        ) | 
| 587 | 634 |         from .transformers.modeling_common import FeedForward | 
|  | 635 | + | 
| 588 | 636 |         return FeedForward(*args, **kwargs) | 
0 commit comments