


import unittest

from transformers import ErnieMConfig, is_torch_available
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 (
     ErnieMForInformationExtraction,
     ErnieMForMultipleChoice,
     ErnieMForQuestionAnswering,
     ErnieMForSequenceClassification,
     ErnieMForTokenClassification,
     ErnieMModel,
 )
 from transformers.models.ernie_m.modeling_ernie_m import ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST




class A						:






      def __init__(      self		:  int    ,     lowercase_		:  List[Any]    ,     lowercase_		:  Dict=13    ,     lowercase_		:  Optional[Any]=7    ,     lowercase_		:  List[str]=True    ,     lowercase_		:  List[str]=True    ,     lowercase_		:  Tuple=True    ,     lowercase_		:  Union[str, Any]=99    ,     lowercase_		:  Union[str, Any]=32    ,     lowercase_		:  Tuple=5    ,     lowercase_		:  List[Any]=4    ,     lowercase_		:  Any=37    ,     lowercase_		:  Union[str, Any]="gelu"    ,     lowercase_		:  Any=0.1    ,     lowercase_		:  Union[str, Any]=0.1    ,     lowercase_		:  List[str]=512    ,     lowercase_		:  Optional[int]=16    ,     lowercase_		:  int=2    ,     lowercase_		:  Optional[Any]=0.02    ,     lowercase_		:  Dict=3    ,     lowercase_		:  Any=4    ,     lowercase_		:  List[str]=None    ,     )      ->		Tuple:
             """simple docstring"""




             _lowerCamelCase :	Dict						=parent
             _lowerCamelCase :	Optional[int]						=batch_size
             _lowerCamelCase :	int						=seq_length
             _lowerCamelCase :	List[str]						=is_training
             _lowerCamelCase :	Optional[int]						=use_input_mask
             _lowerCamelCase :	Dict						=use_labels
             _lowerCamelCase :	Any						=vocab_size
             _lowerCamelCase :	Any						=hidden_size
             _lowerCamelCase :	Any						=num_hidden_layers
             _lowerCamelCase :	Optional[int]						=num_attention_heads
             _lowerCamelCase :	Optional[Any]						=intermediate_size
             _lowerCamelCase :	Union[str, Any]						=hidden_act
             _lowerCamelCase :	str						=hidden_dropout_prob
             _lowerCamelCase :	Tuple						=attention_probs_dropout_prob
             _lowerCamelCase :	Tuple						=max_position_embeddings
             _lowerCamelCase :	Optional[int]						=type_vocab_size
             _lowerCamelCase :	Optional[Any]						=type_sequence_label_size
             _lowerCamelCase :	List[str]						=initializer_range
             _lowerCamelCase :	Dict						=num_labels
             _lowerCamelCase :	List[str]						=num_choices
             _lowerCamelCase :	Optional[Any]						=scope






      def  lowerCamelCase (      self		:  Optional[Any]				)      ->		Tuple:
             """simple docstring"""




             _lowerCamelCase :	Union[str, Any]						=ids_tensor([self.batch_size, self.seq_length]    ,     self.vocab_size				)

             _lowerCamelCase :	List[str]						=None
             if self.use_input_mask:
                    _lowerCamelCase :	Union[str, Any]						=random_attention_mask([self.batch_size, self.seq_length]				)

             _lowerCamelCase :	Any						=None
             _lowerCamelCase :	int						=None
             _lowerCamelCase :	int						=None
             if self.use_labels:
                    _lowerCamelCase :	Optional[int]						=ids_tensor([self.batch_size]    ,     self.type_sequence_label_size				)
                    _lowerCamelCase :	List[str]						=ids_tensor([self.batch_size, self.seq_length]    ,     self.num_labels				)
                    _lowerCamelCase :	Optional[Any]						=ids_tensor([self.batch_size]    ,     self.num_choices				)

             _lowerCamelCase :	Any						=self.get_config()

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






      def  lowerCamelCase (      self		:  Dict				)      ->		Dict:
             """simple docstring"""




             _lowerCamelCase :	List[str]						=ids_tensor([self.batch_size, self.seq_length]    ,     self.vocab_size				)

             _lowerCamelCase :	str						=None
             if self.use_input_mask:
                    _lowerCamelCase :	Union[str, Any]						=random_attention_mask([self.batch_size, self.seq_length]				)
             _lowerCamelCase :	str						=self.get_config()

             return config, input_ids, input_mask






      def  lowerCamelCase (      self		:  Any				)      ->		Any:
             """simple docstring"""




             return ErnieMConfig(
                 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    ,     )






      def  lowerCamelCase (      self		:  Optional[int]    ,     lowercase_		:  Tuple    ,     lowercase_		:  Tuple    ,     lowercase_		:  Any    ,     lowercase_		:  Dict    ,     lowercase_		:  int    ,     lowercase_		:  Tuple				)      ->		List[str]:
             """simple docstring"""




             _lowerCamelCase :	Tuple						=ErnieMModel(config=lowercase_				)
             model.to(lowercase_				)
             model.eval()
             _lowerCamelCase :	str						=model(lowercase_    ,     return_dict=lowercase_				)
             self.parent.assertEqual(result.last_hidden_state.shape    ,     (self.batch_size, self.seq_length, self.hidden_size)				)






      def  lowerCamelCase (      self		:  str    ,     lowercase_		:  Union[str, Any]    ,     lowercase_		:  Union[str, Any]    ,     lowercase_		:  List[str]    ,     lowercase_		:  str    ,     lowercase_		:  List[str]    ,     lowercase_		:  str				)      ->		str:
             """simple docstring"""




             _lowerCamelCase :	Any						=ErnieMForQuestionAnswering(config=lowercase_				)
             model.to(lowercase_				)
             model.eval()
             _lowerCamelCase :	List[str]						=model(
                 lowercase_    ,     attention_mask=lowercase_    ,     start_positions=lowercase_    ,     end_positions=lowercase_    ,     )
             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  lowerCamelCase (      self		:  int    ,     lowercase_		:  List[Any]    ,     lowercase_		:  int    ,     lowercase_		:  Optional[int]    ,     lowercase_		:  Optional[Any]    ,     lowercase_		:  Any    ,     lowercase_		:  Optional[int]				)      ->		Any:
             """simple docstring"""




             _lowerCamelCase :	Union[str, Any]						=ErnieMForInformationExtraction(config=lowercase_				)
             model.to(lowercase_				)
             model.eval()
             _lowerCamelCase :	Optional[int]						=torch.ones_like(lowercase_    ,     dtype=torch.floataa				)
             _lowerCamelCase :	str						=model(
                 lowercase_    ,     attention_mask=lowercase_    ,     start_positions=lowercase_    ,     end_positions=lowercase_    ,     )
             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  lowerCamelCase (      self		:  Dict    ,     lowercase_		:  Dict    ,     lowercase_		:  Tuple    ,     lowercase_		:  List[str]    ,     lowercase_		:  str    ,     lowercase_		:  Any    ,     lowercase_		:  Tuple				)      ->		int:
             """simple docstring"""




             _lowerCamelCase :	Dict						=self.num_labels
             _lowerCamelCase :	Any						=ErnieMForSequenceClassification(lowercase_				)
             model.to(lowercase_				)
             model.eval()
             _lowerCamelCase :	Optional[int]						=model(lowercase_    ,     attention_mask=lowercase_    ,     labels=lowercase_				)
             self.parent.assertEqual(result.logits.shape    ,     (self.batch_size, self.num_labels)				)






      def  lowerCamelCase (      self		:  Dict    ,     lowercase_		:  List[str]    ,     lowercase_		:  Optional[Any]    ,     lowercase_		:  Optional[int]    ,     lowercase_		:  List[str]    ,     lowercase_		:  Optional[int]    ,     lowercase_		:  Dict				)      ->		int:
             """simple docstring"""




             _lowerCamelCase :	int						=self.num_labels
             _lowerCamelCase :	List[str]						=ErnieMForTokenClassification(config=lowercase_				)
             model.to(lowercase_				)
             model.eval()
             input_ids.to(lowercase_				)
             input_mask.to(lowercase_				)
             token_labels.to(lowercase_				)

             _lowerCamelCase :	List[Any]						=model(lowercase_    ,     attention_mask=lowercase_    ,     labels=lowercase_				)

             self.parent.assertEqual(result.logits.shape    ,     (self.batch_size, self.seq_length, self.num_labels)				)






      def  lowerCamelCase (      self		:  Union[str, Any]    ,     lowercase_		:  int    ,     lowercase_		:  Union[str, Any]    ,     lowercase_		:  int    ,     lowercase_		:  str    ,     lowercase_		:  Optional[int]    ,     lowercase_		:  str				)      ->		Tuple:
             """simple docstring"""




             _lowerCamelCase :	Any						=self.num_choices
             _lowerCamelCase :	Any						=ErnieMForMultipleChoice(config=lowercase_				)
             model.to(lowercase_				)
             model.eval()
             _lowerCamelCase :	str						=input_ids.unsqueeze(1				).expand(-1    ,     self.num_choices    ,     -1				).contiguous()
             _lowerCamelCase :	Optional[int]						=input_mask.unsqueeze(1				).expand(-1    ,     self.num_choices    ,     -1				).contiguous()
             _lowerCamelCase :	List[str]						=model(
                 lowercase_    ,     attention_mask=lowercase_    ,     labels=lowercase_    ,     )
             self.parent.assertEqual(result.logits.shape    ,     (self.batch_size, self.num_choices)				)






      def  lowerCamelCase (      self		:  Union[str, Any]				)      ->		List[str]:
             """simple docstring"""




             _lowerCamelCase :	Tuple						=self.prepare_config_and_inputs()
             (
                 (
                 _lowerCamelCase
             )			,  (
                 _lowerCamelCase
             )			,  (
                 _lowerCamelCase
             )			,  (
                 _lowerCamelCase
             )			,  (
                 _lowerCamelCase
             )			,  (
                 _lowerCamelCase
             )			,  
             ) :	List[Any]						=config_and_inputs
             _lowerCamelCase :	Optional[Any]						={'input_ids': input_ids, 'attention_mask': input_mask}
             return config, inputs_dict




@require_torch
class A						(     UpperCamelCase_					,							UpperCamelCase_					,							unittest.TestCase  ):
      UpperCamelCase__							:						str   =(
          (
              ErnieMModel,
              ErnieMForMultipleChoice,
              ErnieMForQuestionAnswering,
              ErnieMForSequenceClassification,
              ErnieMForTokenClassification,
          )
          if is_torch_available()
          else ()
      )
      UpperCamelCase__							:						Dict   =()
      UpperCamelCase__							:						List[str]   =(
          {
              'feature-extraction': ErnieMModel,
              'question-answering': ErnieMForQuestionAnswering,
              'text-classification': ErnieMForSequenceClassification,
              'token-classification': ErnieMForTokenClassification,
              'zero-shot': ErnieMForSequenceClassification,
          }
          if is_torch_available()
          else {}
      )
      UpperCamelCase__							:						List[str]   =False






      def  lowerCamelCase (      self		:  str    ,     lowercase_		:  List[Any]    ,     lowercase_		:  Any    ,     lowercase_		:  str    ,     lowercase_		:  Tuple    ,     lowercase_		:  Tuple				)      ->		Dict:
             """simple docstring"""




             if pipeline_test_casse_name == "QAPipelineTests":
                    return True

             return False






      def  lowerCamelCase (      self		:  Union[str, Any]				)      ->		int:
             """simple docstring"""




             _lowerCamelCase :	int						=ErnieMModelTester(self				)
             _lowerCamelCase :	Optional[int]						=ConfigTester(self    ,     config_class=lowercase_    ,     hidden_size=37				)






      def  lowerCamelCase (      self		:  Optional[Any]				)      ->		Union[str, Any]:
             """simple docstring"""




             self.config_tester.run_common_tests()






      def  lowerCamelCase (      self		:  Optional[int]				)      ->		Dict:
             """simple docstring"""




             _lowerCamelCase :	Union[str, Any]						=self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_model(*lowercase_				)






      def  lowerCamelCase (      self		:  Dict				)      ->		Optional[Any]:
             """simple docstring"""




             _lowerCamelCase :	List[Any]						=self.model_tester.prepare_config_and_inputs()
             for type in ["absolute", "relative_key", "relative_key_query"]:
                    _lowerCamelCase :	Optional[Any]						=type
                    self.model_tester.create_and_check_model(*lowercase_				)






      def  lowerCamelCase (      self		:  Tuple				)      ->		Any:
             """simple docstring"""




             _lowerCamelCase :	Optional[Any]						=self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_multiple_choice(*lowercase_				)






      def  lowerCamelCase (      self		:  str				)      ->		Tuple:
             """simple docstring"""




             _lowerCamelCase :	Dict						=self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_question_answering(*lowercase_				)






      def  lowerCamelCase (      self		:  List[str]				)      ->		Union[str, Any]:
             """simple docstring"""




             _lowerCamelCase :	Any						=self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_sequence_classification(*lowercase_				)






      def  lowerCamelCase (      self		:  List[str]				)      ->		Union[str, Any]:
             """simple docstring"""




             _lowerCamelCase :	List[str]						=self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_information_extraction(*lowercase_				)






      def  lowerCamelCase (      self		:  Optional[Any]				)      ->		Tuple:
             """simple docstring"""




             _lowerCamelCase :	str						=self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_token_classification(*lowercase_				)






      @slow
      def  lowerCamelCase (      self		:  Union[str, Any]				)      ->		List[str]:
             """simple docstring"""




             for model_name in ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                    _lowerCamelCase :	Union[str, Any]						=ErnieMModel.from_pretrained(lowercase_				)
                    self.assertIsNotNone(lowercase_				)




@require_torch
class A						(     unittest.TestCase  ):






      @slow
      def  lowerCamelCase (      self		:  List[str]				)      ->		Dict:
             """simple docstring"""




             _lowerCamelCase :	Dict						=ErnieMModel.from_pretrained('susnato/ernie-m-base_pytorch'				)
             model.eval()
             _lowerCamelCase :	Optional[int]						=torch.tensor([[0, 1, 2, 3, 4, 5]]				)
             _lowerCamelCase :	Optional[int]						=model(lowercase_				)[0]

             # TODO Replace vocab size
             _lowerCamelCase :	Optional[Any]						=768

             _lowerCamelCase :	str						=torch.Size((1, 6, hidden_size)				)
             self.assertEqual(output.shape    ,     lowercase_				)

             _lowerCamelCase :	str						=torch.tensor(
                 [[[-0.0012, 0.1245, -0.0214], [-0.0742, 0.0244, -0.0771], [-0.0333, 0.1164, -0.1554]]]				)

             self.assertTrue(torch.allclose(output[:, :3, :3]    ,     lowercase_    ,     atol=1E-3				)				)






import argparse
import pathlib

import fairseq
import torch
from fairseq.models.roberta import RobertaModel as FairseqRobertaModel
from fairseq.modules import TransformerSentenceEncoderLayer
from packaging import version

from transformers import RobertaConfig, RobertaForMaskedLM, RobertaForSequenceClassification
from transformers.models.bert.modeling_bert import (
    BertIntermediate,
    BertLayer,
    BertOutput,
    BertSelfAttention,
    BertSelfOutput,
)
from transformers.utils import logging


if version.parse(fairseq.__version__) < version.parse('0.9.0'):
 raise Exception('requires fairseq >= 0.9.0')


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

lowerCamelCase		      = 'Hello world! cécé herlolip'




def 			a_   (					SCREAMING_SNAKE_CASE__      :   str	,    SCREAMING_SNAKE_CASE__      :   str	,    SCREAMING_SNAKE_CASE__      :   bool  ):
       '''simple docstring'''





       _lowerCamelCase :	Dict						=FairseqRobertaModel.from_pretrained(SCREAMING_SNAKE_CASE__  )
       roberta.eval()  # disable dropout
       _lowerCamelCase :	int						=roberta.model.encoder.sentence_encoder
       _lowerCamelCase :	Union[str, Any]						=RobertaConfig(
           vocab_size=roberta_sent_encoder.embed_tokens.num_embeddings	,    hidden_size=roberta.args.encoder_embed_dim	,    num_hidden_layers=roberta.args.encoder_layers	,    num_attention_heads=roberta.args.encoder_attention_heads	,    intermediate_size=roberta.args.encoder_ffn_embed_dim	,    max_position_embeddings=514	,    type_vocab_size=1	,    layer_norm_eps=1e-5	,    )
       if classification_head:
              _lowerCamelCase :	int						=roberta.model.classification_heads['mnli'].out_proj.weight.shape[0]
       print('Our BERT config:'	,    SCREAMING_SNAKE_CASE__  )

       _lowerCamelCase :	Optional[int]						=RobertaForSequenceClassification(SCREAMING_SNAKE_CASE__  ) if classification_head else RobertaForMaskedLM(SCREAMING_SNAKE_CASE__  )
       model.eval()

       # Now let's copy all the weights.
       # Embeddings
       _lowerCamelCase :	List[str]						=roberta_sent_encoder.embed_tokens.weight
       _lowerCamelCase :	int						=roberta_sent_encoder.embed_positions.weight
       _lowerCamelCase :	Tuple						=torch.zeros_like(
           model.roberta.embeddings.token_type_embeddings.weight  )  # just zero them out b/c RoBERTa doesn't use them.
       _lowerCamelCase :	Optional[Any]						=roberta_sent_encoder.emb_layer_norm.weight
       _lowerCamelCase :	int						=roberta_sent_encoder.emb_layer_norm.bias

       for i in range(config.num_hidden_layers  ):
              # Encoder: start of layer
              _lowerCamelCase :	BertLayer						=model.roberta.encoder.layer[i]
              _lowerCamelCase :	TransformerSentenceEncoderLayer						=roberta_sent_encoder.layers[i]

              # self attention
              _lowerCamelCase :	BertSelfAttention						=layer.attention.self
              assert (
                  roberta_layer.self_attn.k_proj.weight.data.shape
                  == roberta_layer.self_attn.q_proj.weight.data.shape
                  == roberta_layer.self_attn.v_proj.weight.data.shape
                  == torch.Size((config.hidden_size, config.hidden_size)  )
              )

              _lowerCamelCase :	Dict						=roberta_layer.self_attn.q_proj.weight
              _lowerCamelCase :	List[Any]						=roberta_layer.self_attn.q_proj.bias
              _lowerCamelCase :	Optional[Any]						=roberta_layer.self_attn.k_proj.weight
              _lowerCamelCase :	int						=roberta_layer.self_attn.k_proj.bias
              _lowerCamelCase :	Optional[Any]						=roberta_layer.self_attn.v_proj.weight
              _lowerCamelCase :	int						=roberta_layer.self_attn.v_proj.bias

              # self-attention output
              _lowerCamelCase :	BertSelfOutput						=layer.attention.output
              assert self_output.dense.weight.shape == roberta_layer.self_attn.out_proj.weight.shape
              _lowerCamelCase :	Union[str, Any]						=roberta_layer.self_attn.out_proj.weight
              _lowerCamelCase :	str						=roberta_layer.self_attn.out_proj.bias
              _lowerCamelCase :	List[Any]						=roberta_layer.self_attn_layer_norm.weight
              _lowerCamelCase :	List[Any]						=roberta_layer.self_attn_layer_norm.bias

              # intermediate
              _lowerCamelCase :	BertIntermediate						=layer.intermediate
              assert intermediate.dense.weight.shape == roberta_layer.fca.weight.shape
              _lowerCamelCase :	str						=roberta_layer.fca.weight
              _lowerCamelCase :	Optional[int]						=roberta_layer.fca.bias

              # output
              _lowerCamelCase :	BertOutput						=layer.output
              assert bert_output.dense.weight.shape == roberta_layer.fca.weight.shape
              _lowerCamelCase :	str						=roberta_layer.fca.weight
              _lowerCamelCase :	List[Any]						=roberta_layer.fca.bias
              _lowerCamelCase :	List[str]						=roberta_layer.final_layer_norm.weight
              _lowerCamelCase :	Optional[int]						=roberta_layer.final_layer_norm.bias
              # end of layer

       if classification_head:
              _lowerCamelCase :	Any						=roberta.model.classification_heads['mnli'].dense.weight
              _lowerCamelCase :	Optional[Any]						=roberta.model.classification_heads['mnli'].dense.bias
              _lowerCamelCase :	List[str]						=roberta.model.classification_heads['mnli'].out_proj.weight
              _lowerCamelCase :	Tuple						=roberta.model.classification_heads['mnli'].out_proj.bias
       else:
              # LM Head
              _lowerCamelCase :	Optional[Any]						=roberta.model.encoder.lm_head.dense.weight
              _lowerCamelCase :	Tuple						=roberta.model.encoder.lm_head.dense.bias
              _lowerCamelCase :	Tuple						=roberta.model.encoder.lm_head.layer_norm.weight
              _lowerCamelCase :	int						=roberta.model.encoder.lm_head.layer_norm.bias
              _lowerCamelCase :	Dict						=roberta.model.encoder.lm_head.weight
              _lowerCamelCase :	str						=roberta.model.encoder.lm_head.bias

       # Let's check that we get the same results.
       _lowerCamelCase :	torch.Tensor						=roberta.encode(SCREAMING_SNAKE_CASE__  ).unsqueeze(0  )  # batch of size 1

       _lowerCamelCase :	List[Any]						=model(SCREAMING_SNAKE_CASE__  )[0]
       if classification_head:
              _lowerCamelCase :	int						=roberta.model.classification_heads['mnli'](roberta.extract_features(SCREAMING_SNAKE_CASE__  )  )
       else:
              _lowerCamelCase :	int						=roberta.model(SCREAMING_SNAKE_CASE__  )[0]
       print(our_output.shape	,    their_output.shape  )
       _lowerCamelCase :	Any						=torch.max(torch.abs(our_output - their_output  )  ).item()
       print(F'''max_absolute_diff = {max_absolute_diff}'''  )  # ~ 1e-7
       _lowerCamelCase :	Optional[Any]						=torch.allclose(SCREAMING_SNAKE_CASE__	,    SCREAMING_SNAKE_CASE__	,    atol=1e-3  )
       print('Do both models output the same tensors?'	,    '🔥' if success else '💩'  )
       if not success:
              raise Exception('Something went wRoNg'  )

       pathlib.Path(SCREAMING_SNAKE_CASE__  ).mkdir(parents=SCREAMING_SNAKE_CASE__	,    exist_ok=SCREAMING_SNAKE_CASE__  )
       print(F'''Saving model to {pytorch_dump_folder_path}'''  )
       model.save_pretrained(SCREAMING_SNAKE_CASE__  )


if __name__ == "__main__":
 lowerCamelCase		      = argparse.ArgumentParser()
 # Required parameters
 parser.add_argument(
     '--roberta_checkpoint_path', default=None, type=str, required=True, help='Path the official PyTorch dump.'
 )
 parser.add_argument(
     '--pytorch_dump_folder_path', default=None, type=str, required=True, help='Path to the output PyTorch model.'
 )
 parser.add_argument(
     '--classification_head', action='store_true', help='Whether to convert a final classification head.'
 )
 lowerCamelCase		      = parser.parse_args()
 convert_roberta_checkpoint_to_pytorch(
     args.roberta_checkpoint_path, args.pytorch_dump_folder_path, args.classification_head
 )


