





'''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


A_				     =							10_00_00_00_00_00
A_				     =							1_00_00

A_				     =							os.path.split(__file__)
A_				     =							os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))




def       A							(      _UpperCAmelCase   :				List[Any]						,_UpperCAmelCase   :				List[Any]					)  ->				Dict:


  '''simple docstring'''




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


@dataclass
class 		UpperCamelCase__     :
      '''simple docstring'''






      _snake_case           =				42
      _snake_case           =				42
      _snake_case           =				42
      _snake_case           =				42




      def 	snake_case  (     self )				->  Any:
        __lowerCAmelCase		:    Optional[Any]			     =  np.random.default_rng(self.seed )
        __lowerCAmelCase		:    int			     =  rng.integers(low=self.low     , high=self.high     , size=self.size ).tolist()




      def __iter__(     self )				->  Optional[Any]:
        return iter(self._sampled_values )







      def __len__(     self )				->  str:
        return self.size




@get_duration
def       A							(      _UpperCAmelCase   :				str					)  ->				str:


  '''simple docstring'''




  __lowerCAmelCase		:    List[str]			     =  dataset[0]




@get_duration
def       A							(      _UpperCAmelCase   :				Optional[int]					)  ->				Optional[Any]:


  '''simple docstring'''




  __lowerCAmelCase		:    List[str]			     =  dataset[-1]




@get_duration
def       A							(      _UpperCAmelCase   :				str					)  ->				List[Any]:


  '''simple docstring'''




  __lowerCAmelCase		:    Optional[int]			     =  dataset[range(len(_lowerCAmelCase					) // 2						,len(_lowerCAmelCase					) // 2 + 1_0_2_4					)]




@get_duration
def       A							(      _UpperCAmelCase   :				Union[str, Any]					)  ->				str:


  '''simple docstring'''




  __lowerCAmelCase		:    Dict			     =  dataset[RandIter(0						,len(_lowerCAmelCase					)						,1_0_2_4						,seed=4_2					)]




def       A							(      )  ->				List[str]:


  '''simple docstring'''




  __lowerCAmelCase		:    Tuple			     =  {'num examples': SPEED_TEST_N_EXAMPLES}
  __lowerCAmelCase		:    List[Any]			     =  (get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
  print('generating dataset'					)
  __lowerCAmelCase		:    int			     =  generate_100B_dataset(num_examples=_lowerCAmelCase						,chunk_size=_lowerCAmelCase					)
  print('Functions'					)
  for func in functions:
    print(func.__name__					)
    __lowerCAmelCase		:    Dict			     =  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()










from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase :				List[Any]							={"""configuration_qdqbert""": ["""QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """QDQBertConfig"""]}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	UpperCAmelCase :				Dict							=[
	    """QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
	    """QDQBertForMaskedLM""",
	    """QDQBertForMultipleChoice""",
	    """QDQBertForNextSentencePrediction""",
	    """QDQBertForQuestionAnswering""",
	    """QDQBertForSequenceClassification""",
	    """QDQBertForTokenClassification""",
	    """QDQBertLayer""",
	    """QDQBertLMHeadModel""",
	    """QDQBertModel""",
	    """QDQBertPreTrainedModel""",
	    """load_tf_weights_in_qdqbert""",
	]


if TYPE_CHECKING:
	from .configuration_qdqbert import QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, QDQBertConfig

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_qdqbert import (
		    QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    QDQBertForMaskedLM,
		    QDQBertForMultipleChoice,
		    QDQBertForNextSentencePrediction,
		    QDQBertForQuestionAnswering,
		    QDQBertForSequenceClassification,
		    QDQBertForTokenClassification,
		    QDQBertLayer,
		    QDQBertLMHeadModel,
		    QDQBertModel,
		    QDQBertPreTrainedModel,
		    load_tf_weights_in_qdqbert,
		)


else:
	import sys

	UpperCAmelCase :				Optional[Any]							=_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
