





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


SCREAMING_SNAKE_CASE_						       =	logging.get_logger(__name__)

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

class 		UpperCamelCase__			(				lowerCAmelCase_       ):



     '''simple docstring'''

     __snake_case   :     int		     =      "gptsan-japanese"
     __snake_case   :     List[Any]		     =      [
         "past_key_values",
     ]
     __snake_case   :     Union[str, Any]		     =      {
         "hidden_size": "d_model",
         "num_attention_heads": "num_heads",
         "num_hidden_layers": "num_layers",
     }






     def __init__(							self						:   int						,lowerCamelCase__						:   Optional[int]=36000						,lowerCamelCase__						:   List[str]=1280						,lowerCamelCase__						:   List[str]=1024						,lowerCamelCase__						:   int=8192						,lowerCamelCase__						:   int=4096						,lowerCamelCase__						:   Any=128						,lowerCamelCase__						:   Union[str, Any]=10						,lowerCamelCase__						:   Optional[Any]=0						,lowerCamelCase__						:   Dict=16						,lowerCamelCase__						:   Tuple=16						,lowerCamelCase__						:   Dict=128						,lowerCamelCase__						:   Optional[Any]=0.0						,lowerCamelCase__						:   int=1e-5						,lowerCamelCase__						:   int=False						,lowerCamelCase__						:   Optional[int]=0.0						,lowerCamelCase__						:   List[Any]="float32"						,lowerCamelCase__						:   Union[str, Any]=False						,lowerCamelCase__						:   Union[str, Any]=False						,lowerCamelCase__						:   List[str]=False						,lowerCamelCase__						:   Dict=0.002						,lowerCamelCase__						:   Optional[Any]=False						,lowerCamelCase__						:   List[Any]=True						,lowerCamelCase__						:   int=35998						,lowerCamelCase__						:   Optional[Any]=35995						,lowerCamelCase__						:   Tuple=35999						,**lowerCamelCase__						:   Union[str, Any]						,)					->		Optional[Any]:




           '''simple docstring'''


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

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









from typing import List, Optional, TypeVar

from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .info import DatasetInfo
from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _interleave_iterable_datasets
from .splits import NamedSplit
from .utils import logging
from .utils.py_utils import Literal


SCREAMING_SNAKE_CASE_						       =	logging.get_logger(__name__)


SCREAMING_SNAKE_CASE_						       =	TypeVar("""DatasetType""", Dataset, IterableDataset)



def        __lowercase       (				_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE = None			,						_SCREAMING_SNAKE_CASE = None			,						_SCREAMING_SNAKE_CASE = None			,						_SCREAMING_SNAKE_CASE = None			,						_SCREAMING_SNAKE_CASE = "first_exhausted"			,						)			->       DatasetType:


      '''simple docstring'''


      from .arrow_dataset import Dataset
      from .iterable_dataset import IterableDataset

      if not datasets:
            raise ValueError("""Unable to interleave an empty list of datasets."""     )
      for i, dataset in enumerate(_SCREAMING_SNAKE_CASE     ):
            if not isinstance(_SCREAMING_SNAKE_CASE			,						(Dataset, IterableDataset)     ):
                  if isinstance(_SCREAMING_SNAKE_CASE			,						(DatasetDict, IterableDatasetDict)     ):
                        if not dataset:
                              raise ValueError(
                                  F"""Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} """
                                  """is an empty dataset dictionary."""     )
                        raise ValueError(
                            F"""Dataset at position {i} has at least one split: {list(_SCREAMING_SNAKE_CASE     )}\n"""
                            F"""Please pick one to interleave with the other datasets, for example: dataset['{next(iter(_SCREAMING_SNAKE_CASE     )     )}']"""     )
                  raise ValueError(
                      F"""Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(_SCREAMING_SNAKE_CASE     ).__name__}."""     )
            if i == 0:
                  SCREAMING_SNAKE_CASE, SCREAMING_SNAKE_CASE		=						(
                      (Dataset, IterableDataset) if isinstance(_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE     ) else (IterableDataset, Dataset)
                  )
            elif not isinstance(_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE     ):
                  raise ValueError(
                      F"""Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects."""     )
      if stopping_strategy not in ["first_exhausted", "all_exhausted"]:
            raise ValueError(F"""{stopping_strategy} is not supported. Please enter a valid stopping_strategy."""     )
      if dataset_type is Dataset:
            return _interleave_map_style_datasets(
                _SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE			,						info=_SCREAMING_SNAKE_CASE			,						split=_SCREAMING_SNAKE_CASE			,						stopping_strategy=_SCREAMING_SNAKE_CASE     )
      else:
            return _interleave_iterable_datasets(
                _SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE			,						info=_SCREAMING_SNAKE_CASE			,						split=_SCREAMING_SNAKE_CASE			,						stopping_strategy=_SCREAMING_SNAKE_CASE     )



def        __lowercase       (				_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE = None			,						_SCREAMING_SNAKE_CASE = None			,						_SCREAMING_SNAKE_CASE = 0			,						)			->       DatasetType:


      '''simple docstring'''


      if not dsets:
            raise ValueError("""Unable to concatenate an empty list of datasets."""     )
      for i, dataset in enumerate(_SCREAMING_SNAKE_CASE     ):
            if not isinstance(_SCREAMING_SNAKE_CASE			,						(Dataset, IterableDataset)     ):
                  if isinstance(_SCREAMING_SNAKE_CASE			,						(DatasetDict, IterableDatasetDict)     ):
                        if not dataset:
                              raise ValueError(
                                  F"""Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} """
                                  """is an empty dataset dictionary."""     )
                        raise ValueError(
                            F"""Dataset at position {i} has at least one split: {list(_SCREAMING_SNAKE_CASE     )}\n"""
                            F"""Please pick one to interleave with the other datasets, for example: dataset['{next(iter(_SCREAMING_SNAKE_CASE     )     )}']"""     )
                  raise ValueError(
                      F"""Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(_SCREAMING_SNAKE_CASE     ).__name__}."""     )
            if i == 0:
                  SCREAMING_SNAKE_CASE, SCREAMING_SNAKE_CASE		=						(
                      (Dataset, IterableDataset) if isinstance(_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE     ) else (IterableDataset, Dataset)
                  )
            elif not isinstance(_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE     ):
                  raise ValueError(
                      F"""Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects."""     )
      if dataset_type is Dataset:
            return _concatenate_map_style_datasets(_SCREAMING_SNAKE_CASE			,						info=_SCREAMING_SNAKE_CASE			,						split=_SCREAMING_SNAKE_CASE			,						axis=_SCREAMING_SNAKE_CASE     )
      else:
            return _concatenate_iterable_datasets(_SCREAMING_SNAKE_CASE			,						info=_SCREAMING_SNAKE_CASE			,						split=_SCREAMING_SNAKE_CASE			,						axis=_SCREAMING_SNAKE_CASE     )


