


'''simple docstring'''






import unittest

from transformers import AutoTokenizer, is_flax_available
from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow


if is_flax_available():
  import jax.numpy as jnp

  from transformers import FlaxXLMRobertaModel






@require_sentencepiece
@require_tokenizers
@require_flax
class        __snake_case	(       unittest.TestCase):







    """simple docstring"""



    @slow
    def __lowercase       (       self   :  Tuple		)       ->  str:
      lowerCAmelCase_      :				List[Any]      =       FlaxXLMRobertaModel.from_pretrained("""xlm-roberta-base"""		)
      lowerCAmelCase_      :				Optional[Any]      =       AutoTokenizer.from_pretrained("""xlm-roberta-base"""		)
      lowerCAmelCase_      :				Union[str, Any]      =       """The dog is cute and lives in the garden house"""
      lowerCAmelCase_      :				int      =       jnp.array([tokenizer.encode(lowerCamelCase		)]		)

      lowerCAmelCase_      :				Any      =       (1, 12, 7_68)  # batch_size, sequence_length, embedding_vector_dim
      lowerCAmelCase_      :				Optional[int]      =       jnp.array(
          [[-0.0_101, 0.1_218, -0.0_803, 0.0_801, 0.1_327, 0.0_776, -0.1_215, 0.2_383, 0.3_338, 0.3_106, 0.0_300, 0.0_252]]		)

      lowerCAmelCase_      :				Optional[Any]      =       model(lowerCamelCase		)["""last_hidden_state"""]
      self.assertEqual(output.shape   ,						lowerCamelCase		)
      # compare the actual values for a slice of last dim
      self.assertTrue(jnp.allclose(output[:, :, -1]   ,						lowerCamelCase   ,						atol=1E-3		)		)







'''simple docstring'''






import requests







def     UpperCamelCase_      (   A__ :       str							,   A__ :       str ):
  '''simple docstring'''





  lowerCAmelCase_      :				Optional[Any]      =       {"""Content-Type""": """application/json"""}
  lowerCAmelCase_      :				Union[str, Any]      =       requests.post(A__							,   json={"""text""": message_body}							,   headers=A__ )
  if response.status_code != 2_00:
    lowerCAmelCase_      :				Dict      =       (
        """Request to slack returned an error """
        f'{response.status_code}, the response is:\n{response.text}'
    )
    raise ValueError(A__ )


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>")



