




'''simple docstring'''






import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


lowercase	:      List[str]				=       100000000000
lowercase	:      Tuple				=       10000

lowercase	,	lowercase	:      List[Any]				=       os.path.split(__file__)
lowercase	:      Optional[int]				=       os.path.join(RESULTS_BASEPATH, '''results''', RESULTS_FILENAME.replace('''.py''', '''.json'''))




def 		a_( lowerCamelCase   ,				lowerCamelCase      )				->datasets.Dataset:






       '''simple docstring'''




       lowercase  :		List[str]						=      pa.Table.from_pydict({'''col''': [0] * chunk_size}      )
       lowercase  :		Union[str, Any]						=      pa.concat_tables([table] * (num_examples // chunk_size)      )
       return datasets.Dataset(lowerCamelCase   ,				fingerprint='''table_100B'''      )

@dataclass
class   SCREAMING_SNAKE_CASE_		:
 __snake_case	:     int
 __snake_case	:     int
 __snake_case	:     int
 __snake_case	:     int



 def    SCREAMING_SNAKE_CASE(  self ):






        '''simple docstring'''




        lowercase  :		Optional[int]						=      np.random.default_rng(self.seed )
        lowercase  :		Union[str, Any]						=      rng.integers(low=self.low   ,		high=self.high   ,		size=self.size ).tolist()



 def __iter__(  self ):






        '''simple docstring'''




        return iter(self._sampled_values )





 def __len__(  self ):






        '''simple docstring'''




        return self.size






@get_duration
def 		a_( lowerCamelCase      )				->Optional[int]:






       '''simple docstring'''




       lowercase  :		Optional[Any]						=      dataset[0]




@get_duration
def 		a_( lowerCamelCase      )				->Tuple:






       '''simple docstring'''




       lowercase  :		int						=      dataset[-1]




@get_duration
def 		a_( lowerCamelCase      )				->Optional[Any]:






       '''simple docstring'''




       lowercase  :		Optional[int]						=      dataset[range(len(lowerCamelCase      ) // 2   ,				len(lowerCamelCase      ) // 2 + 1024      )]




@get_duration
def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       lowercase  :		Any						=      dataset[RandIter(0   ,				len(lowerCamelCase      )   ,				1024   ,				seed=42      )]




def 		a_( )				->Optional[int]:






       '''simple docstring'''




       lowercase  :		str						=      {'''num examples''': SPEED_TEST_N_EXAMPLES}
       lowercase  :		Union[str, Any]						=      (get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
       print('''generating dataset'''      )
       lowercase  :		Optional[Any]						=      generate_100B_dataset(num_examples=lowerCamelCase   ,				chunk_size=lowerCamelCase      )
       print('''Functions'''      )
       for func in functions:
              print(func.__name__      )
              lowercase  :		Any						=      func(lowerCamelCase      )

       with open(lowerCamelCase   ,				'''wb'''      ) as f:
              f.write(json.dumps(lowerCamelCase      ).encode('''utf-8'''      )      )


if __name__ == "__main__":  # useful to run the profiler
      benchmark_table_100B()










'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowercase	:      Optional[int]				=       {
    '''configuration_prophetnet''': ['''PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ProphetNetConfig'''],
    '''tokenization_prophetnet''': ['''ProphetNetTokenizer'''],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase	:      List[str]				=       [
          '''PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''ProphetNetDecoder''',
          '''ProphetNetEncoder''',
          '''ProphetNetForCausalLM''',
          '''ProphetNetForConditionalGeneration''',
          '''ProphetNetModel''',
          '''ProphetNetPreTrainedModel''',
      ]


if TYPE_CHECKING:
      from .configuration_prophetnet import PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, ProphetNetConfig
      from .tokenization_prophetnet import ProphetNetTokenizer

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_prophetnet import (
                PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST,
                ProphetNetDecoder,
                ProphetNetEncoder,
                ProphetNetForCausalLM,
                ProphetNetForConditionalGeneration,
                ProphetNetModel,
                ProphetNetPreTrainedModel,
            )

else:
      import sys

      lowercase	:      int				=       _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




