declare-lab/tango2
92
1# Copyright 2023 The HuggingFace Team. All rights reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14from ..utils import deprecate15from .attention_processor import ( # noqa: F40116 Attention,17 AttentionProcessor,18 AttnAddedKVProcessor,19 AttnProcessor2_0,20 LoRAAttnProcessor,21 LoRALinearLayer,22 LoRAXFormersAttnProcessor,23 SlicedAttnAddedKVProcessor,24 SlicedAttnProcessor,25 XFormersAttnProcessor,26)27from .attention_processor import AttnProcessor as AttnProcessorRename # noqa: F40128 29 30deprecate(31 "cross_attention",32 "0.18.0",33 "Importing from cross_attention is deprecated. Please import from diffusers.models.attention_processor instead.",34 standard_warn=False,35)36 37 38AttnProcessor = AttentionProcessor39 40 41class CrossAttention(Attention):42 def __init__(self, *args, **kwargs):43 deprecation_message = f"{self.__class__.__name__} is deprecated and will be removed in `0.18.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'))} instead."44 deprecate("cross_attention", "0.18.0", deprecation_message, standard_warn=False)45 super().__init__(*args, **kwargs)46 47 48class CrossAttnProcessor(AttnProcessorRename):49 def __init__(self, *args, **kwargs):50 deprecation_message = f"{self.__class__.__name__} is deprecated and will be removed in `0.18.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'))} instead."51 deprecate("cross_attention", "0.18.0", deprecation_message, standard_warn=False)52 super().__init__(*args, **kwargs)53 54 55class LoRACrossAttnProcessor(LoRAAttnProcessor):56 def __init__(self, *args, **kwargs):57 deprecation_message = f"{self.__class__.__name__} is deprecated and will be removed in `0.18.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'))} instead."58 deprecate("cross_attention", "0.18.0", deprecation_message, standard_warn=False)59 super().__init__(*args, **kwargs)60 61 62class CrossAttnAddedKVProcessor(AttnAddedKVProcessor):63 def __init__(self, *args, **kwargs):64 deprecation_message = f"{self.__class__.__name__} is deprecated and will be removed in `0.18.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'))} instead."65 deprecate("cross_attention", "0.18.0", deprecation_message, standard_warn=False)66 super().__init__(*args, **kwargs)67 68 69class XFormersCrossAttnProcessor(XFormersAttnProcessor):70 def __init__(self, *args, **kwargs):71 deprecation_message = f"{self.__class__.__name__} is deprecated and will be removed in `0.18.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'))} instead."72 deprecate("cross_attention", "0.18.0", deprecation_message, standard_warn=False)73 super().__init__(*args, **kwargs)74 75 76class LoRAXFormersCrossAttnProcessor(LoRAXFormersAttnProcessor):77 def __init__(self, *args, **kwargs):78 deprecation_message = f"{self.__class__.__name__} is deprecated and will be removed in `0.18.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'))} instead."79 deprecate("cross_attention", "0.18.0", deprecation_message, standard_warn=False)80 super().__init__(*args, **kwargs)81 82 83class SlicedCrossAttnProcessor(SlicedAttnProcessor):84 def __init__(self, *args, **kwargs):85 deprecation_message = f"{self.__class__.__name__} is deprecated and will be removed in `0.18.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'))} instead."86 deprecate("cross_attention", "0.18.0", deprecation_message, standard_warn=False)87 super().__init__(*args, **kwargs)88 89 90class SlicedCrossAttnAddedKVProcessor(SlicedAttnAddedKVProcessor):91 def __init__(self, *args, **kwargs):92 deprecation_message = f"{self.__class__.__name__} is deprecated and will be removed in `0.18.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'))} instead."93 deprecate("cross_attention", "0.18.0", deprecation_message, standard_warn=False)94 super().__init__(*args, **kwargs)95 