
'''simple docstring'''





import unittest

from transformers import AlbertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
		import torch

		from transformers import (
		    MODEL_FOR_PRETRAINING_MAPPING,
		    AlbertForMaskedLM,
		    AlbertForMultipleChoice,
		    AlbertForPreTraining,
		    AlbertForQuestionAnswering,
		    AlbertForSequenceClassification,
		    AlbertForTokenClassification,
		    AlbertModel,
		)
		from transformers.models.albert.modeling_albert import ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST







class        lowerCAmelCase__      :

						def __init__(			self       ,							a       ,							a=13       ,							a=7       ,							a=True       ,							a=True       ,							a=True       ,							a=True       ,							a=99       ,							a=16       ,							a=36       ,							a=6       ,							a=6       ,							a=6       ,							a=37       ,							a="gelu"       ,							a=0.1       ,							a=0.1       ,							a=5_12       ,							a=16       ,							a=2       ,							a=0.02       ,							a=3       ,							a=4       ,							a=None       ,							)					->      Tuple:


								'''simple docstring'''

								_UpperCamelCase						    =	parent
								_UpperCamelCase						    =	batch_size
								_UpperCamelCase						    =	seq_length
								_UpperCamelCase						    =	is_training
								_UpperCamelCase						    =	use_input_mask
								_UpperCamelCase						    =	use_token_type_ids
								_UpperCamelCase						    =	use_labels
								_UpperCamelCase						    =	vocab_size
								_UpperCamelCase						    =	embedding_size
								_UpperCamelCase						    =	hidden_size
								_UpperCamelCase						    =	num_hidden_layers
								_UpperCamelCase						    =	num_hidden_groups
								_UpperCamelCase						    =	num_attention_heads
								_UpperCamelCase						    =	intermediate_size
								_UpperCamelCase						    =	hidden_act
								_UpperCamelCase						    =	hidden_dropout_prob
								_UpperCamelCase						    =	attention_probs_dropout_prob
								_UpperCamelCase						    =	max_position_embeddings
								_UpperCamelCase						    =	type_vocab_size
								_UpperCamelCase						    =	type_sequence_label_size
								_UpperCamelCase						    =	initializer_range
								_UpperCamelCase						    =	num_labels
								_UpperCamelCase						    =	num_choices
								_UpperCamelCase						    =	scope

						def  A_				(			self				)					->      Optional[Any]:


								'''simple docstring'''

								_UpperCamelCase						    =	ids_tensor([self.batch_size, self.seq_length]       ,							self.vocab_size				)

								_UpperCamelCase						    =	None
								if self.use_input_mask:
										_UpperCamelCase						    =	random_attention_mask([self.batch_size, self.seq_length]				)

								_UpperCamelCase						    =	None
								if self.use_token_type_ids:
										_UpperCamelCase						    =	ids_tensor([self.batch_size, self.seq_length]       ,							self.type_vocab_size				)

								_UpperCamelCase						    =	None
								_UpperCamelCase						    =	None
								_UpperCamelCase						    =	None
								if self.use_labels:
										_UpperCamelCase						    =	ids_tensor([self.batch_size]       ,							self.type_sequence_label_size				)
										_UpperCamelCase						    =	ids_tensor([self.batch_size, self.seq_length]       ,							self.num_labels				)
										_UpperCamelCase						    =	ids_tensor([self.batch_size]       ,							self.num_choices				)

								_UpperCamelCase						    =	self.get_config()

								return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels

						def  A_				(			self				)					->      Union[str, Any]:


								'''simple docstring'''

								return AlbertConfig(
								    vocab_size=self.vocab_size       ,							hidden_size=self.hidden_size       ,							num_hidden_layers=self.num_hidden_layers       ,							num_attention_heads=self.num_attention_heads       ,							intermediate_size=self.intermediate_size       ,							hidden_act=self.hidden_act       ,							hidden_dropout_prob=self.hidden_dropout_prob       ,							attention_probs_dropout_prob=self.attention_probs_dropout_prob       ,							max_position_embeddings=self.max_position_embeddings       ,							type_vocab_size=self.type_vocab_size       ,							initializer_range=self.initializer_range       ,							num_hidden_groups=self.num_hidden_groups       ,							)

						def  A_				(			self       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a				)					->      List[str]:


								'''simple docstring'''

								_UpperCamelCase						    =	AlbertModel(config=a				)
								model.to(a				)
								model.eval()
								_UpperCamelCase						    =	model(a       ,							attention_mask=a       ,							token_type_ids=a				)
								_UpperCamelCase						    =	model(a       ,							token_type_ids=a				)
								_UpperCamelCase						    =	model(a				)
								self.parent.assertEqual(result.last_hidden_state.shape       ,							(self.batch_size, self.seq_length, self.hidden_size)				)
								self.parent.assertEqual(result.pooler_output.shape       ,							(self.batch_size, self.hidden_size)				)

						def  A_				(			self       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a				)					->      int:


								'''simple docstring'''

								_UpperCamelCase						    =	AlbertForPreTraining(config=a				)
								model.to(a				)
								model.eval()
								_UpperCamelCase						    =	model(
								    a       ,							attention_mask=a       ,							token_type_ids=a       ,							labels=a       ,							sentence_order_label=a       ,							)
								self.parent.assertEqual(result.prediction_logits.shape       ,							(self.batch_size, self.seq_length, self.vocab_size)				)
								self.parent.assertEqual(result.sop_logits.shape       ,							(self.batch_size, config.num_labels)				)

						def  A_				(			self       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a				)					->      Union[str, Any]:


								'''simple docstring'''

								_UpperCamelCase						    =	AlbertForMaskedLM(config=a				)
								model.to(a				)
								model.eval()
								_UpperCamelCase						    =	model(a       ,							attention_mask=a       ,							token_type_ids=a       ,							labels=a				)
								self.parent.assertEqual(result.logits.shape       ,							(self.batch_size, self.seq_length, self.vocab_size)				)

						def  A_				(			self       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a				)					->      Any:


								'''simple docstring'''

								_UpperCamelCase						    =	AlbertForQuestionAnswering(config=a				)
								model.to(a				)
								model.eval()
								_UpperCamelCase						    =	model(
								    a       ,							attention_mask=a       ,							token_type_ids=a       ,							start_positions=a       ,							end_positions=a       ,							)
								self.parent.assertEqual(result.start_logits.shape       ,							(self.batch_size, self.seq_length)				)
								self.parent.assertEqual(result.end_logits.shape       ,							(self.batch_size, self.seq_length)				)

						def  A_				(			self       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a				)					->      str:


								'''simple docstring'''

								_UpperCamelCase						    =	self.num_labels
								_UpperCamelCase						    =	AlbertForSequenceClassification(a				)
								model.to(a				)
								model.eval()
								_UpperCamelCase						    =	model(a       ,							attention_mask=a       ,							token_type_ids=a       ,							labels=a				)
								self.parent.assertEqual(result.logits.shape       ,							(self.batch_size, self.num_labels)				)

						def  A_				(			self       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a				)					->      List[str]:


								'''simple docstring'''

								_UpperCamelCase						    =	self.num_labels
								_UpperCamelCase						    =	AlbertForTokenClassification(config=a				)
								model.to(a				)
								model.eval()
								_UpperCamelCase						    =	model(a       ,							attention_mask=a       ,							token_type_ids=a       ,							labels=a				)
								self.parent.assertEqual(result.logits.shape       ,							(self.batch_size, self.seq_length, self.num_labels)				)

						def  A_				(			self       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a       ,							a				)					->      Optional[Any]:


								'''simple docstring'''

								_UpperCamelCase						    =	self.num_choices
								_UpperCamelCase						    =	AlbertForMultipleChoice(config=a				)
								model.to(a				)
								model.eval()
								_UpperCamelCase						    =	input_ids.unsqueeze(1				).expand(-1       ,							self.num_choices       ,							-1				).contiguous()
								_UpperCamelCase						    =	token_type_ids.unsqueeze(1				).expand(-1       ,							self.num_choices       ,							-1				).contiguous()
								_UpperCamelCase						    =	input_mask.unsqueeze(1				).expand(-1       ,							self.num_choices       ,							-1				).contiguous()
								_UpperCamelCase						    =	model(
								    a       ,							attention_mask=a       ,							token_type_ids=a       ,							labels=a       ,							)
								self.parent.assertEqual(result.logits.shape       ,							(self.batch_size, self.num_choices)				)







						def  A_				(			self				)					->      int:


								'''simple docstring'''

								_UpperCamelCase						    =	self.prepare_config_and_inputs()
								(
								    (
								    _UpperCamelCase	
								)    ,	(
								    _UpperCamelCase	
								)    ,	(
								    _UpperCamelCase	
								)    ,	(
								    _UpperCamelCase	
								)    ,	(
								    _UpperCamelCase	
								)    ,	(
								    _UpperCamelCase	
								)    ,	(
								    _UpperCamelCase	
								)    ,		
								)						    =	config_and_inputs
								_UpperCamelCase						    =	{"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
								return config, inputs_dict







@require_torch
class        lowerCAmelCase__      (   __lowercase		,	__lowercase		,	unittest.TestCase	):
						UpperCamelCase_							: Dict	=		(
						    (
						        AlbertModel,
						        AlbertForPreTraining,
						        AlbertForMaskedLM,
						        AlbertForMultipleChoice,
						        AlbertForSequenceClassification,
						        AlbertForTokenClassification,
						        AlbertForQuestionAnswering,
						    )
						    if is_torch_available()
						    else ()
						)
						UpperCamelCase_							: List[str]	=		(
						    {
						        "feature-extraction": AlbertModel,
						        "fill-mask": AlbertForMaskedLM,
						        "question-answering": AlbertForQuestionAnswering,
						        "text-classification": AlbertForSequenceClassification,
						        "token-classification": AlbertForTokenClassification,
						        "zero-shot": AlbertForSequenceClassification,
						    }
						    if is_torch_available()
						    else {}
						)
						UpperCamelCase_							: Optional[int]	=		True

						def  A_				(			self       ,							a       ,							a       ,							a=False				)					->      Optional[Any]:


								'''simple docstring'''

								_UpperCamelCase						    =	super()._prepare_for_class(a       ,							a       ,							return_labels=a				)

								if return_labels:
										if model_class in get_values(a				):
												_UpperCamelCase						    =	torch.zeros(
												    (self.model_tester.batch_size, self.model_tester.seq_length)       ,							dtype=torch.long       ,							device=a				)
												_UpperCamelCase						    =	torch.zeros(
												    self.model_tester.batch_size       ,							dtype=torch.long       ,							device=a				)
								return inputs_dict

						def  A_				(			self				)					->      Union[str, Any]:


								'''simple docstring'''

								_UpperCamelCase						    =	AlbertModelTester(self				)
								_UpperCamelCase						    =	ConfigTester(self       ,							config_class=a       ,							hidden_size=37				)

						def  A_				(			self				)					->      int:


								'''simple docstring'''

								self.config_tester.run_common_tests()

						def  A_				(			self				)					->      List[str]:


								'''simple docstring'''

								_UpperCamelCase						    =	self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*a				)

						def  A_				(			self				)					->      Tuple:


								'''simple docstring'''

								_UpperCamelCase						    =	self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_pretraining(*a				)

						def  A_				(			self				)					->      Optional[int]:


								'''simple docstring'''

								_UpperCamelCase						    =	self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_masked_lm(*a				)

						def  A_				(			self				)					->      List[Any]:


								'''simple docstring'''

								_UpperCamelCase						    =	self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_multiple_choice(*a				)

						def  A_				(			self				)					->      Dict:


								'''simple docstring'''

								_UpperCamelCase						    =	self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_question_answering(*a				)

						def  A_				(			self				)					->      Tuple:


								'''simple docstring'''

								_UpperCamelCase						    =	self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_sequence_classification(*a				)

						def  A_				(			self				)					->      List[str]:


								'''simple docstring'''

								_UpperCamelCase						    =	self.model_tester.prepare_config_and_inputs()
								for type in ["absolute", "relative_key", "relative_key_query"]:
										_UpperCamelCase						    =	type
										self.model_tester.create_and_check_model(*a				)







						@slow
						def  A_				(			self				)					->      List[str]:


								'''simple docstring'''

								for model_name in ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
										_UpperCamelCase						    =	AlbertModel.from_pretrained(a				)
										self.assertIsNotNone(a				)







@require_torch
class        lowerCAmelCase__      (   unittest.TestCase	):

						@slow
						def  A_				(			self				)					->      Dict:


								'''simple docstring'''

								_UpperCamelCase						    =	AlbertModel.from_pretrained("""albert-base-v2"""				)
								_UpperCamelCase						    =	torch.tensor([[0, 3_45, 2_32, 3_28, 7_40, 1_40, 16_95, 69, 60_78, 15_88, 2]]				)
								_UpperCamelCase						    =	torch.tensor([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]				)
								with torch.no_grad():
										_UpperCamelCase						    =	model(a       ,							attention_mask=a				)[0]
								_UpperCamelCase						    =	torch.Size((1, 11, 7_68)				)
								self.assertEqual(output.shape       ,							a				)
								_UpperCamelCase						    =	torch.tensor(
								    [[[-0.6513, 1.5035, -0.2766], [-0.6515, 1.5046, -0.2780], [-0.6512, 1.5049, -0.2784]]]				)

								self.assertTrue(torch.allclose(output[:, 1:4, 1:4]       ,							a       ,							atol=1e-4				)				)





import argparse
import os
import re

import tensorflow as tf
import torch

from transformers import BertConfig, BertModel
from transformers.utils import logging


logging.set_verbosity_info()
lowerCamelCase__	=							logging.get_logger(__name__)


def 							__A(lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase )		->				Any:

		"""simple docstring"""






		_UpperCamelCase						    =	os.path.abspath(lowerCAmelCase )
		logger.info(F'Converting TensorFlow checkpoint from {tf_path}' )
		# Load weights from TF model
		_UpperCamelCase						    =	tf.train.list_variables(lowerCAmelCase )
		_UpperCamelCase						    =	[]
		_UpperCamelCase						    =	[]
		_UpperCamelCase						    =	[]
		for full_name, shape in init_vars:
				# logger.info(f"Loading TF weight {name} with shape {shape}")
				_UpperCamelCase						    =	full_name.split("""/""" )
				if full_name == "_CHECKPOINTABLE_OBJECT_GRAPH" or name[0] in ["global_step", "save_counter"]:
						logger.info(F'Skipping non-model layer {full_name}' )
						continue
				if "optimizer" in full_name:
						logger.info(F'Skipping optimization layer {full_name}' )
						continue
				if name[0] == "model":
						# ignore initial 'model'
						_UpperCamelCase						    =	name[1:]
				# figure out how many levels deep the name is
				_UpperCamelCase						    =	0
				for _name in name:
						if _name.startswith("""layer_with_weights""" ):
								depth += 1
						else:
								break
				layer_depth.append(lowerCAmelCase )
				# read data
				_UpperCamelCase						    =	tf.train.load_variable(lowerCAmelCase						,  lowerCAmelCase )
				names.append("""/""".join(lowerCAmelCase ) )
				arrays.append(lowerCAmelCase )
		logger.info(F'Read a total of {len(lowerCAmelCase ):,} layers' )

		# Sanity check
		if len(set(lowerCAmelCase ) ) != 1:
				raise ValueError(F'Found layer names with different depths (layer depth {list(set(lowerCAmelCase ) )})' )
		_UpperCamelCase						    =	list(set(lowerCAmelCase ) )[0]
		if layer_depth != 1:
				raise ValueError(
				    """The model contains more than just the embedding/encoder layers. This script does not handle MLM/NSP"""
				    """ heads.""" )

		# convert layers
		logger.info("""Converting weights...""" )
		for full_name, array in zip(lowerCAmelCase						,  lowerCAmelCase ):
				_UpperCamelCase						    =	full_name.split("""/""" )
				_UpperCamelCase						    =	model
				_UpperCamelCase						    =	[]
				for i, m_name in enumerate(lowerCAmelCase ):
						if m_name == ".ATTRIBUTES":
								# variable names end with .ATTRIBUTES/VARIABLE_VALUE
								break
						if m_name.startswith("""layer_with_weights""" ):
								_UpperCamelCase						    =	int(m_name.split("""-""" )[-1] )
								if layer_num <= 2:
										# embedding layers
										# layer_num 0: word_embeddings
										# layer_num 1: position_embeddings
										# layer_num 2: token_type_embeddings
										continue
								elif layer_num == 3:
										# embedding LayerNorm
										trace.extend(["""embeddings""", """LayerNorm"""] )
										_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """embeddings""" )
										_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """LayerNorm""" )
								elif layer_num > 3 and layer_num < config.num_hidden_layers + 4:
										# encoder layers
										trace.extend(["""encoder""", """layer""", str(layer_num - 4 )] )
										_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """encoder""" )
										_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """layer""" )
										_UpperCamelCase						    =	pointer[layer_num - 4]
								elif layer_num == config.num_hidden_layers + 4:
										# pooler layer
										trace.extend(["""pooler""", """dense"""] )
										_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """pooler""" )
										_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """dense""" )
						elif m_name == "embeddings":
								trace.append("""embeddings""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """embeddings""" )
								if layer_num == 0:
										trace.append("""word_embeddings""" )
										_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """word_embeddings""" )
								elif layer_num == 1:
										trace.append("""position_embeddings""" )
										_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """position_embeddings""" )
								elif layer_num == 2:
										trace.append("""token_type_embeddings""" )
										_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """token_type_embeddings""" )
								else:
										raise ValueError(F'Unknown embedding layer with name {full_name}' )
								trace.append("""weight""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """weight""" )
						elif m_name == "_attention_layer":
								# self-attention layer
								trace.extend(["""attention""", """self"""] )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """attention""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """self""" )
						elif m_name == "_attention_layer_norm":
								# output attention norm
								trace.extend(["""attention""", """output""", """LayerNorm"""] )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """attention""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """output""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """LayerNorm""" )
						elif m_name == "_attention_output_dense":
								# output attention dense
								trace.extend(["""attention""", """output""", """dense"""] )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """attention""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """output""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """dense""" )
						elif m_name == "_output_dense":
								# output dense
								trace.extend(["""output""", """dense"""] )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """output""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """dense""" )
						elif m_name == "_output_layer_norm":
								# output dense
								trace.extend(["""output""", """LayerNorm"""] )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """output""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """LayerNorm""" )
						elif m_name == "_key_dense":
								# attention key
								trace.append("""key""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """key""" )
						elif m_name == "_query_dense":
								# attention query
								trace.append("""query""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """query""" )
						elif m_name == "_value_dense":
								# attention value
								trace.append("""value""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """value""" )
						elif m_name == "_intermediate_dense":
								# attention intermediate dense
								trace.extend(["""intermediate""", """dense"""] )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """intermediate""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """dense""" )
						elif m_name == "_output_layer_norm":
								# output layer norm
								trace.append("""output""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """output""" )
						# weights & biases
						elif m_name in ["bias", "beta"]:
								trace.append("""bias""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """bias""" )
						elif m_name in ["kernel", "gamma"]:
								trace.append("""weight""" )
								_UpperCamelCase						    =	getattr(lowerCAmelCase						,  """weight""" )
						else:
								logger.warning(F'Ignored {m_name}' )
        # for certain layers reshape is necessary
				_UpperCamelCase						    =	""".""".join(lowerCAmelCase )
				if re.match(R"""(\S+)\.attention\.self\.(key|value|query)\.(bias|weight)"""						,  lowerCAmelCase ) or re.match(
				    R"""(\S+)\.attention\.output\.dense\.weight"""						,  lowerCAmelCase ):
						_UpperCamelCase						    =	array.reshape(pointer.data.shape )
				if "kernel" in full_name:
						_UpperCamelCase						    =	array.transpose()
				if pointer.shape == array.shape:
						_UpperCamelCase						    =	torch.from_numpy(lowerCAmelCase )
				else:
						raise ValueError(
						    F'Shape mismatch in layer {full_name}: Model expects shape {pointer.shape} but layer contains shape:'
						    F' {array.shape}' )
				logger.info(F'Successfully set variable {full_name} to PyTorch layer {trace}' )
		return model


def 							__A(lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase )		->				Tuple:

		"""simple docstring"""






		logger.info(F'Loading model based on config from {config_path}...' )
		_UpperCamelCase						    =	BertConfig.from_json_file(lowerCAmelCase )
		_UpperCamelCase						    =	BertModel(lowerCAmelCase )

		# Load weights from checkpoint
		logger.info(F'Loading weights from checkpoint {tf_checkpoint_path}...' )
		load_tfa_weights_in_bert(lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase )

		# Save pytorch-model
		logger.info(F'Saving PyTorch model to {pytorch_dump_path}...' )
		torch.save(model.state_dict()						,  lowerCAmelCase )


if __name__ == "__main__":
		lowerCamelCase__	=							argparse.ArgumentParser()
		parser.add_argument(
		    "--tf_checkpoint_path", type=str, required=True, help="Path to the TensorFlow 2.x checkpoint path."
		)
		parser.add_argument(
		    "--bert_config_file",
		    type=str,
		    required=True,
		    help="The config json file corresponding to the BERT model. This specifies the model architecture.",
		)
		parser.add_argument(
		    "--pytorch_dump_path",
		    type=str,
		    required=True,
		    help="Path to the output PyTorch model (must include filename).",
		)
		lowerCamelCase__	=							parser.parse_args()
		convert_tfa_checkpoint_to_pytorch(args.tf_checkpoint_path, args.bert_config_file, args.pytorch_dump_path)



