code: 
  
  
  import argparse
  
  from . import (
      BertConfig,
      BertGenerationConfig,
      BertGenerationDecoder,
      BertGenerationEncoder,
      load_tf_weights_in_bert_generation,
      logging,
  )
  
  
  logging.set_verbosity_info()
  
  
  
  
  
  
  def   __lowerCamelCase	(       lowerCamelCase__		:	Optional[Any]     ,       lowerCamelCase__		:	str     ,       lowerCamelCase__		:	str     ,       lowerCamelCase__		:	int     ,       lowerCamelCase__		:	Optional[Any]			):
  
  
  
  
  
  			'''simple docstring'''
  
  
  
  
  			lowerCamelCase								=     BertConfig.from_pretrained(
  			    """bert-large-cased"""     ,       vocab_size=snake_case_     ,       max_position_embeddings=512     ,       is_decoder=snake_case_     ,       add_cross_attention=snake_case_     ,       )
  			lowerCamelCase								=     bert_config.to_dict()
  			del bert_config_dict["type_vocab_size"]
  			lowerCamelCase								=     BertGenerationConfig(**snake_case_			)
  			if is_encoder:
  						lowerCamelCase								=     BertGenerationEncoder(snake_case_			)
  			else:
  						lowerCamelCase								=     BertGenerationDecoder(snake_case_			)
  			print(f'Building PyTorch model from configuration: {config}'			)
  
  			# Load weights from tf checkpoint
  			load_tf_weights_in_bert_generation(
  			    snake_case_     ,       snake_case_     ,       model_class="""bert"""     ,       is_encoder_named_decoder=snake_case_     ,       is_encoder=snake_case_     ,       )
  
  			# Save pytorch-model
  			print(f'Save PyTorch model and config to {pytorch_dump_path}'			)
  			model.save_pretrained(snake_case_			)
  
  
  if __name__ == "__main__":
  			UpperCAmelCase      :						Optional[int]    =		argparse.ArgumentParser()
  			# Required parameters
  			parser.add_argument(
  			    "--tf_hub_path", default=None, type=str, required=True, help="Path to the TensorFlow checkpoint path."
  			)
  			parser.add_argument(
  			    "--pytorch_dump_path", default=None, type=str, required=True, help="Path to the output PyTorch model."
  			)
  			parser.add_argument(
  			    "--is_encoder_named_decoder",
  			    action="store_true",
  			    help="If decoder has to be renamed to encoder in PyTorch model.",
  			)
  			parser.add_argument("--is_encoder", action="store_true", help="If model is an encoder.")
  			parser.add_argument("--vocab_size", default=5_03_58, type=int, help="Vocab size of model")
  			UpperCAmelCase      :						str    =		parser.parse_args()
  			convert_tf_checkpoint_to_pytorch(
  			    args.tf_hub_path,
  			    args.pytorch_dump_path,
  			    args.is_encoder_named_decoder,
  			    args.vocab_size,
  			    is_encoder=args.is_encoder,
  			)
  
  
style_context: 
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import (
      OptionalDependencyNotAvailable,
      _LazyModule,
      is_flax_available,
      is_sentencepiece_available,
      is_tf_available,
      is_tokenizers_available,
      is_torch_available,
  )
  
  
  UpperCAmelCase      :						List[str]    =		{
      "configuration_big_bird": ["BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdConfig", "BigBirdOnnxConfig"],
  }
  
  try:
  		if not is_sentencepiece_available():
  				raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  		pass
  else:
  		UpperCAmelCase      :						str    =		["BigBirdTokenizer"]
  
  try:
  		if not is_tokenizers_available():
  				raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  		pass
  else:
  		UpperCAmelCase      :						str    =		["BigBirdTokenizerFast"]
  
  try:
  		if not is_torch_available():
  				raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  		pass
  else:
  		UpperCAmelCase      :						Dict    =		[
  		    "BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST",
  		    "BigBirdForCausalLM",
  		    "BigBirdForMaskedLM",
  		    "BigBirdForMultipleChoice",
  		    "BigBirdForPreTraining",
  		    "BigBirdForQuestionAnswering",
  		    "BigBirdForSequenceClassification",
  		    "BigBirdForTokenClassification",
  		    "BigBirdLayer",
  		    "BigBirdModel",
  		    "BigBirdPreTrainedModel",
  		    "load_tf_weights_in_big_bird",
  		]
  
  try:
  		if not is_flax_available():
  				raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  		pass
  else:
  		UpperCAmelCase      :						Dict    =		[
  		    "FlaxBigBirdForCausalLM",
  		    "FlaxBigBirdForMaskedLM",
  		    "FlaxBigBirdForMultipleChoice",
  		    "FlaxBigBirdForPreTraining",
  		    "FlaxBigBirdForQuestionAnswering",
  		    "FlaxBigBirdForSequenceClassification",
  		    "FlaxBigBirdForTokenClassification",
  		    "FlaxBigBirdModel",
  		    "FlaxBigBirdPreTrainedModel",
  		]
  
  if TYPE_CHECKING:
  		from .configuration_big_bird import BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP, BigBirdConfig, BigBirdOnnxConfig
  
  		try:
  				if not is_sentencepiece_available():
  						raise OptionalDependencyNotAvailable()
  		except OptionalDependencyNotAvailable:
  				pass
  		else:
  				from .tokenization_big_bird import BigBirdTokenizer
  
  		try:
  				if not is_tokenizers_available():
  						raise OptionalDependencyNotAvailable()
  		except OptionalDependencyNotAvailable:
  				pass
  		else:
  				from .tokenization_big_bird_fast import BigBirdTokenizerFast
  
  		try:
  				if not is_torch_available():
  						raise OptionalDependencyNotAvailable()
  		except OptionalDependencyNotAvailable:
  				pass
  		else:
  				from .modeling_big_bird import (
  				    BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST,
  				    BigBirdForCausalLM,
  				    BigBirdForMaskedLM,
  				    BigBirdForMultipleChoice,
  				    BigBirdForPreTraining,
  				    BigBirdForQuestionAnswering,
  				    BigBirdForSequenceClassification,
  				    BigBirdForTokenClassification,
  				    BigBirdLayer,
  				    BigBirdModel,
  				    BigBirdPreTrainedModel,
  				    load_tf_weights_in_big_bird,
  				)
  
  		try:
  				if not is_flax_available():
  						raise OptionalDependencyNotAvailable()
  		except OptionalDependencyNotAvailable:
  				pass
  		else:
  				from .modeling_flax_big_bird import (
  				    FlaxBigBirdForCausalLM,
  				    FlaxBigBirdForMaskedLM,
  				    FlaxBigBirdForMultipleChoice,
  				    FlaxBigBirdForPreTraining,
  				    FlaxBigBirdForQuestionAnswering,
  				    FlaxBigBirdForSequenceClassification,
  				    FlaxBigBirdForTokenClassification,
  				    FlaxBigBirdModel,
  				    FlaxBigBirdPreTrainedModel,
  				)
  
  else:
  		import sys
  
  		UpperCAmelCase      :						Dict    =		_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
  
  