





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			(    A				,							A				,							A     ):




   '''simple docstring'''

   UpperCAmelCase__						=MobileBertConfig.from_json_file(SCREAMING_SNAKE_CASE_     )
   print(F"""Building PyTorch model from configuration: {config}"""     )
   UpperCAmelCase__						=MobileBertForPreTraining(SCREAMING_SNAKE_CASE_     )
   # Load weights from tf checkpoint
   UpperCAmelCase__						=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__":
    UpperCamelCase_												=	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.'
    )
    UpperCamelCase_												=	parser.parse_args()
    convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.mobilebert_config_file, args.pytorch_dump_path)










from __future__ import annotations
def      A__       (    SCREAMING_SNAKE_CASE_   :      int						)  ->  bool:






   """simple docstring"""







   _UpperCAmelCase           =   str(SCREAMING_SNAKE_CASE_						)
   return len(SCREAMING_SNAKE_CASE_						) == 9 and set(SCREAMING_SNAKE_CASE_						) == set('''123456789'''						)
def      A__       (    )  ->  int | None:






   """simple docstring"""







   for base_num in range(99_99				,	49_99				,	-1						):
      _UpperCAmelCase           =   10_00_02 * base_num
      if is_9_pandigital(SCREAMING_SNAKE_CASE_						):
         return candidate

   for base_num in range(3_33				,	99				,	-1						):
      _UpperCAmelCase           =   1_00_20_03 * base_num
      if is_9_pandigital(SCREAMING_SNAKE_CASE_						):
         return candidate

   return None


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