





"""simple docstring"""






import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding



class 	lowerCAmelCase					(      snake_case							):

       '''simple docstring'''





       lowerCAmelCase__						 =  ["""image_processor""", """tokenizer"""]
       lowerCAmelCase__						 =  """ViTImageProcessor"""
       lowerCAmelCase__						 =  ("""CLIPTokenizer""", """CLIPTokenizerFast""")






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

              _UpperCAmelCase     =     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__(a__    ,  a__     )






       def __call__(   self    ,  a__=None    ,  a__=None    ,  a__=None    ,  a__=None    ,  **a__     ):
              if text is None and visual_prompt is None and images is None:
                     raise ValueError('You have to specify either text, visual prompt or images.'     )

              if text is not None and visual_prompt is not None:
                     raise ValueError('You have to specify exactly one type of prompt. Either text or visual prompt.'     )

              if text is not None:
                     _UpperCAmelCase     =     self.tokenizer(a__    ,  return_tensors=a__    ,  **a__     )

              if visual_prompt is not None:
                     _UpperCAmelCase     =     self.image_processor(a__    ,  return_tensors=a__    ,  **a__     )

              if images is not None:
                     _UpperCAmelCase     =     self.image_processor(a__    ,  return_tensors=a__    ,  **a__     )

              if visual_prompt is not None and images is not None:
                     _UpperCAmelCase     =     {
                         'pixel_values': image_features.pixel_values,
                         'conditional_pixel_values': prompt_features.pixel_values,
                     }
                     return encoding
              elif text is not None and images is not None:
                     _UpperCAmelCase     =     image_features.pixel_values
                     return encoding
              elif text is not None:
                     return encoding
              elif visual_prompt is not None:
                     _UpperCAmelCase     =     {
                         'conditional_pixel_values': prompt_features.pixel_values,
                     }
                     return encoding
              else:
                     return BatchEncoding(data=dict(**a__     )    ,  tensor_type=a__     )






       def 							__A (   self    ,  *a__    ,  **a__     ):
              return self.tokenizer.batch_decode(*a__    ,  **a__     )






       def 							__A (   self    ,  *a__    ,  **a__     ):
              return self.tokenizer.decode(*a__    ,  **a__     )






       @property
       def 							__A (   self     ):
              warnings.warn(
                  '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'    ,  a__    ,  )
              return self.image_processor_class






       @property
       def 							__A (   self     ):
              warnings.warn(
                  '`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'    ,  a__    ,  )
              return self.image_processor













"""simple docstring"""






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

import numpy as np
import PIL

from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available
from .timesteps import (
    fastaa_timesteps,
    smartaa_timesteps,
    smartaa_timesteps,
    smartaaa_timesteps,
    smartaaa_timesteps,
    superaa_timesteps,
    superaa_timesteps,
    superaaa_timesteps,
)



@dataclass
class 	lowerCAmelCase					(      snake_case							):
       lowerCAmelCase__						 =  42
       lowerCAmelCase__						 =  42
       lowerCAmelCase__						 =  42


try:
    if not (is_transformers_available() and is_torch_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from ...utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
    from .pipeline_if import IFPipeline
    from .pipeline_if_imgaimg import IFImgaImgPipeline
    from .pipeline_if_imgaimg_superresolution import IFImgaImgSuperResolutionPipeline
    from .pipeline_if_inpainting import IFInpaintingPipeline
    from .pipeline_if_inpainting_superresolution import IFInpaintingSuperResolutionPipeline
    from .pipeline_if_superresolution import IFSuperResolutionPipeline
    from .safety_checker import IFSafetyChecker
    from .watermark import IFWatermarker






