





import argparse

import torch

from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert
from transformers.utils import logging


logging.set_verbosity_info()




def       __UpperCamelCase  (_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		)    ->       Any:
  # Initialise PyTorch model
  lowercase__           =  MobileBertConfig.from_json_file(_SCREAMING_SNAKE_CASE		)
  print(F"""Building PyTorch model from configuration: {config}"""		)
  lowercase__           =  MobileBertForPreTraining(_SCREAMING_SNAKE_CASE		)
  # Load weights from tf checkpoint
  lowercase__           =  load_tf_weights_in_mobilebert(_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		)
  # Save pytorch-model
  print(F"""Save PyTorch model to {pytorch_dump_path}"""		)
  torch.save(model.state_dict()		,						_SCREAMING_SNAKE_CASE		)


if __name__ == "__main__":
      lowercase_          =		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(
          """--mobilebert_config_file""",
          default=None,
          type=str,
          required=True,
          help=(
              """The config json file corresponding to the pre-trained MobileBERT 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."""
      )
      lowercase_          =		parser.parse_args()
      convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.mobilebert_config_file, args.pytorch_dump_path)









def       __UpperCamelCase  (_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		)    ->       int:

  if exponent == 1:
    return base
  if exponent % 2 == 0:
    lowercase__           =  _modexpt(_SCREAMING_SNAKE_CASE		,						exponent // 2		,						_SCREAMING_SNAKE_CASE		) % modulo_value
    return (x * x) % modulo_value
  else:
    return (base * _modexpt(_SCREAMING_SNAKE_CASE		,						exponent - 1		,						_SCREAMING_SNAKE_CASE		)) % modulo_value




def       __UpperCamelCase  (_SCREAMING_SNAKE_CASE = 1777		,						_SCREAMING_SNAKE_CASE = 1855		,						_SCREAMING_SNAKE_CASE = 8		)    ->       int:
  lowercase__           =  base
  for _ in range(1		,						_SCREAMING_SNAKE_CASE		):
    lowercase__           =  _modexpt(_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		,						10**digits		)

  return result


if __name__ == "__main__":
      print(f'''{solution() = }''')


