



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


__snake_case     :Tuple			       =logging.get_logger(__name__)

__snake_case     :int			       ={
    'google/canine-s': 'https://huggingface.co/google/canine-s/resolve/main/config.json',
    # See all CANINE models at https://huggingface.co/models?filter=canine
}



class        lowerCAmelCase__					(  _lowerCamelCase       ):
				A_   :     int								=     'canine'


				def __init__(							self      :  Optional[int]						, __UpperCamelCase      :  Dict=768						, __UpperCamelCase      :  Tuple=12						, __UpperCamelCase      :  Union[str, Any]=12						, __UpperCamelCase      :  Optional[Any]=3_072						, __UpperCamelCase      :  int="gelu"						, __UpperCamelCase      :  int=0.1						, __UpperCamelCase      :  Optional[Any]=0.1						, __UpperCamelCase      :  Optional[int]=16_384						, __UpperCamelCase      :  Union[str, Any]=16						, __UpperCamelCase      :  Tuple=0.0_2						, __UpperCamelCase      :  Dict=1e-12						, __UpperCamelCase      :  int=0						, __UpperCamelCase      :  Optional[int]=0XE000						, __UpperCamelCase      :  List[Any]=0XE001						, __UpperCamelCase      :  Union[str, Any]=4						, __UpperCamelCase      :  Dict=4						, __UpperCamelCase      :  Tuple=8						, __UpperCamelCase      :  Any=16_384						, __UpperCamelCase      :  int=128						, **__UpperCamelCase      :  Tuple						, )		->     List[Any]:
											super().__init__(pad_token_id=__UpperCamelCase						, bos_token_id=__UpperCamelCase						, eos_token_id=__UpperCamelCase						, **__UpperCamelCase       )

											A      						=    max_position_embeddings
											A      						=    hidden_size
											A      						=    num_hidden_layers
											A      						=    num_attention_heads
											A      						=    intermediate_size
											A      						=    hidden_act
											A      						=    hidden_dropout_prob
											A      						=    attention_probs_dropout_prob
											A      						=    initializer_range
											A      						=    type_vocab_size
											A      						=    layer_norm_eps

											# Character config:
											A      						=    downsampling_rate
											A      						=    upsampling_kernel_size
											A      						=    num_hash_functions
											A      						=    num_hash_buckets
											A      						=    local_transformer_stride




from typing import Callable, Optional

from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream



class        lowerCAmelCase__					(  _lowerCamelCase       ):


				def __init__(							self      :  int						, __UpperCamelCase      :  Callable						, __UpperCamelCase      :  Optional[Features] = None						, __UpperCamelCase      :  str = None						, __UpperCamelCase      :  bool = False						, __UpperCamelCase      :  bool = False						, __UpperCamelCase      :  Optional[dict] = None						, __UpperCamelCase      :  Optional[int] = None						, **__UpperCamelCase      :  str						, )		->     List[str]:
											super().__init__(
											    features=__UpperCamelCase						, cache_dir=__UpperCamelCase						, keep_in_memory=__UpperCamelCase						, streaming=__UpperCamelCase						, num_proc=__UpperCamelCase						, **__UpperCamelCase						, )
											A      						=    Generator(
											    cache_dir=__UpperCamelCase						, features=__UpperCamelCase						, generator=__UpperCamelCase						, gen_kwargs=__UpperCamelCase						, **__UpperCamelCase						, )


				def __UpperCamelCase						(							self      :  Union[str, Any]       )		->     Tuple:
											# Build iterable dataset
											if self.streaming:
																		A      						=    self.builder.as_streaming_dataset(split='train'       )
											# Build regular (map-style) dataset
											else:
																		A      						=    None
																		A      						=    None
																		A      						=    None
																		A      						=    None

																		self.builder.download_and_prepare(
																		    download_config=__UpperCamelCase						, download_mode=__UpperCamelCase						, verification_mode=__UpperCamelCase						, base_path=__UpperCamelCase						, num_proc=self.num_proc						, )
																		A      						=    self.builder.as_dataset(
																		    split='train'						, verification_mode=__UpperCamelCase						, in_memory=self.keep_in_memory       )
											return dataset