



'''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


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

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






class 							lowercase__     (							lowercase       ):
	lowercase__      =      """align_text_model"""





	def __init__(			self :    List[Any]			,lowerCamelCase__ :    Any=30522			,lowerCamelCase__ :    Any=768			,lowerCamelCase__ :    Any=12			,lowerCamelCase__ :    List[str]=12			,lowerCamelCase__ :    Union[str, Any]=3072			,lowerCamelCase__ :    str="gelu"			,lowerCamelCase__ :    List[Any]=0.1			,lowerCamelCase__ :    Optional[int]=0.1			,lowerCamelCase__ :    str=512			,lowerCamelCase__ :    Optional[int]=2			,lowerCamelCase__ :    Dict=0.0_2			,lowerCamelCase__ :    Union[str, Any]=1E-12			,lowerCamelCase__ :    str=0			,lowerCamelCase__ :    List[Any]="absolute"			,lowerCamelCase__ :    Any=True			,**lowerCamelCase__ :    Optional[Any]			,):







							'''simple docstring'''
							super().__init__(**lowerCamelCase__			)

							_UpperCamelCase :		str			    =       vocab_size
							_UpperCamelCase :		Union[str, Any]			    =       hidden_size
							_UpperCamelCase :		Union[str, Any]			    =       num_hidden_layers
							_UpperCamelCase :		str			    =       num_attention_heads
							_UpperCamelCase :		List[str]			    =       hidden_act
							_UpperCamelCase :		Tuple			    =       intermediate_size
							_UpperCamelCase :		Dict			    =       hidden_dropout_prob
							_UpperCamelCase :		Tuple			    =       attention_probs_dropout_prob
							_UpperCamelCase :		Optional[Any]			    =       max_position_embeddings
							_UpperCamelCase :		List[str]			    =       type_vocab_size
							_UpperCamelCase :		Tuple			    =       initializer_range
							_UpperCamelCase :		List[str]			    =       layer_norm_eps
							_UpperCamelCase :		str			    =       position_embedding_type
							_UpperCamelCase :		Any			    =       use_cache
							_UpperCamelCase :		Any			    =       pad_token_id





	@classmethod
	def      UpperCamelCase_  (			cls :    Tuple			,lowerCamelCase__ :    Union[str, os.PathLike]			,**lowerCamelCase__ :    Any			):







							'''simple docstring'''
							cls._set_token_in_kwargs(lowerCamelCase__			)

							_UpperCamelCase :		Dict			    =       cls.get_config_dict(lowerCamelCase__			,**lowerCamelCase__			)

							# get the text config dict if we are loading from AlignConfig
							if config_dict.get('model_type'			) == "align":
													_UpperCamelCase :		List[str]			    =       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(lowerCamelCase__			,**lowerCamelCase__			)






class 							lowercase__     (							lowercase       ):
	lowercase__      =      """align_vision_model"""





	def __init__(			self :    Optional[int]			,lowerCamelCase__ :    int = 3			,lowerCamelCase__ :    int = 600			,lowerCamelCase__ :    float = 2.0			,lowerCamelCase__ :    float = 3.1			,lowerCamelCase__ :    int = 8			,lowerCamelCase__ :    List[int] = [3, 3, 5, 3, 5, 5, 3]			,lowerCamelCase__ :    List[int] = [32, 16, 24, 40, 80, 112, 192]			,lowerCamelCase__ :    List[int] = [16, 24, 40, 80, 112, 192, 320]			,lowerCamelCase__ :    List[int] = []			,lowerCamelCase__ :    List[int] = [1, 2, 2, 2, 1, 2, 1]			,lowerCamelCase__ :    List[int] = [1, 2, 2, 3, 3, 4, 1]			,lowerCamelCase__ :    List[int] = [1, 6, 6, 6, 6, 6, 6]			,lowerCamelCase__ :    float = 0.2_5			,lowerCamelCase__ :    str = "swish"			,lowerCamelCase__ :    int = 2560			,lowerCamelCase__ :    str = "mean"			,lowerCamelCase__ :    float = 0.0_2			,lowerCamelCase__ :    float = 0.0_0_1			,lowerCamelCase__ :    float = 0.9_9			,lowerCamelCase__ :    float = 0.2			,**lowerCamelCase__ :    Tuple			,):







							'''simple docstring'''
							super().__init__(**lowerCamelCase__			)

							_UpperCamelCase :		Any			    =       num_channels
							_UpperCamelCase :		Union[str, Any]			    =       image_size
							_UpperCamelCase :		Union[str, Any]			    =       width_coefficient
							_UpperCamelCase :		List[str]			    =       depth_coefficient
							_UpperCamelCase :		str			    =       depth_divisor
							_UpperCamelCase :		Dict			    =       kernel_sizes
							_UpperCamelCase :		List[str]			    =       in_channels
							_UpperCamelCase :		Tuple			    =       out_channels
							_UpperCamelCase :		str			    =       depthwise_padding
							_UpperCamelCase :		Tuple			    =       strides
							_UpperCamelCase :		Tuple			    =       num_block_repeats
							_UpperCamelCase :		List[Any]			    =       expand_ratios
							_UpperCamelCase :		Union[str, Any]			    =       squeeze_expansion_ratio
							_UpperCamelCase :		Optional[int]			    =       hidden_act
							_UpperCamelCase :		Dict			    =       hidden_dim
							_UpperCamelCase :		List[str]			    =       pooling_type
							_UpperCamelCase :		str			    =       initializer_range
							_UpperCamelCase :		Union[str, Any]			    =       batch_norm_eps
							_UpperCamelCase :		List[Any]			    =       batch_norm_momentum
							_UpperCamelCase :		List[str]			    =       drop_connect_rate
							_UpperCamelCase :		Optional[int]			    =       sum(lowerCamelCase__			) * 4





	@classmethod
	def      UpperCamelCase_  (			cls :    Tuple			,lowerCamelCase__ :    Union[str, os.PathLike]			,**lowerCamelCase__ :    Optional[int]			):







							'''simple docstring'''
							cls._set_token_in_kwargs(lowerCamelCase__			)

							_UpperCamelCase :		Any			    =       cls.get_config_dict(lowerCamelCase__			,**lowerCamelCase__			)

							# get the vision config dict if we are loading from AlignConfig
							if config_dict.get('model_type'			) == "align":
													_UpperCamelCase :		str			    =       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(lowerCamelCase__			,**lowerCamelCase__			)






class 							lowercase__     (							lowercase       ):
	lowercase__      =      """align"""
	lowercase__      =      True





	def __init__(			self :    Union[str, Any]			,lowerCamelCase__ :    Tuple=None			,lowerCamelCase__ :    Any=None			,lowerCamelCase__ :    List[str]=640			,lowerCamelCase__ :    Tuple=1.0			,lowerCamelCase__ :    str=0.0_2			,**lowerCamelCase__ :    int			,):







							'''simple docstring'''
							super().__init__(**lowerCamelCase__			)

							if text_config is None:
													_UpperCamelCase :		Any			    =       {}
													logger.info('text_config is None. Initializing the AlignTextConfig with default values.'			)

							if vision_config is None:
													_UpperCamelCase :		str			    =       {}
													logger.info('vision_config is None. Initializing the AlignVisionConfig with default values.'			)

							_UpperCamelCase :		Optional[int]			    =       AlignTextConfig(**lowerCamelCase__			)
							_UpperCamelCase :		Any			    =       AlignVisionConfig(**lowerCamelCase__			)

							_UpperCamelCase :		Optional[int]			    =       projection_dim
							_UpperCamelCase :		List[Any]			    =       temperature_init_value
							_UpperCamelCase :		List[Any]			    =       initializer_range





	@classmethod
	def      UpperCamelCase_  (			cls :    Dict			,lowerCamelCase__ :    AlignTextConfig			,lowerCamelCase__ :    AlignVisionConfig			,**lowerCamelCase__ :    Optional[int]			):







							'''simple docstring'''
							return cls(text_config=text_config.to_dict()			,vision_config=vision_config.to_dict()			,**lowerCamelCase__			)





	def      UpperCamelCase_  (			self :    Tuple			):







							'''simple docstring'''
							_UpperCamelCase :		Optional[Any]			    =       copy.deepcopy(self.__dict__			)
							_UpperCamelCase :		Any			    =       self.text_config.to_dict()
							_UpperCamelCase :		Tuple			    =       self.vision_config.to_dict()
							_UpperCamelCase :		Dict			    =       self.__class__.model_type
							return output







'''simple docstring'''
from datetime import datetime

import requests






def A__   (					UpperCAmelCase_							):
						_UpperCamelCase :		List[Any]			    =       'https://downloadgram.net/wp-json/wppress/video-downloader/video?url='
						_UpperCamelCase :		Optional[int]			    =       requests.get(base_url + url							).json()[0]['urls'][0]['src']
						return requests.get(UpperCAmelCase_							).content


if __name__ == "__main__":
					snake_case_			:     List[str]  	=  input('Enter Video/IGTV url: ').strip()
					snake_case_			:     str  	=  F"""{datetime.now():%Y-%m-%d_%H:%M:%S}.mp4"""
					with open(file_name, 'wb') as fp:
										fp.write(download_video(url))
					print(F"""Done. Video saved to disk as {file_name}.""")


