



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


__UpperCAmelCase			  =			logging.get_logger(__name__)

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



class 							lowerCAmelCase_						(    UpperCamelCase__				):
       UpperCAmelCase__							:   Optional[int]  	=    "gptsan-japanese"
       UpperCAmelCase__							:   int  	=    [
           "past_key_values",
       ]
       UpperCAmelCase__							:   Optional[Any]  	=    {
           "hidden_size": "d_model",
           "num_attention_heads": "num_heads",
           "num_hidden_layers": "num_layers",
       }
       def __init__(     self,     SCREAMING_SNAKE_CASE_=3_6000,     SCREAMING_SNAKE_CASE_=1280,     SCREAMING_SNAKE_CASE_=1024,     SCREAMING_SNAKE_CASE_=8192,     SCREAMING_SNAKE_CASE_=4096,     SCREAMING_SNAKE_CASE_=128,     SCREAMING_SNAKE_CASE_=10,     SCREAMING_SNAKE_CASE_=0,     SCREAMING_SNAKE_CASE_=16,     SCREAMING_SNAKE_CASE_=16,     SCREAMING_SNAKE_CASE_=128,     SCREAMING_SNAKE_CASE_=0.0,     SCREAMING_SNAKE_CASE_=1e-5,     SCREAMING_SNAKE_CASE_=False,     SCREAMING_SNAKE_CASE_=0.0,     SCREAMING_SNAKE_CASE_="float32",     SCREAMING_SNAKE_CASE_=False,     SCREAMING_SNAKE_CASE_=False,     SCREAMING_SNAKE_CASE_=False,     SCREAMING_SNAKE_CASE_=0.0_02,     SCREAMING_SNAKE_CASE_=False,     SCREAMING_SNAKE_CASE_=True,     SCREAMING_SNAKE_CASE_=3_5998,     SCREAMING_SNAKE_CASE_=3_5995,     SCREAMING_SNAKE_CASE_=3_5999,     **SCREAMING_SNAKE_CASE_,     )	->						List[str]:
          UpperCamelCase       :    Any		      =      vocab_size
          UpperCamelCase       :    List[str]		      =      max_position_embeddings
          UpperCamelCase       :    Tuple		      =      d_model
          UpperCamelCase       :    Union[str, Any]		      =      d_ff
          UpperCamelCase       :    Dict		      =      d_ext
          UpperCamelCase       :    Optional[Any]		      =      d_spout
          UpperCamelCase       :    Dict		      =      num_switch_layers
          UpperCamelCase       :    int		      =      num_ext_layers
          UpperCamelCase       :    Any		      =      num_switch_layers + num_ext_layers
          UpperCamelCase       :    str		      =      num_heads
          UpperCamelCase       :    Optional[int]		      =      num_experts
          UpperCamelCase       :    List[Any]		      =      expert_capacity
          UpperCamelCase       :    Optional[Any]		      =      dropout_rate
          UpperCamelCase       :    str		      =      layer_norm_epsilon
          UpperCamelCase       :    Optional[Any]		      =      router_bias
          UpperCamelCase       :    Union[str, Any]		      =      router_jitter_noise
          UpperCamelCase       :    Optional[int]		      =      router_dtype
          UpperCamelCase       :    Any		      =      router_ignore_padding_tokens
          UpperCamelCase       :    str		      =      output_hidden_states
          UpperCamelCase       :    str		      =      output_attentions
          UpperCamelCase       :    Optional[int]		      =      initializer_factor
          UpperCamelCase       :    Optional[Any]		      =      output_router_logits
          UpperCamelCase       :    List[str]		      =      use_cache

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










'''simple docstring'''

import warnings

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






class   UpperCAmelCase      (			UpperCamelCase__							):
 __lowercase  						=							["""image_processor""", """tokenizer"""]
 __lowercase  						=							"""CLIPImageProcessor"""
 __lowercase  						=							("""CLIPTokenizer""", """CLIPTokenizerFast""")
 def __init__(							self :List[Any]		,			lowercase_ :List[str]=None		,			lowercase_ :Any=None		,			**lowercase_ :Union[str, Any]				)->				Optional[Any]:
     A__							=     None
     if "feature_extractor" in kwargs:
         warnings.warn(
             "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
             " instead."		,			lowercase_		,			)
         A__							=     kwargs.pop("feature_extractor"				)

     A__							=     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__(lowercase_		,			lowercase_				)
 def __call__(							self :Optional[Any]		,			lowercase_ :Optional[int]=None		,			lowercase_ :Dict=None		,			lowercase_ :List[Any]=None		,			**lowercase_ :Optional[Any]				)->				Union[str, 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__							=     self.tokenizer(lowercase_		,			return_tensors=lowercase_		,			**lowercase_				)

     if images is not None:
         A__							=     self.image_processor(lowercase_		,			return_tensors=lowercase_		,			**lowercase_				)

     if text is not None and images is not None:
         A__							=     image_features.pixel_values
         return encoding
     elif text is not None:
         return encoding
     else:
         return BatchEncoding(data=dict(**lowercase_				)		,			tensor_type=lowercase_				)
 def 	UpperCAmelCase_				(							self :int		,			*lowercase_ :Tuple		,			**lowercase_ :Any				)->				Dict:
     return self.tokenizer.batch_decode(*lowercase_		,			**lowercase_				)
 def 	UpperCAmelCase_				(							self :Any		,			*lowercase_ :Any		,			**lowercase_ :Any				)->				List[str]:
     return self.tokenizer.decode(*lowercase_		,			**lowercase_				)
 @property
 def 	UpperCAmelCase_				(							self :Union[str, Any]				)->				Optional[int]:
     A__							=     self.tokenizer.model_input_names
     A__							=     self.image_processor.model_input_names
     return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names				)				)
 @property
 def 	UpperCAmelCase_				(							self :List[Any]				)->				str:
     warnings.warn(
         "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."		,			lowercase_		,			)
     return self.image_processor_class



 @property
 def 	UpperCAmelCase_				(							self :List[str]				)->				List[Any]:
     warnings.warn(
         "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."		,			lowercase_		,			)
     return self.image_processor



