
"""simple docstring"""






import copy
import inspect
import unittest

import numpy as np
from huggingface_hub import hf_hub_download

from transformers import TimesformerConfig
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

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


if is_torch_available():
					import torch
					from torch import nn

					from transformers import (
					    MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING,
					    TimesformerForVideoClassification,
					    TimesformerModel,
					)
					from transformers.models.timesformer.modeling_timesformer import TIMESFORMER_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
					from transformers import VideoMAEImageProcessor

class 					__a     :



							'''simple docstring'''







							def __init__(     self  ,    _lowerCamelCase  ,    _lowerCamelCase=13  ,    _lowerCamelCase=10  ,    _lowerCamelCase=3  ,    _lowerCamelCase=2  ,    _lowerCamelCase=2  ,    _lowerCamelCase=True  ,    _lowerCamelCase=True  ,    _lowerCamelCase=32  ,    _lowerCamelCase=5  ,    _lowerCamelCase=4  ,    _lowerCamelCase=37  ,    _lowerCamelCase="gelu"  ,    _lowerCamelCase=0.1  ,    _lowerCamelCase=0.1  ,    _lowerCamelCase=10  ,    _lowerCamelCase=0.02  ,    _lowerCamelCase="divided_space_time"  ,    _lowerCamelCase=None  ,    )			->							Tuple:




										'''simple docstring'''
										__lowercase       =       parent
										__lowercase       =       batch_size
										__lowercase       =       image_size
										__lowercase       =       num_channels
										__lowercase       =       patch_size
										__lowercase       =       num_frames
										__lowercase       =       is_training
										__lowercase       =       use_labels
										__lowercase       =       hidden_size
										__lowercase       =       num_hidden_layers
										__lowercase       =       num_attention_heads
										__lowercase       =       intermediate_size
										__lowercase       =       hidden_act
										__lowercase       =       hidden_dropout_prob
										__lowercase       =       attention_probs_dropout_prob
										__lowercase       =       attention_type
										__lowercase       =       initializer_range
										__lowercase       =       scope
										__lowercase       =       num_labels

										# in TimeSformer, the number of spatial tokens equals num_frames * num_patches per frame + 1 CLS token
										__lowercase       =       (image_size // patch_size) ** 2
										__lowercase       =       (num_frames) * self.num_patches_per_frame + 1
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Optional[int]:




										'''simple docstring'''
										__lowercase       =       floats_tensor(
										    [self.batch_size, self.num_frames, self.num_channels, self.image_size, self.image_size]       )

										__lowercase       =       None
										if self.use_labels:
													__lowercase       =       ids_tensor([self.batch_size]  ,    self.num_labels       )

										__lowercase       =       self.get_config()

										return config, pixel_values, labels
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Optional[int]:




										'''simple docstring'''
										__lowercase       =       TimesformerConfig(
										    image_size=self.image_size  ,    patch_size=self.patch_size  ,    num_channels=self.num_channels  ,    num_frames=self.num_frames  ,    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  ,    initializer_range=self.initializer_range  ,    attention_type=self.attention_type  ,    )
										__lowercase       =       self.num_labels
										return config
							def   SCREAMING_SNAKE_CASE						(     self  ,    _lowerCamelCase  ,    _lowerCamelCase  ,    _lowerCamelCase       )			->							Tuple:




										'''simple docstring'''
										__lowercase       =       TimesformerModel(config=_lowerCamelCase       )
										model.to(_lowerCamelCase       )
										model.eval()
										__lowercase       =       model(_lowerCamelCase       )
										self.parent.assertEqual(result.last_hidden_state.shape  ,    (self.batch_size, self.seq_length, self.hidden_size)       )
							def   SCREAMING_SNAKE_CASE						(     self  ,    _lowerCamelCase  ,    _lowerCamelCase  ,    _lowerCamelCase       )			->							List[str]:




										'''simple docstring'''
										__lowercase       =       TimesformerForVideoClassification(_lowerCamelCase       )
										model.to(_lowerCamelCase       )
										model.eval()

										__lowercase       =       model(_lowerCamelCase       )

										# verify the logits shape
										__lowercase       =       torch.Size((self.batch_size, self.num_labels)       )
										self.parent.assertEqual(result.logits.shape  ,    _lowerCamelCase       )





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




										'''simple docstring'''
										__lowercase       =       self.prepare_config_and_inputs()
										__lowercase   ,					__lowercase   ,					__lowercase       =       config_and_inputs
										__lowercase       =       {"pixel_values": pixel_values}
										return config, inputs_dict





@require_torch
class 					__a     ( __a					,   __a					,   unittest.TestCase       ):



							'''simple docstring'''







							_lowerCamelCase					:			List[str]          =   (TimesformerModel, TimesformerForVideoClassification) if is_torch_available() else ()
							_lowerCamelCase					:			Union[str, Any]          =   (
							    {"""feature-extraction""": TimesformerModel, """video-classification""": TimesformerForVideoClassification}
							    if is_torch_available()
							    else {}
							)

							_lowerCamelCase					:			int          =   False
							_lowerCamelCase					:			Tuple          =   False
							_lowerCamelCase					:			Any          =   False
							_lowerCamelCase					:			List[Any]          =   False
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Union[str, Any]:




										'''simple docstring'''
										__lowercase       =       TimesformerModelTester(self       )
										__lowercase       =       ConfigTester(
										    self  ,    config_class=_lowerCamelCase  ,    has_text_modality=_lowerCamelCase  ,    hidden_size=37       )
							def   SCREAMING_SNAKE_CASE						(     self  ,    _lowerCamelCase  ,    _lowerCamelCase  ,    _lowerCamelCase=False       )			->							Optional[int]:




										'''simple docstring'''
										__lowercase       =       copy.deepcopy(_lowerCamelCase       )

										if return_labels:
													if model_class in get_values(_lowerCamelCase       ):
																__lowercase       =       torch.zeros(
																    self.model_tester.batch_size  ,    dtype=torch.long  ,    device=_lowerCamelCase       )

										return inputs_dict
							def   SCREAMING_SNAKE_CASE						(     self       )			->							List[Any]:




										'''simple docstring'''
										self.config_tester.run_common_tests()
							@unittest.skip(reason="TimeSformer does not use inputs_embeds"       )
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Tuple:




										'''simple docstring'''
										pass
							def   SCREAMING_SNAKE_CASE						(     self       )			->							List[Any]:




										'''simple docstring'''
										__lowercase   ,					__lowercase       =       self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
													__lowercase       =       model_class(_lowerCamelCase       )
													self.assertIsInstance(model.get_input_embeddings()  ,    (nn.Module)       )
													__lowercase       =       model.get_output_embeddings()
													self.assertTrue(x is None or isinstance(_lowerCamelCase  ,    nn.Linear       )       )
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Union[str, Any]:




										'''simple docstring'''
										__lowercase   ,					__lowercase       =       self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
													__lowercase       =       model_class(_lowerCamelCase       )
													__lowercase       =       inspect.signature(model.forward       )
													# signature.parameters is an OrderedDict => so arg_names order is deterministic
													__lowercase       =       [*signature.parameters.keys()]

													__lowercase       =       ["pixel_values"]
													self.assertListEqual(arg_names[:1]  ,    _lowerCamelCase       )
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Optional[int]:




										'''simple docstring'''
										__lowercase       =       self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_model(*_lowerCamelCase       )
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Union[str, Any]:




										'''simple docstring'''
										__lowercase       =       self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_for_video_classification(*_lowerCamelCase       )
							@slow
							def   SCREAMING_SNAKE_CASE						(     self       )			->							str:




										'''simple docstring'''
										for model_name in TIMESFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
													__lowercase       =       TimesformerModel.from_pretrained(_lowerCamelCase       )
													self.assertIsNotNone(_lowerCamelCase       )
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Optional[int]:




										'''simple docstring'''
										if not self.has_attentions:
													pass

										else:
													__lowercase   ,					__lowercase       =       self.model_tester.prepare_config_and_inputs_for_common()
													__lowercase       =       True

													for model_class in self.all_model_classes:
																__lowercase       =       self.model_tester.seq_length
																__lowercase       =       self.model_tester.num_frames

																__lowercase       =       True
																__lowercase       =       False
																__lowercase       =       True
																__lowercase       =       model_class(_lowerCamelCase       )
																model.to(_lowerCamelCase       )
																model.eval()
																with torch.no_grad():
																			__lowercase       =       model(**self._prepare_for_class(_lowerCamelCase  ,    _lowerCamelCase       )       )
																__lowercase       =       outputs.attentions
																self.assertEqual(len(_lowerCamelCase       )  ,    self.model_tester.num_hidden_layers       )

																# check that output_attentions also work using config
																del inputs_dict["output_attentions"]
																__lowercase       =       True
																__lowercase       =       model_class(_lowerCamelCase       )
																model.to(_lowerCamelCase       )
																model.eval()
																with torch.no_grad():
																			__lowercase       =       model(**self._prepare_for_class(_lowerCamelCase  ,    _lowerCamelCase       )       )
																__lowercase       =       outputs.attentions
																self.assertEqual(len(_lowerCamelCase       )  ,    self.model_tester.num_hidden_layers       )

																# attentions has shape (batch_size x num_frames) x num_heads x (num_patches per frame + 1) x (num_patches per frame + 1)
																self.assertListEqual(
																    list(attentions[0].shape[-3:]       )  ,    [self.model_tester.num_attention_heads, seq_len // num_frames + 1, seq_len // num_frames + 1]  ,    )
																__lowercase       =       len(_lowerCamelCase       )

																# Check attention is always last and order is fine
																__lowercase       =       True
																__lowercase       =       True
																__lowercase       =       model_class(_lowerCamelCase       )
																model.to(_lowerCamelCase       )
																model.eval()
																with torch.no_grad():
																			__lowercase       =       model(**self._prepare_for_class(_lowerCamelCase  ,    _lowerCamelCase       )       )

																self.assertEqual(out_len + 1  ,    len(_lowerCamelCase       )       )

																__lowercase       =       outputs.attentions

																self.assertEqual(len(_lowerCamelCase       )  ,    self.model_tester.num_hidden_layers       )

																# attentions has shape (batch_size x num_frames) x num_heads x (num_patches per frame + 1) x (num_patches per frame + 1)
																self.assertListEqual(
																    list(self_attentions[0].shape[-3:]       )  ,    [self.model_tester.num_attention_heads, seq_len // num_frames + 1, seq_len // num_frames + 1]  ,    )





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




										'''simple docstring'''
										def check_hidden_states_output(_lowerCamelCase  ,    _lowerCamelCase  ,    _lowerCamelCase       ):
													__lowercase       =       model_class(_lowerCamelCase       )
													model.to(_lowerCamelCase       )
													model.eval()

													with torch.no_grad():
																__lowercase       =       model(**self._prepare_for_class(_lowerCamelCase  ,    _lowerCamelCase       )       )

													__lowercase       =       outputs.hidden_states
													__lowercase       =       self.model_tester.num_hidden_layers + 1
													self.assertEqual(len(_lowerCamelCase       )  ,    _lowerCamelCase       )

													__lowercase       =       self.model_tester.seq_length

													self.assertListEqual(
													    list(hidden_states[0].shape[-2:]       )  ,    [seq_length, self.model_tester.hidden_size]  ,    )

										__lowercase   ,					__lowercase       =       self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
													__lowercase       =       True
													check_hidden_states_output(_lowerCamelCase  ,    _lowerCamelCase  ,    _lowerCamelCase       )

													# check that output_hidden_states also work using config
													del inputs_dict["output_hidden_states"]
													__lowercase       =       True

													check_hidden_states_output(_lowerCamelCase  ,    _lowerCamelCase  ,    _lowerCamelCase       )





def      lowerCAmelCase__			(		)						->Union[str, Any]:
			__lowercase       =       hf_hub_download(
			    repo_id="hf-internal-testing/spaghetti-video"			,   filename="eating_spaghetti.npy"			,   repo_type="dataset"      )
			__lowercase       =       np.load(__magic_name__      )
			return list(__magic_name__      )







@require_torch
@require_vision
class 					__a     ( unittest.TestCase       ):



							'''simple docstring'''







							@cached_property
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Optional[Any]:




										'''simple docstring'''
										# logits were tested with a different mean and std, so we use the same here
										return (
										    VideoMAEImageProcessor(image_mean=[0.5, 0.5, 0.5]  ,    image_std=[0.5, 0.5, 0.5]       )
										    if is_vision_available()
										    else None
										)





							@slow
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Optional[Any]:




										'''simple docstring'''
										__lowercase       =       TimesformerForVideoClassification.from_pretrained("facebook/timesformer-base-finetuned-k400"       ).to(
										    _lowerCamelCase       )

										__lowercase       =       self.default_image_processor
										__lowercase       =       prepare_video()
										__lowercase       =       image_processor(video[:8]  ,    return_tensors="pt"       ).to(_lowerCamelCase       )

										# forward pass
										with torch.no_grad():
													__lowercase       =       model(**_lowerCamelCase       )

										# verify the logits
										__lowercase       =       torch.Size((1, 400)       )
										self.assertEqual(outputs.logits.shape  ,    _lowerCamelCase       )

										__lowercase       =       torch.tensor([-0.3016, -0.7713, -0.4205]       ).to(_lowerCamelCase       )

										self.assertTrue(torch.allclose(outputs.logits[0, :3]  ,    _lowerCamelCase  ,    atol=1e-4       )       )







"""simple docstring"""






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()
_lowercase							=				logging.get_logger(__name__)



def      lowerCAmelCase__			(		__magic_name__			,   __magic_name__			,   __magic_name__      )						->str:
			__lowercase       =       os.path.abspath(__magic_name__      )
			logger.info(F'''Converting TensorFlow checkpoint from {tf_path}'''      )
			# Load weights from TF model
			__lowercase       =       tf.train.list_variables(__magic_name__      )
			__lowercase       =       []
			__lowercase       =       []
			__lowercase       =       []
			for full_name, shape in init_vars:
						# logger.info(f"Loading TF weight {name} with shape {shape}")
						__lowercase       =       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'
									__lowercase       =       name[1:]
						# figure out how many levels deep the name is
						__lowercase       =       0
						for _name in name:
									if _name.startswith("layer_with_weights"      ):
												depth += 1
									else:
												break
						layer_depth.append(__magic_name__      )
						# read data
						__lowercase       =       tf.train.load_variable(__magic_name__			,   __magic_name__      )
						names.append("/".join(__magic_name__      )      )
						arrays.append(__magic_name__      )
			logger.info(F'''Read a total of {len(__magic_name__      ):,} layers'''      )

			# Sanity check
			if len(set(__magic_name__      )      ) != 1:
						raise ValueError(F'''Found layer names with different depths (layer depth {list(set(__magic_name__      )      )})'''      )
			__lowercase       =       list(set(__magic_name__      )      )[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(__magic_name__			,   __magic_name__      ):
						__lowercase       =       full_name.split("/"      )
						__lowercase       =       model
						__lowercase       =       []
						for i, m_name in enumerate(__magic_name__      ):
									if m_name == ".ATTRIBUTES":
												# variable names end with .ATTRIBUTES/VARIABLE_VALUE
												break
									if m_name.startswith("layer_with_weights"      ):
												__lowercase       =       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"]      )
															__lowercase       =       getattr(__magic_name__			,   "embeddings"      )
															__lowercase       =       getattr(__magic_name__			,   "LayerNorm"      )
												elif layer_num > 3 and layer_num < config.num_hidden_layers + 4:
															# encoder layers
															trace.extend(["encoder", "layer", str(layer_num - 4      )]      )
															__lowercase       =       getattr(__magic_name__			,   "encoder"      )
															__lowercase       =       getattr(__magic_name__			,   "layer"      )
															__lowercase       =       pointer[layer_num - 4]
												elif layer_num == config.num_hidden_layers + 4:
															# pooler layer
															trace.extend(["pooler", "dense"]      )
															__lowercase       =       getattr(__magic_name__			,   "pooler"      )
															__lowercase       =       getattr(__magic_name__			,   "dense"      )
									elif m_name == "embeddings":
												trace.append("embeddings"      )
												__lowercase       =       getattr(__magic_name__			,   "embeddings"      )
												if layer_num == 0:
															trace.append("word_embeddings"      )
															__lowercase       =       getattr(__magic_name__			,   "word_embeddings"      )
												elif layer_num == 1:
															trace.append("position_embeddings"      )
															__lowercase       =       getattr(__magic_name__			,   "position_embeddings"      )
												elif layer_num == 2:
															trace.append("token_type_embeddings"      )
															__lowercase       =       getattr(__magic_name__			,   "token_type_embeddings"      )
												else:
															raise ValueError(F'''Unknown embedding layer with name {full_name}'''      )
												trace.append("weight"      )
												__lowercase       =       getattr(__magic_name__			,   "weight"      )
									elif m_name == "_attention_layer":
												# self-attention layer
												trace.extend(["attention", "self"]      )
												__lowercase       =       getattr(__magic_name__			,   "attention"      )
												__lowercase       =       getattr(__magic_name__			,   "self"      )
									elif m_name == "_attention_layer_norm":
												# output attention norm
												trace.extend(["attention", "output", "LayerNorm"]      )
												__lowercase       =       getattr(__magic_name__			,   "attention"      )
												__lowercase       =       getattr(__magic_name__			,   "output"      )
												__lowercase       =       getattr(__magic_name__			,   "LayerNorm"      )
									elif m_name == "_attention_output_dense":
												# output attention dense
												trace.extend(["attention", "output", "dense"]      )
												__lowercase       =       getattr(__magic_name__			,   "attention"      )
												__lowercase       =       getattr(__magic_name__			,   "output"      )
												__lowercase       =       getattr(__magic_name__			,   "dense"      )
									elif m_name == "_output_dense":
												# output dense
												trace.extend(["output", "dense"]      )
												__lowercase       =       getattr(__magic_name__			,   "output"      )
												__lowercase       =       getattr(__magic_name__			,   "dense"      )
									elif m_name == "_output_layer_norm":
												# output dense
												trace.extend(["output", "LayerNorm"]      )
												__lowercase       =       getattr(__magic_name__			,   "output"      )
												__lowercase       =       getattr(__magic_name__			,   "LayerNorm"      )
									elif m_name == "_key_dense":
												# attention key
												trace.append("key"      )
												__lowercase       =       getattr(__magic_name__			,   "key"      )
									elif m_name == "_query_dense":
												# attention query
												trace.append("query"      )
												__lowercase       =       getattr(__magic_name__			,   "query"      )
									elif m_name == "_value_dense":
												# attention value
												trace.append("value"      )
												__lowercase       =       getattr(__magic_name__			,   "value"      )
									elif m_name == "_intermediate_dense":
												# attention intermediate dense
												trace.extend(["intermediate", "dense"]      )
												__lowercase       =       getattr(__magic_name__			,   "intermediate"      )
												__lowercase       =       getattr(__magic_name__			,   "dense"      )
									elif m_name == "_output_layer_norm":
												# output layer norm
												trace.append("output"      )
												__lowercase       =       getattr(__magic_name__			,   "output"      )
									# weights & biases
									elif m_name in ["bias", "beta"]:
												trace.append("bias"      )
												__lowercase       =       getattr(__magic_name__			,   "bias"      )
									elif m_name in ["kernel", "gamma"]:
												trace.append("weight"      )
												__lowercase       =       getattr(__magic_name__			,   "weight"      )
									else:
												logger.warning(F'''Ignored {m_name}'''      )
        # for certain layers reshape is necessary
						__lowercase       =       ".".join(__magic_name__      )
						if re.match(R"(\S+)\.attention\.self\.(key|value|query)\.(bias|weight)"			,   __magic_name__      ) or re.match(
						    R"(\S+)\.attention\.output\.dense\.weight"			,   __magic_name__      ):
									__lowercase       =       array.reshape(pointer.data.shape      )
						if "kernel" in full_name:
									__lowercase       =       array.transpose()
						if pointer.shape == array.shape:
									__lowercase       =       torch.from_numpy(__magic_name__      )
						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      lowerCAmelCase__			(		__magic_name__			,   __magic_name__			,   __magic_name__      )						->str:
			# Instantiate model
			logger.info(F'''Loading model based on config from {config_path}...'''      )
			__lowercase       =       BertConfig.from_json_file(__magic_name__      )
			__lowercase       =       BertModel(__magic_name__      )

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

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


if __name__ == "__main__":
					_lowercase							=				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).''',
					)
					_lowercase							=				parser.parse_args()
					convert_tfa_checkpoint_to_pytorch(args.tf_checkpoint_path, args.bert_config_file, args.pytorch_dump_path)





