

import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin







class 		__magic_name__    (							lowerCamelCase__							):

   '''simple docstring'''




   lowerCamelCase__				:			Union[str, Any]												=     ['image_processor', 'tokenizer']
   lowerCamelCase__				:			str												=     'AutoImageProcessor'
   lowerCamelCase__				:			Optional[int]												=     'AutoTokenizer'



   def __init__(       self,					lowercase_=None,					lowercase_=None,					**lowercase_ )							->					Tuple:






     """simple docstring"""






     a__						=None
     if "feature_extractor" in kwargs:
       warnings.warn(
           '''The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'''
           ''' instead.''',					lowercase_,					)
       a__						=kwargs.pop('''feature_extractor''' )

     a__						=image_processor if image_processor is not None else feature_extractor
     if image_processor is None:
       raise ValueError('''You need to specify an `image_processor`.''' )
     if tokenizer is None:
       raise ValueError('''You need to specify a `tokenizer`.''' )

     super().__init__(lowercase_,					lowercase_ )
     a__						=self.image_processor
     a__						=False



   def __call__(       self,					*lowercase_,					**lowercase_ )							->					str:






     """simple docstring"""






     if self._in_target_context_manager:
       return self.current_processor(*lowercase_,					**lowercase_ )

     a__						=kwargs.pop('''images''',					lowercase_ )
     a__						=kwargs.pop('''text''',					lowercase_ )
     if len(lowercase_ ) > 0:
       a__						=args[0]
       a__						=args[1:]

     if images is None and text is None:
       raise ValueError('''You need to specify either an `images` or `text` input to process.''' )

     if images is not None:
       a__						=self.image_processor(lowercase_,					*lowercase_,					**lowercase_ )
     if text is not None:
       a__						=self.tokenizer(lowercase_,					**lowercase_ )

     if text is None:
       return inputs
     elif images is None:
       return encodings
     else:
       a__						=encodings['''input_ids''']
       return inputs



   def 				_UpperCAmelCase				(       self,					*lowercase_,					**lowercase_ )							->					List[str]:






     """simple docstring"""






     return self.tokenizer.batch_decode(*lowercase_,					**lowercase_ )



   def 				_UpperCAmelCase				(       self,					*lowercase_,					**lowercase_ )							->					List[Any]:






     """simple docstring"""






     return self.tokenizer.decode(*lowercase_,					**lowercase_ )



   @contextmanager
   def 				_UpperCAmelCase				(       self )							->					Union[str, Any]:






     """simple docstring"""






     warnings.warn(
         '''`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your '''
         '''labels by using the argument `text` of the regular `__call__` method (either in the same call as '''
         '''your images inputs, or in a separate call.''' )
     a__						=True
     a__						=self.tokenizer
     yield
     a__						=self.image_processor
     a__						=False



   @property
   def 				_UpperCAmelCase				(       self )							->					List[str]:






     """simple docstring"""






     warnings.warn(
         '''`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.''',					lowercase_,					)
     return self.image_processor_class



   @property
   def 				_UpperCAmelCase				(       self )							->					Dict:






     """simple docstring"""






     warnings.warn(
         '''`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.''',					lowercase_,					)
     return self.image_processor



from dataclasses import dataclass
from typing import List, Optional, Union

import numpy as np
import PIL
from PIL import Image

from ...utils import BaseOutput, is_torch_available, is_transformers_available







@dataclass
# Copied from diffusers.pipelines.stable_diffusion.__init__.StableDiffusionPipelineOutput with Stable->Alt
class 		__magic_name__    (							lowerCamelCase__							):

   '''simple docstring'''




   lowerCamelCase__				:			Union[List[PIL.Image.Image], np.ndarray]
   lowerCamelCase__				:			Optional[List[bool]]


if is_transformers_available() and is_torch_available():
       from .modeling_roberta_series import RobertaSeriesModelWithTransformation
       from .pipeline_alt_diffusion import AltDiffusionPipeline
       from .pipeline_alt_diffusion_imgaimg import AltDiffusionImgaImgPipeline
