






import pytest

import datasets.config
from datasets.utils.info_utils import is_small_dataset







@pytest.mark.parametrize("""dataset_size"""		,  [None, 400 * 2**20, 600 * 2**20]	)
@pytest.mark.parametrize("""input_in_memory_max_size"""		,  ["""default""", 0, 100 * 2**20, 900 * 2**20]	)
def 			A__							(      _a  :					List[Any]		,  _a  :					Union[str, Any]		,  _a  :					int	):





 '''simple docstring'''







 if input_in_memory_max_size != "default":
  monkeypatch.setattr(datasets.config		,  """IN_MEMORY_MAX_SIZE"""		,  _a	)
 snake_case__  :    List[str]							       =datasets.config.IN_MEMORY_MAX_SIZE
 if input_in_memory_max_size == "default":
  assert in_memory_max_size == 0
 else:
  assert in_memory_max_size == input_in_memory_max_size
 if dataset_size and in_memory_max_size:
  snake_case__  :    Union[str, Any]							       =dataset_size < in_memory_max_size
 else:
  snake_case__  :    Union[str, Any]							       =False
 snake_case__  :    List[str]							       =is_small_dataset(_a	)
 assert result == expected













import argparse

from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird
from transformers.utils import logging


logging.set_verbosity_info()







def 			A__							(      _a  :					int		,  _a  :					Any		,  _a  :					Union[str, Any]		,  _a  :					Tuple	):





 '''simple docstring'''







 snake_case__  :    Any							       =BigBirdConfig.from_json_file(_a	)
 print(f"Building PyTorch model from configuration: {config}"	)

 if is_trivia_qa:
  snake_case__  :    str							       =BigBirdForQuestionAnswering(_a	)
 else:
  snake_case__  :    Optional[int]							       =BigBirdForPreTraining(_a	)

 # Load weights from tf checkpoint
 load_tf_weights_in_big_bird(_a		,  _a		,  is_trivia_qa=_a	)

 # Save pytorch-model
 print(f"Save PyTorch model to {pytorch_dump_path}"	)
 model.save_pretrained(_a	)


if __name__ == "__main__":
       __lowerCamelCase	:		Union[str, Any]										=   argparse.ArgumentParser()
       # Required parameters
       parser.add_argument(
           """--tf_checkpoint_path""", default=None, type=str, required=True, help="""Path to the TensorFlow checkpoint path."""
       )
       parser.add_argument(
           """--big_bird_config_file""",
           default=None,
           type=str,
           required=True,
           help=(
               """The config json file corresponding to the pre-trained BERT model. \n"""
               """This specifies the model architecture."""
           ),
       )
       parser.add_argument(
           """--pytorch_dump_path""", default=None, type=str, required=True, help="""Path to the output PyTorch model."""
       )
       parser.add_argument(
           """--is_trivia_qa""", action="""store_true""", help="""Whether to convert a model with a trivia_qa head."""
       )
       __lowerCamelCase	:		Tuple										=   parser.parse_args()
       convert_tf_checkpoint_to_pytorch(
           args.tf_checkpoint_path, args.big_bird_config_file, args.pytorch_dump_path, args.is_trivia_qa
       )





