
'''simple docstring'''


import argparse

import torch

from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert
from transformers.utils import logging


logging.set_verbosity_info()







def      SCREAMING_SNAKE_CASE				(				lowercase_    :      List[str] ,  lowercase_    :      Optional[Any] ,  lowercase_    :      Optional[int]						):
						# Initialise PyTorch model
						lowercase        =							RemBertConfig.from_json_file(a_						)
						print("""Building PyTorch model from configuration: {}""".format(str(a_						)						)						)
						lowercase        =							RemBertModel(a_						)

						# Load weights from tf checkpoint
						load_tf_weights_in_rembert(a_ ,  a_ ,  a_						)

						# Save pytorch-model
						print("""Save PyTorch model to {}""".format(a_						)						)
						torch.save(model.state_dict() ,  a_						)


if __name__ == "__main__":
						lowercase_      :				List[Any]   					=    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(
						    '''--rembert_config_file''',
						    default=None,
						    type=str,
						    required=True,
						    help=(
						        '''The config json file corresponding to the pre-trained RemBERT 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_      :				Dict   					=    parser.parse_args()
						convert_rembert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.rembert_config_file, args.pytorch_dump_path)







'''simple docstring'''


import requests







def      SCREAMING_SNAKE_CASE				(				lowercase_    :      str ,  lowercase_    :      str						):
						lowercase        =							{"""Content-Type""": """application/json"""}
						lowercase        =							requests.post(lowercase_ ,  json={"""text""": message_body} ,  headers=lowercase_						)
						if response.status_code != 200:
												lowercase        =							(
												    """Request to slack returned an error """
												    F"""{response.status_code}, the response is:\n{response.text}"""
												)
												raise ValueError(lowercase_						)


if __name__ == "__main__":
						# Set the slack url to the one provided by Slack when you create the webhook at
						# https://my.slack.com/services/new/incoming-webhook/
						send_slack_message('''<YOUR MESSAGE BODY>''', '''<SLACK CHANNEL URL>''')


