


import copy

from transformers.configuration_utils import PretrainedConfig
from transformers.utils import logging


SCREAMING_SNAKE_CASE				:						List[Any]			   = logging.get_logger(__name__)






class    UpperCamelCase    (						SCREAMING_SNAKE_CASE_   ):


   '''simple docstring'''







   lowercase    :		Tuple	  ="hybrid-clip"
   lowercase    :		Optional[Any]	  =True
   def __init__(   self      ,							UpperCamelCase_=512      ,							**UpperCamelCase_						):
        super().__init__(**lowercase_						)

        if "text_config" not in kwargs:
             raise ValueError('''`text_config` can not be `None`.'''						)

        if "vision_config" not in kwargs:
             raise ValueError('''`vision_config` can not be `None`.'''						)

        lowercase_				:int       			=				kwargs.pop('''text_config'''						)
        lowercase_				:Any       			=				kwargs.pop('''vision_config'''						)

        lowercase_				:int       			=				text_config.pop('''model_type'''						)
        lowercase_				:Tuple       			=				vision_config.pop('''model_type'''						)

        from transformers import AutoConfig

        lowercase_				:Optional[Any]       			=				AutoConfig.for_model(lowercase_      ,							**lowercase_						)

        if vision_model_type == "clip":
             lowercase_				:str       			=				AutoConfig.for_model(lowercase_      ,							**lowercase_						).vision_config
        elif vision_model_type == "clip_vision_model":
             from transformers import CLIPVisionConfig

             lowercase_				:List[str]       			=				CLIPVisionConfig(**lowercase_						)
        else:
             lowercase_				:Any       			=				AutoConfig.for_model(lowercase_      ,							**lowercase_						)

        lowercase_				:Optional[int]       			=				projection_dim
        lowercase_				:Dict       			=				1.0
   @classmethod
   def 						UpperCamelCase     (   cls      ,							UpperCamelCase_      ,							UpperCamelCase_      ,							**UpperCamelCase_						):
        return cls(text_config=text_config.to_dict()      ,							vision_config=vision_config.to_dict()      ,							**lowercase_						)




   def 						UpperCamelCase     (   self						):
        lowercase_				:Tuple       			=				copy.deepcopy(self.__dict__						)
        lowercase_				:Any       			=				self.text_config.to_dict()
        lowercase_				:str       			=				self.vision_config.to_dict()
        lowercase_				:int       			=				self.__class__.model_type
        return output



"""simple docstring"""

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

import numpy as np
import PIL
from PIL import Image

from ...utils import is_torch_available, is_transformers_available


if is_transformers_available() and is_torch_available():
   from .image_encoder import PaintByExampleImageEncoder
   from .pipeline_paint_by_example import PaintByExamplePipeline



