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


_lowercase          =						logging.get_logger(__name__)

_lowercase          =						{
    """kakaobrain/align-base""": """https://huggingface.co/kakaobrain/align-base/resolve/main/config.json""",
}




class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: Any										=  '''align_text_model'''




						def __init__(   self       ,  _lowercase=30_522       ,  _lowercase=768       ,  _lowercase=12       ,  _lowercase=12       ,  _lowercase=3_072       ,  _lowercase="gelu"       ,  _lowercase=0.1       ,  _lowercase=0.1       ,  _lowercase=512       ,  _lowercase=2       ,  _lowercase=0.02       ,  _lowercase=1e-12       ,  _lowercase=0       ,  _lowercase="absolute"       ,  _lowercase=True       ,  **_lowercase       ,  ):

												"""simple docstring"""



												super().__init__(**_lowercase )

												_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    _lowercase      (   cls       ,  _lowercase       ,  **_lowercase ):

												"""simple docstring"""



												cls._set_token_in_kwargs(_lowercase )

												_lowerCAmelCase		,       _lowerCAmelCase    		=					cls.get_config_dict(_lowercase       ,  **_lowercase )

												# 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(_lowercase       ,  **_lowercase )






class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: Optional[Any]										=  '''align_vision_model'''




						def __init__(   self       ,  _lowercase = 3       ,  _lowercase = 600       ,  _lowercase = 2.0       ,  _lowercase = 3.1       ,  _lowercase = 8       ,  _lowercase = [3, 3, 5, 3, 5, 5, 3]       ,  _lowercase = [32, 16, 24, 40, 80, 112, 192]       ,  _lowercase = [16, 24, 40, 80, 112, 192, 320]       ,  _lowercase = []       ,  _lowercase = [1, 2, 2, 2, 1, 2, 1]       ,  _lowercase = [1, 2, 2, 3, 3, 4, 1]       ,  _lowercase = [1, 6, 6, 6, 6, 6, 6]       ,  _lowercase = 0.25       ,  _lowercase = "swish"       ,  _lowercase = 2_560       ,  _lowercase = "mean"       ,  _lowercase = 0.02       ,  _lowercase = 0.001       ,  _lowercase = 0.99       ,  _lowercase = 0.2       ,  **_lowercase       ,  ):

												"""simple docstring"""



												super().__init__(**_lowercase )

												_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(_lowercase ) * 4




						@classmethod
						def    _lowercase      (   cls       ,  _lowercase       ,  **_lowercase ):

												"""simple docstring"""



												cls._set_token_in_kwargs(_lowercase )

												_lowerCAmelCase		,       _lowerCAmelCase    		=					cls.get_config_dict(_lowercase       ,  **_lowercase )

												# 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(_lowercase       ,  **_lowercase )






class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: Tuple										=  '''align'''
						_lowercase						: Optional[int]										=  True




						def __init__(   self       ,  _lowercase=None       ,  _lowercase=None       ,  _lowercase=640       ,  _lowercase=1.0       ,  _lowercase=0.02       ,  **_lowercase       ,  ):

												"""simple docstring"""



												super().__init__(**_lowercase )

												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(**_lowercase )
												_lowerCAmelCase    		=					AlignVisionConfig(**_lowercase )

												_lowerCAmelCase    		=					projection_dim
												_lowerCAmelCase    		=					temperature_init_value
												_lowerCAmelCase    		=					initializer_range




						@classmethod
						def    _lowercase      (   cls       ,  _lowercase       ,  _lowercase       ,  **_lowercase ):

												"""simple docstring"""



												return cls(text_config=text_config.to_dict()       ,  vision_config=vision_config.to_dict()       ,  **_lowercase )




						def    _lowercase      (   self ):

												"""simple docstring"""



												_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 ...configuration_utils import PretrainedConfig
from ...utils import logging


_lowercase          =						logging.get_logger(__name__)

_lowercase          =						{
    """edbeeching/decision-transformer-gym-hopper-medium""": (
        """https://huggingface.co/edbeeching/decision-transformer-gym-hopper-medium/resolve/main/config.json"""
    ),
    # See all DecisionTransformer models at https://huggingface.co/models?filter=decision_transformer
}




class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: List[str]										=  '''decision_transformer'''
						_lowercase						: Optional[Any]										=  ['''past_key_values''']
						_lowercase						: str										=  {
						    '''max_position_embeddings''': '''n_positions''',
						    '''num_attention_heads''': '''n_head''',
						    '''num_hidden_layers''': '''n_layer''',
						}




						def __init__(   self       ,  _lowercase=17       ,  _lowercase=4       ,  _lowercase=128       ,  _lowercase=4_096       ,  _lowercase=True       ,  _lowercase=1       ,  _lowercase=1_024       ,  _lowercase=3       ,  _lowercase=1       ,  _lowercase=None       ,  _lowercase="relu"       ,  _lowercase=0.1       ,  _lowercase=0.1       ,  _lowercase=0.1       ,  _lowercase=1e-5       ,  _lowercase=0.02       ,  _lowercase=True       ,  _lowercase=True       ,  _lowercase=50_256       ,  _lowercase=50_256       ,  _lowercase=False       ,  _lowercase=False       ,  **_lowercase       ,  ):

												"""simple docstring"""



												_lowerCAmelCase    		=					state_dim
												_lowerCAmelCase    		=					act_dim
												_lowerCAmelCase    		=					hidden_size
												_lowerCAmelCase    		=					max_ep_len
												_lowerCAmelCase    		=					action_tanh
												_lowerCAmelCase    		=					vocab_size
												_lowerCAmelCase    		=					n_positions
												_lowerCAmelCase    		=					n_layer
												_lowerCAmelCase    		=					n_head
												_lowerCAmelCase    		=					n_inner
												_lowerCAmelCase    		=					activation_function
												_lowerCAmelCase    		=					resid_pdrop
												_lowerCAmelCase    		=					embd_pdrop
												_lowerCAmelCase    		=					attn_pdrop
												_lowerCAmelCase    		=					layer_norm_epsilon
												_lowerCAmelCase    		=					initializer_range
												_lowerCAmelCase    		=					scale_attn_weights
												_lowerCAmelCase    		=					use_cache
												_lowerCAmelCase    		=					scale_attn_by_inverse_layer_idx
												_lowerCAmelCase    		=					reorder_and_upcast_attn

												_lowerCAmelCase    		=					bos_token_id
												_lowerCAmelCase    		=					eos_token_id

												super().__init__(bos_token_id=_lowercase       ,  eos_token_id=_lowercase       ,  **_lowercase )
