





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


snake_case_				=			logging.get_logger(__name__)

snake_case_				=			{
    'tanreinama/GPTSAN-2.8B-spout_is_uniform': (
        'https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_is_uniform/resolve/main/config.json'
    ),
}

class 		SCREAMING_SNAKE_CASE__				(       _UpperCAmelCase  ):
      A_						:				Optional[int]							=    'gptsan-japanese'
      A_						:				Any							=    [
          'past_key_values',
      ]
      A_						:				Any							=    {
          'hidden_size': 'd_model',
          'num_attention_heads': 'num_heads',
          'num_hidden_layers': 'num_layers',
      }


      def __init__(self       :      Optional[int]				,			a__       :      Optional[Any]=3_6000				,			a__       :      Union[str, Any]=1280				,			a__       :      List[Any]=1024				,			a__       :      List[str]=8192				,			a__       :      Union[str, Any]=4096				,			a__       :      int=128				,			a__       :      Optional[int]=10				,			a__       :      Tuple=0				,			a__       :      List[str]=16				,			a__       :      Any=16				,			a__       :      Dict=128				,			a__       :      str=0.0				,			a__       :      Tuple=1E-5				,			a__       :      Any=False				,			a__       :      List[Any]=0.0				,			a__       :      Optional[Any]="float32"				,			a__       :      int=False				,			a__       :      Optional[int]=False				,			a__       :      List[str]=False				,			a__       :      Optional[int]=0.0_0_2				,			a__       :      List[Any]=False				,			a__       :      List[Any]=True				,			a__       :      Any=3_5998				,			a__       :      int=3_5995				,			a__       :      Union[str, Any]=3_5999				,			**a__       :      Tuple				,			):





         """simple docstring"""



         __snake_case							       =   vocab_size
         __snake_case							       =   max_position_embeddings
         __snake_case							       =   d_model
         __snake_case							       =   d_ff
         __snake_case							       =   d_ext
         __snake_case							       =   d_spout
         __snake_case							       =   num_switch_layers
         __snake_case							       =   num_ext_layers
         __snake_case							       =   num_switch_layers + num_ext_layers
         __snake_case							       =   num_heads
         __snake_case							       =   num_experts
         __snake_case							       =   expert_capacity
         __snake_case							       =   dropout_rate
         __snake_case							       =   layer_norm_epsilon
         __snake_case							       =   router_bias
         __snake_case							       =   router_jitter_noise
         __snake_case							       =   router_dtype
         __snake_case							       =   router_ignore_padding_tokens
         __snake_case							       =   output_hidden_states
         __snake_case							       =   output_attentions
         __snake_case							       =   initializer_factor
         __snake_case							       =   output_router_logits
         __snake_case							       =   use_cache

         super().__init__(
             separator_token_id=a__				,			pad_token_id=a__				,			eos_token_id=a__				,			**a__				,			)




import warnings

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

class 				UpperCAmelCase_		(			__lowercase   ):
							"""simple docstring"""







							UpperCAmelCase__       :						str	    =    ["image_processor", "tokenizer"]
							UpperCAmelCase__       :						Optional[int]	    =    "CLIPImageProcessor"
							UpperCAmelCase__       :						Tuple	    =    ("XLMRobertaTokenizer", "XLMRobertaTokenizerFast")


							def __init__(			self       ,							_a=None       ,							_a=None       ,							**_a       )    ->    Any:
												_a	:    int         =		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       ,							)
																	_a	:    int         =		kwargs.pop('''feature_extractor'''       )

												_a	:    int         =		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       )    ->    List[Any]:

												if text is None and images is None:
																	raise ValueError('''You have to specify either text or images. Both cannot be none.'''       )

												if text is not None:
																	_a	:    str         =		self.tokenizer(_a       ,							return_tensors=_a       ,							**_a       )

												if images is not None:
																	_a	:    Optional[Any]         =		self.image_processor(_a       ,							return_tensors=_a       ,							**_a       )

												if text is not None and images is not None:
																	_a	:    List[Any]         =		image_features.pixel_values
																	return encoding
												elif text is not None:
																	return encoding
												else:
																	return BatchEncoding(data=dict(**_a       )       ,							tensor_type=_a       )


							def 				__lowercase				(			self       ,							*_a       ,							**_a       )    ->    Optional[Any]:
												return self.tokenizer.batch_decode(*_a       ,							**_a       )


							def 				__lowercase				(			self       ,							*_a       ,							**_a       )    ->    Optional[int]:
												return self.tokenizer.decode(*_a       ,							**_a       )




							@property
							def 				__lowercase				(			self       )    ->    Optional[int]:
												_a	:    Dict         =		self.tokenizer.model_input_names
												_a	:    Dict         =		self.image_processor.model_input_names
												return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names       )       )



