code: 
  
  
  
  
  
  
  import itertools
  from dataclasses import dataclass
  from io import StringIO
  from typing import Optional
  
  import pyarrow as pa
  
  import datasets
  from datasets.features.features import require_storage_cast
  from datasets.table import table_cast
  
  
  lowerCamelCase										=  datasets.utils.logging.get_logger(__name__)
  
  @dataclass
  class 					snake_case_							(       datasets.BuilderConfig      ):
  
  
  
  
  
  
  
     """simple docstring"""
  
  
  
     __lowerCAmelCase      =						None
     __lowerCAmelCase      =						"utf-8"
     __lowerCAmelCase      =						None
     __lowerCAmelCase      =						10 << 20  # 10MB
     __lowerCAmelCase      =						False
     __lowerCAmelCase      =						"line"
  
  
  
  
  
  
  class 					snake_case_							(       datasets.ArrowBasedBuilder      ):
  
  
  
  
  
  
  
     """simple docstring"""
  
  
  
     __lowerCAmelCase      =						TextConfig
  
     def 			SCREAMING_SNAKE_CASE__				(    self:	int	)  ->		Tuple:
  
  
         """simple docstring"""
  
  
  
         return datasets.DatasetInfo(features=self.config.features	)
  
     def 			SCREAMING_SNAKE_CASE__				(    self:	List[str]   ,       snake_case__:	List[Any]	)  ->		Any:
  
  
         """simple docstring"""
  
  
  
         if not self.config.data_files:
             raise ValueError(f'''At least one data file must be specified, but got data_files={self.config.data_files}'''	)
         _lowercase     =	dl_manager.download_and_extract(self.config.data_files	)
         if isinstance(snake_case__   ,       (str, list, tuple)	):
             _lowercase     =	data_files
             if isinstance(snake_case__   ,       snake_case__	):
                 _lowercase     =	[files]
             _lowercase     =	[dl_manager.iter_files(snake_case__	) for file in files]
             return [datasets.SplitGenerator(name=datasets.Split.TRAIN   ,       gen_kwargs={'files': files}	)]
         _lowercase     =	[]
         for split_name, files in data_files.items():
             if isinstance(snake_case__   ,       snake_case__	):
                 _lowercase     =	[files]
             _lowercase     =	[dl_manager.iter_files(snake_case__	) for file in files]
             splits.append(datasets.SplitGenerator(name=snake_case__   ,       gen_kwargs={'files': files}	)	)
         return splits
  
     def 			SCREAMING_SNAKE_CASE__				(    self:	List[str]   ,       snake_case__:	pa.Table	)  ->		pa.Table:
  
  
         """simple docstring"""
  
  
  
         if self.config.features is not None:
             _lowercase     =	self.config.features.arrow_schema
             if all(not require_storage_cast(snake_case__	) for feature in self.config.features.values()	):
                 # cheaper cast
                 _lowercase     =	pa_table.cast(snake_case__	)
             else:
                 # more expensive cast; allows str <-> int/float or str to Audio for example
                 _lowercase     =	table_cast(snake_case__   ,       snake_case__	)
             return pa_table
         else:
             return pa_table.cast(pa.schema({'text': pa.string()}	)	)
  
     def 			SCREAMING_SNAKE_CASE__				(    self:	Tuple   ,       snake_case__:	int	)  ->		Optional[int]:
  
  
         """simple docstring"""
  
  
  
         _lowercase     =	list(self.config.features	) if self.config.features is not None else ['text']
         for file_idx, file in enumerate(itertools.chain.from_iterable(snake_case__	)	):
             # open in text mode, by default translates universal newlines ("\n", "\r\n" and "\r") into "\n"
             with open(snake_case__   ,       encoding=self.config.encoding   ,       errors=self.config.errors	) as f:
                 if self.config.sample_by == "line":
                     _lowercase     =	0
                     while True:
                         _lowercase     =	f.read(self.config.chunksize	)
                         if not batch:
                             break
                         batch += f.readline()  # finish current line
                         # StringIO.readlines, by default splits only on "\n" (and keeps line breaks)
                         _lowercase     =	StringIO(snake_case__	).readlines()
                         if not self.config.keep_linebreaks:
                             _lowercase     =	[line.rstrip('\n'	) for line in batch]
                         _lowercase     =	pa.Table.from_arrays([pa.array(snake_case__	)]   ,       names=snake_case__	)
                         # Uncomment for debugging (will print the Arrow table size and elements)
                         # logger.warning(f"pa_table: {pa_table} num rows: {pa_table.num_rows}")
                         # logger.warning('\n'.join(str(pa_table.slice(i, 1).to_pydict()) for i in range(pa_table.num_rows)))
                         yield (file_idx, batch_idx), self._cast_table(snake_case__	)
                         batch_idx += 1
                 elif self.config.sample_by == "paragraph":
                     _lowercase     =	0
                     _lowercase     =	''
                     while True:
                         _lowercase     =	f.read(self.config.chunksize	)
                         if not new_batch:
                             break
                         batch += new_batch
                         batch += f.readline()  # finish current line
                         _lowercase     =	batch.split('\n\n'	)
                         _lowercase     =	pa.Table.from_arrays(
                             [pa.array([example for example in batch[:-1] if example]	)]   ,       names=snake_case__	)
                         # Uncomment for debugging (will print the Arrow table size and elements)
                         # logger.warning(f"pa_table: {pa_table} num rows: {pa_table.num_rows}")
                         # logger.warning('\n'.join(str(pa_table.slice(i, 1).to_pydict()) for i in range(pa_table.num_rows)))
                         yield (file_idx, batch_idx), self._cast_table(snake_case__	)
                         batch_idx += 1
                         _lowercase     =	batch[-1]
                     if batch:
                         _lowercase     =	pa.Table.from_arrays([pa.array([batch]	)]   ,       names=snake_case__	)
                         yield (file_idx, batch_idx), self._cast_table(snake_case__	)
                 elif self.config.sample_by == "document":
                     _lowercase     =	f.read()
                     _lowercase     =	pa.Table.from_arrays([pa.array([text]	)]   ,       names=snake_case__	)
                     yield file_idx, self._cast_table(snake_case__	)
  
style_context: 
  
  
  
  
  
  
  import functools
  import operator
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  
  
  lowerCamelCase										=  logging.get_logger(__name__)
  
  lowerCamelCase										=  {
      '''facebook/hubert-base-ls960''': '''https://huggingface.co/facebook/hubert-base-ls960/resolve/main/config.json''',
      # See all Hubert models at https://huggingface.co/models?filter=hubert
  }
  
  class 					snake_case_							(       lowercase_      ):
  
  
  
  
  
  
  
     """simple docstring"""
  
  
  
     __lowerCAmelCase      =						"""hubert"""
  
     def __init__(    self:	Any   ,       snake_case__:	str=32   ,       snake_case__:	int=768   ,       snake_case__:	Dict=12   ,       snake_case__:	Optional[int]=12   ,       snake_case__:	List[str]=3_072   ,       snake_case__:	Optional[Any]="gelu"   ,       snake_case__:	Optional[int]=0.1   ,       snake_case__:	List[str]=0.1   ,       snake_case__:	Optional[int]=0.1   ,       snake_case__:	List[str]=True   ,       snake_case__:	Union[str, Any]=0.0   ,       snake_case__:	Union[str, Any]=0.1   ,       snake_case__:	List[str]=0.1   ,       snake_case__:	List[Any]=0.02   ,       snake_case__:	Dict=1E-5   ,       snake_case__:	Any="group"   ,       snake_case__:	Union[str, Any]="gelu"   ,       snake_case__:	List[str]=(512, 512, 512, 512, 512, 512, 512)   ,       snake_case__:	Union[str, Any]=(5, 2, 2, 2, 2, 2, 2)   ,       snake_case__:	Any=(10, 3, 3, 3, 3, 2, 2)   ,       snake_case__:	int=False   ,       snake_case__:	Any=128   ,       snake_case__:	Dict=16   ,       snake_case__:	Optional[Any]=False   ,       snake_case__:	Tuple=True   ,       snake_case__:	int=0.05   ,       snake_case__:	List[Any]=10   ,       snake_case__:	Tuple=2   ,       snake_case__:	List[Any]=0.0   ,       snake_case__:	Optional[int]=10   ,       snake_case__:	Optional[int]=0   ,       snake_case__:	Union[str, Any]="sum"   ,       snake_case__:	Union[str, Any]=False   ,       snake_case__:	int=False   ,       snake_case__:	Any=256   ,       snake_case__:	Union[str, Any]=0   ,       snake_case__:	Optional[int]=1   ,       snake_case__:	List[str]=2   ,       **snake_case__:	Optional[int]   ,       )  ->		Any:
  
  
         """simple docstring"""
  
  
  
         super().__init__(**snake_case__   ,       pad_token_id=snake_case__   ,       bos_token_id=snake_case__   ,       eos_token_id=snake_case__	)
         _lowercase     =	hidden_size
         _lowercase     =	feat_extract_norm
         _lowercase     =	feat_extract_activation
         _lowercase     =	list(snake_case__	)
         _lowercase     =	list(snake_case__	)
         _lowercase     =	list(snake_case__	)
         _lowercase     =	conv_bias
         _lowercase     =	num_conv_pos_embeddings
         _lowercase     =	num_conv_pos_embedding_groups
         _lowercase     =	len(self.conv_dim	)
         _lowercase     =	num_hidden_layers
         _lowercase     =	intermediate_size
         _lowercase     =	hidden_act
         _lowercase     =	num_attention_heads
         _lowercase     =	hidden_dropout
         _lowercase     =	attention_dropout
         _lowercase     =	activation_dropout
         _lowercase     =	feat_proj_layer_norm
         _lowercase     =	feat_proj_dropout
         _lowercase     =	final_dropout
         _lowercase     =	layerdrop
         _lowercase     =	layer_norm_eps
         _lowercase     =	initializer_range
         _lowercase     =	vocab_size
         _lowercase     =	do_stable_layer_norm
         _lowercase     =	use_weighted_layer_sum
         _lowercase     =	classifier_proj_size
  
         if (
             (len(self.conv_stride	) != self.num_feat_extract_layers)
             or (len(self.conv_kernel	) != self.num_feat_extract_layers)
             or (len(self.conv_dim	) != self.num_feat_extract_layers)
         ):
             raise ValueError(
                 'Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =='
                 ' `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ='
                 f''' {len(self.conv_dim	)}`, `len(config.conv_stride) = {len(self.conv_stride	)}`,'''
                 f''' `len(config.conv_kernel) = {len(self.conv_kernel	)}`.'''	)
  
         # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
         _lowercase     =	apply_spec_augment
         _lowercase     =	mask_time_prob
         _lowercase     =	mask_time_length
         _lowercase     =	mask_time_min_masks
         _lowercase     =	mask_feature_prob
         _lowercase     =	mask_feature_length
         _lowercase     =	mask_feature_min_masks
  
         # ctc loss
         _lowercase     =	ctc_loss_reduction
         _lowercase     =	ctc_zero_infinity
  
     @property
     def 			SCREAMING_SNAKE_CASE__				(    self:	int	)  ->		Optional[int]:
  
  
         """simple docstring"""
  
  
  
         return functools.reduce(operator.mul   ,       self.conv_stride   ,       1	)
  