


"""simple docstring"""




import copy
import os
from typing import TYPE_CHECKING, List, Union


if TYPE_CHECKING:
					pass

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


__magic_name__						: Union[str, Any]    =				logging.get_logger(__name__)

__magic_name__						: Any    =				{
    'kakaobrain/align-base': 'https://huggingface.co/kakaobrain/align-base/resolve/main/config.json',
}




class 			__snake_case   (lowerCamelCase  ):
							__a					 =       '''align_text_model'''




							def __init__(     self:    str     ,							A_:    Any=3_05_22     ,							A_:    str=7_68     ,							A_:    Any=12     ,							A_:    Optional[Any]=12     ,							A_:    Union[str, Any]=30_72     ,							A_:    str="gelu"     ,							A_:    int=0.1     ,							A_:    Optional[int]=0.1     ,							A_:    str=5_12     ,							A_:    List[str]=2     ,							A_:    Optional[Any]=0.02     ,							A_:    Dict=1E-12     ,							A_:    List[Any]=0     ,							A_:    Any="absolute"     ,							A_:    str=True     ,							**A_:    Optional[Any]     ,							):
										super().__init__(**A_   )

										__lowerCamelCase          =      vocab_size
										__lowerCamelCase          =      hidden_size
										__lowerCamelCase          =      num_hidden_layers
										__lowerCamelCase          =      num_attention_heads
										__lowerCamelCase          =      hidden_act
										__lowerCamelCase          =      intermediate_size
										__lowerCamelCase          =      hidden_dropout_prob
										__lowerCamelCase          =      attention_probs_dropout_prob
										__lowerCamelCase          =      max_position_embeddings
										__lowerCamelCase          =      type_vocab_size
										__lowerCamelCase          =      initializer_range
										__lowerCamelCase          =      layer_norm_eps
										__lowerCamelCase          =      position_embedding_type
										__lowerCamelCase          =      use_cache
										__lowerCamelCase          =      pad_token_id




							@classmethod
							def   __a   (     cls:    Dict     ,							A_:    Union[str, os.PathLike]     ,							**A_:    Optional[int]   ):
										cls._set_token_in_kwargs(A_   )

										__lowerCamelCase     ,__lowerCamelCase          =      cls.get_config_dict(A_     ,							**A_   )

										# get the text config dict if we are loading from AlignConfig
										if config_dict.get("""model_type"""   ) == "align":
													__lowerCamelCase          =      config_dict["""text_config"""]

										if "model_type" in config_dict and hasattr(cls     ,							"""model_type"""   ) and config_dict["model_type"] != cls.model_type:
													logger.warning(
													    f'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
													    f'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'   )

										return cls.from_dict(A_     ,							**A_   )




class 			__snake_case   (lowerCamelCase  ):
							__a					 =       '''align_vision_model'''




							def __init__(     self:    Dict     ,							A_:    int = 3     ,							A_:    int = 6_00     ,							A_:    float = 2.0     ,							A_:    float = 3.1     ,							A_:    int = 8     ,							A_:    List[int] = [3, 3, 5, 3, 5, 5, 3]     ,							A_:    List[int] = [32, 16, 24, 40, 80, 1_12, 1_92]     ,							A_:    List[int] = [16, 24, 40, 80, 1_12, 1_92, 3_20]     ,							A_:    List[int] = []     ,							A_:    List[int] = [1, 2, 2, 2, 1, 2, 1]     ,							A_:    List[int] = [1, 2, 2, 3, 3, 4, 1]     ,							A_:    List[int] = [1, 6, 6, 6, 6, 6, 6]     ,							A_:    float = 0.25     ,							A_:    str = "swish"     ,							A_:    int = 25_60     ,							A_:    str = "mean"     ,							A_:    float = 0.02     ,							A_:    float = 0.001     ,							A_:    float = 0.99     ,							A_:    float = 0.2     ,							**A_:    List[str]     ,							):
										super().__init__(**A_   )

										__lowerCamelCase          =      num_channels
										__lowerCamelCase          =      image_size
										__lowerCamelCase          =      width_coefficient
										__lowerCamelCase          =      depth_coefficient
										__lowerCamelCase          =      depth_divisor
										__lowerCamelCase          =      kernel_sizes
										__lowerCamelCase          =      in_channels
										__lowerCamelCase          =      out_channels
										__lowerCamelCase          =      depthwise_padding
										__lowerCamelCase          =      strides
										__lowerCamelCase          =      num_block_repeats
										__lowerCamelCase          =      expand_ratios
										__lowerCamelCase          =      squeeze_expansion_ratio
										__lowerCamelCase          =      hidden_act
										__lowerCamelCase          =      hidden_dim
										__lowerCamelCase          =      pooling_type
										__lowerCamelCase          =      initializer_range
										__lowerCamelCase          =      batch_norm_eps
										__lowerCamelCase          =      batch_norm_momentum
										__lowerCamelCase          =      drop_connect_rate
										__lowerCamelCase          =      sum(A_   ) * 4




							@classmethod
							def   __a   (     cls:    Tuple     ,							A_:    Union[str, os.PathLike]     ,							**A_:    Dict   ):
										cls._set_token_in_kwargs(A_   )

										__lowerCamelCase     ,__lowerCamelCase          =      cls.get_config_dict(A_     ,							**A_   )

										# get the vision config dict if we are loading from AlignConfig
										if config_dict.get("""model_type"""   ) == "align":
													__lowerCamelCase          =      config_dict["""vision_config"""]

										if "model_type" in config_dict and hasattr(cls     ,							"""model_type"""   ) and config_dict["model_type"] != cls.model_type:
													logger.warning(
													    f'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
													    f'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'   )

										return cls.from_dict(A_     ,							**A_   )




class 			__snake_case   (lowerCamelCase  ):
							__a					 =       '''align'''
							__a					 =       True




							def __init__(     self:    Optional[Any]     ,							A_:    Optional[int]=None     ,							A_:    Tuple=None     ,							A_:    int=6_40     ,							A_:    Union[str, Any]=1.0     ,							A_:    Union[str, Any]=0.02     ,							**A_:    List[str]     ,							):
										super().__init__(**A_   )

										if text_config is None:
													__lowerCamelCase          =      {}
													logger.info("""text_config is None. Initializing the AlignTextConfig with default values."""   )

										if vision_config is None:
													__lowerCamelCase          =      {}
													logger.info("""vision_config is None. Initializing the AlignVisionConfig with default values."""   )

										__lowerCamelCase          =      AlignTextConfig(**A_   )
										__lowerCamelCase          =      AlignVisionConfig(**A_   )

										__lowerCamelCase          =      projection_dim
										__lowerCamelCase          =      temperature_init_value
										__lowerCamelCase          =      initializer_range




							@classmethod
							def   __a   (     cls:    int     ,							A_:    AlignTextConfig     ,							A_:    AlignVisionConfig     ,							**A_:    int   ):
										return cls(text_config=text_config.to_dict()     ,							vision_config=vision_config.to_dict()     ,							**A_   )




							def   __a   (     self:    Optional[int]   ):
										__lowerCamelCase          =      copy.deepcopy(self.__dict__   )
										__lowerCamelCase          =      self.text_config.to_dict()
										__lowerCamelCase          =      self.vision_config.to_dict()
										__lowerCamelCase          =      self.__class__.model_type
										return output








"""simple docstring"""




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

import numpy as np
import torch

from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available




@dataclass
class 			__snake_case   (lowerCamelCase  ):
							__a					 =       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_text_to_video_synth import TextToVideoSDPipeline
					from .pipeline_text_to_video_synth_imgaimg import VideoToVideoSDPipeline  # noqa: F401
					from .pipeline_text_to_video_zero import TextToVideoZeroPipeline




