import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
lowerCAmelCase			:							Tuple     =sys.version_info >= (3, 10)







def 						A__  (					__A=None   , __A=None	):







    '''simple docstring'''
    return field(default_factory=lambda: default   , metadata=__A	)




@dataclass
class 	__snake_case	:





      '''simple docstring'''






      _snake_case    		=       42
      _snake_case    		=       42
      _snake_case    		=       42
      _snake_case    		=       42





@dataclass
class 	__snake_case	:





      '''simple docstring'''






      _snake_case    		=       42
      _snake_case    		=       field(default='toto' ,  metadata={'help': 'help message'}		)





@dataclass
class 	__snake_case	:





      '''simple docstring'''






      _snake_case    		=       False
      _snake_case    		=       True
      _snake_case    		=       None





class 	__snake_case	( __lowerCAmelCase		):





      '''simple docstring'''






      _snake_case    		=       'titi'
      _snake_case    		=       'toto'





class 	__snake_case	( __lowerCAmelCase		):





      '''simple docstring'''






      _snake_case    		=       'titi'
      _snake_case    		=       'toto'
      _snake_case    		=       42





@dataclass
class 	__snake_case	:





      '''simple docstring'''






      _snake_case    		=       "toto"



      def 	_SCREAMING_SNAKE_CASE    (					self     :				int)				->Any:


          """simple docstring"""


          _lowerCamelCase     :		Union[str, Any] 						=						BasicEnum(self.foo)





@dataclass
class 	__snake_case	:





      '''simple docstring'''






      _snake_case    		=       "toto"



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


          """simple docstring"""


          _lowerCamelCase     :		Union[str, Any] 						=						MixedTypeEnum(self.foo)





@dataclass
class 	__snake_case	:





      '''simple docstring'''






      _snake_case    		=       None
      _snake_case    		=       field(default=__lowerCAmelCase ,  metadata={'help': 'help message'}		)
      _snake_case    		=       None
      _snake_case    		=       list_field(default=[]		)
      _snake_case    		=       list_field(default=[]		)





@dataclass
class 	__snake_case	:





      '''simple docstring'''






      _snake_case    		=       list_field(default=[]		)
      _snake_case    		=       list_field(default=[1, 2, 3]		)
      _snake_case    		=       list_field(default=['Hallo', 'Bonjour', 'Hello']		)
      _snake_case    		=       list_field(default=[0.1, 0.2, 0.3]		)





@dataclass
class 	__snake_case	:





      '''simple docstring'''






      _snake_case    		=       field()
      _snake_case    		=       field()
      _snake_case    		=       field()



      def 	_SCREAMING_SNAKE_CASE    (					self     :				Dict)				->Any:


          """simple docstring"""


          _lowerCamelCase     :		Dict 						=						BasicEnum(self.required_enum)





@dataclass
class 	__snake_case	:





      '''simple docstring'''






      _snake_case    		=       42
      _snake_case    		=       field()
      _snake_case    		=       None
      _snake_case    		=       field(default='toto' ,  metadata={'help': 'help message'}		)
      _snake_case    		=       list_field(default=['Hallo', 'Bonjour', 'Hello']		)


if is_python_no_less_than_3_10:




    @dataclass
    class 	__snake_case	:





          '''simple docstring'''






          _snake_case    		=       False
          _snake_case    		=       True
          _snake_case    		=       None





    @dataclass
    class 	__snake_case	:





          '''simple docstring'''






          _snake_case    		=       None
          _snake_case    		=       field(default=__lowerCAmelCase ,  metadata={'help': 'help message'}		)
          _snake_case    		=       None
          _snake_case    		=       list_field(default=[]		)
          _snake_case    		=       list_field(default=[]		)




class 	__snake_case	( unittest.TestCase		):





      '''simple docstring'''






      def 	_SCREAMING_SNAKE_CASE    (					self     :				Union[str, Any]    ,  _UpperCamelCase     :				argparse.ArgumentParser    ,  _UpperCamelCase     :				argparse.ArgumentParser)				->Tuple:


          """simple docstring"""


          self.assertEqual(len(a._actions)    ,  len(b._actions))
          for x, y in zip(a._actions    ,  b._actions):
              _lowerCamelCase     :		Optional[Any] 						=						{k: v for k, v in vars(_UpperCamelCase).items() if k != """container"""}
              _lowerCamelCase     :		Any 						=						{k: v for k, v in vars(_UpperCamelCase).items() if k != """container"""}

              # Choices with mixed type have custom function as "type"
              # So we need to compare results directly for equality
              if xx.get("""choices"""    ,  _UpperCamelCase) and yy.get("""choices"""    ,  _UpperCamelCase):
                  for expected_choice in yy["choices"] + xx["choices"]:
                      self.assertEqual(xx["""type"""](_UpperCamelCase)    ,  yy["""type"""](_UpperCamelCase))
                  del xx["type"], yy["type"]

              self.assertEqual(_UpperCamelCase    ,  _UpperCamelCase)



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


          """simple docstring"""


          _lowerCamelCase     :		List[Any] 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		Tuple 						=						argparse.ArgumentParser()
          expected.add_argument("""--foo"""    ,  type=_UpperCamelCase    ,  required=_UpperCamelCase)
          expected.add_argument("""--bar"""    ,  type=_UpperCamelCase    ,  required=_UpperCamelCase)
          expected.add_argument("""--baz"""    ,  type=_UpperCamelCase    ,  required=_UpperCamelCase)
          expected.add_argument("""--flag"""    ,  type=_UpperCamelCase    ,  default=_UpperCamelCase    ,  const=_UpperCamelCase    ,  nargs="""?""")
          self.argparsersEqual(_UpperCamelCase    ,  _UpperCamelCase)

          _lowerCamelCase     :		Any 						=						["""--foo""", """1""", """--baz""", """quux""", """--bar""", """0.5"""]
          ((_lowerCamelCase)						,							)     :		Tuple 						=						parser.parse_args_into_dataclasses(_UpperCamelCase    ,  look_for_args_file=_UpperCamelCase)
          self.assertFalse(example.flag)



      def 	_SCREAMING_SNAKE_CASE    (					self     :				Optional[int])				->Union[str, Any]:


          """simple docstring"""


          _lowerCamelCase     :		Any 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		List[Any] 						=						argparse.ArgumentParser()
          expected.add_argument("""--foo"""    ,  default=42    ,  type=_UpperCamelCase)
          expected.add_argument("""--baz"""    ,  default="""toto"""    ,  type=_UpperCamelCase    ,  help="""help message""")
          self.argparsersEqual(_UpperCamelCase    ,  _UpperCamelCase)



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


          """simple docstring"""


          _lowerCamelCase     :		Tuple 						=						argparse.ArgumentParser()
          expected.add_argument("""--foo"""    ,  type=_UpperCamelCase    ,  default=_UpperCamelCase    ,  const=_UpperCamelCase    ,  nargs="""?""")
          expected.add_argument("""--baz"""    ,  type=_UpperCamelCase    ,  default=_UpperCamelCase    ,  const=_UpperCamelCase    ,  nargs="""?""")
          # A boolean no_* argument always has to come after its "default: True" regular counter-part
          # and its default must be set to False
          expected.add_argument("""--no_baz"""    ,  action="""store_false"""    ,  default=_UpperCamelCase    ,  dest="""baz""")
          expected.add_argument("""--opt"""    ,  type=_UpperCamelCase    ,  default=_UpperCamelCase)

          _lowerCamelCase     :		List[str] 						=						[WithDefaultBoolExample]
          if is_python_no_less_than_3_10:
              dataclass_types.append(_UpperCamelCase)

          for dataclass_type in dataclass_types:
              _lowerCamelCase     :		Optional[Any] 						=						HfArgumentParser(_UpperCamelCase)
              self.argparsersEqual(_UpperCamelCase    ,  _UpperCamelCase)

              _lowerCamelCase     :		str 						=						parser.parse_args([])
              self.assertEqual(_UpperCamelCase    ,  Namespace(foo=_UpperCamelCase    ,  baz=_UpperCamelCase    ,  opt=_UpperCamelCase))

              _lowerCamelCase     :		Any 						=						parser.parse_args(["""--foo""", """--no_baz"""])
              self.assertEqual(_UpperCamelCase    ,  Namespace(foo=_UpperCamelCase    ,  baz=_UpperCamelCase    ,  opt=_UpperCamelCase))

              _lowerCamelCase     :		Union[str, Any] 						=						parser.parse_args(["""--foo""", """--baz"""])
              self.assertEqual(_UpperCamelCase    ,  Namespace(foo=_UpperCamelCase    ,  baz=_UpperCamelCase    ,  opt=_UpperCamelCase))

              _lowerCamelCase     :		int 						=						parser.parse_args(["""--foo""", """True""", """--baz""", """True""", """--opt""", """True"""])
              self.assertEqual(_UpperCamelCase    ,  Namespace(foo=_UpperCamelCase    ,  baz=_UpperCamelCase    ,  opt=_UpperCamelCase))

              _lowerCamelCase     :		Optional[Any] 						=						parser.parse_args(["""--foo""", """False""", """--baz""", """False""", """--opt""", """False"""])
              self.assertEqual(_UpperCamelCase    ,  Namespace(foo=_UpperCamelCase    ,  baz=_UpperCamelCase    ,  opt=_UpperCamelCase))



      def 	_SCREAMING_SNAKE_CASE    (					self     :				str)				->Any:


          """simple docstring"""


          _lowerCamelCase     :		int 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		Dict 						=						argparse.ArgumentParser()
          expected.add_argument(
              """--foo"""    ,  default="""toto"""    ,  choices=["""titi""", """toto""", 42]    ,  type=make_choice_type_function(["""titi""", """toto""", 42])    ,  )
          self.argparsersEqual(_UpperCamelCase    ,  _UpperCamelCase)

          _lowerCamelCase     :		Dict 						=						parser.parse_args([])
          self.assertEqual(args.foo    ,  """toto""")
          _lowerCamelCase     :		Optional[int] 						=						parser.parse_args_into_dataclasses([])[0]
          self.assertEqual(enum_ex.foo    ,  MixedTypeEnum.toto)

          _lowerCamelCase     :		Tuple 						=						parser.parse_args(["""--foo""", """titi"""])
          self.assertEqual(args.foo    ,  """titi""")
          _lowerCamelCase     :		int 						=						parser.parse_args_into_dataclasses(["""--foo""", """titi"""])[0]
          self.assertEqual(enum_ex.foo    ,  MixedTypeEnum.titi)

          _lowerCamelCase     :		List[str] 						=						parser.parse_args(["""--foo""", """42"""])
          self.assertEqual(args.foo    ,  42)
          _lowerCamelCase     :		Union[str, Any] 						=						parser.parse_args_into_dataclasses(["""--foo""", """42"""])[0]
          self.assertEqual(enum_ex.foo    ,  MixedTypeEnum.fourtytwo)



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


          """simple docstring"""


          @dataclass
          class 	__snake_case	:





                '''simple docstring'''






                _snake_case    		=       "toto"





          _lowerCamelCase     :		List[Any] 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		Tuple 						=						argparse.ArgumentParser()
          expected.add_argument(
              """--foo"""    ,  default="""toto"""    ,  choices=("""titi""", """toto""", 42)    ,  type=make_choice_type_function(["""titi""", """toto""", 42])    ,  )
          self.argparsersEqual(_UpperCamelCase    ,  _UpperCamelCase)

          _lowerCamelCase     :		Tuple 						=						parser.parse_args([])
          self.assertEqual(args.foo    ,  """toto""")

          _lowerCamelCase     :		Any 						=						parser.parse_args(["""--foo""", """titi"""])
          self.assertEqual(args.foo    ,  """titi""")

          _lowerCamelCase     :		str 						=						parser.parse_args(["""--foo""", """42"""])
          self.assertEqual(args.foo    ,  42)



      def 	_SCREAMING_SNAKE_CASE    (					self     :				Tuple)				->Tuple:


          """simple docstring"""


          _lowerCamelCase     :		Optional[Any] 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		Any 						=						argparse.ArgumentParser()
          expected.add_argument("""--foo_int"""    ,  nargs="""+"""    ,  default=[]    ,  type=_UpperCamelCase)
          expected.add_argument("""--bar_int"""    ,  nargs="""+"""    ,  default=[1, 2, 3]    ,  type=_UpperCamelCase)
          expected.add_argument("""--foo_str"""    ,  nargs="""+"""    ,  default=["""Hallo""", """Bonjour""", """Hello"""]    ,  type=_UpperCamelCase)
          expected.add_argument("""--foo_float"""    ,  nargs="""+"""    ,  default=[0.1, 0.2, 0.3]    ,  type=_UpperCamelCase)

          self.argparsersEqual(_UpperCamelCase    ,  _UpperCamelCase)

          _lowerCamelCase     :		int 						=						parser.parse_args([])
          self.assertEqual(
              _UpperCamelCase    ,  Namespace(foo_int=[]    ,  bar_int=[1, 2, 3]    ,  foo_str=["""Hallo""", """Bonjour""", """Hello"""]    ,  foo_float=[0.1, 0.2, 0.3])    ,  )

          _lowerCamelCase     :		Any 						=						parser.parse_args("""--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7""".split())
          self.assertEqual(_UpperCamelCase    ,  Namespace(foo_int=[1]    ,  bar_int=[2, 3]    ,  foo_str=["""a""", """b""", """c"""]    ,  foo_float=[0.1, 0.7]))



      def 	_SCREAMING_SNAKE_CASE    (					self     :				int)				->Optional[Any]:


          """simple docstring"""


          _lowerCamelCase     :		Optional[Any] 						=						argparse.ArgumentParser()
          expected.add_argument("""--foo"""    ,  default=_UpperCamelCase    ,  type=_UpperCamelCase)
          expected.add_argument("""--bar"""    ,  default=_UpperCamelCase    ,  type=_UpperCamelCase    ,  help="""help message""")
          expected.add_argument("""--baz"""    ,  default=_UpperCamelCase    ,  type=_UpperCamelCase)
          expected.add_argument("""--ces"""    ,  nargs="""+"""    ,  default=[]    ,  type=_UpperCamelCase)
          expected.add_argument("""--des"""    ,  nargs="""+"""    ,  default=[]    ,  type=_UpperCamelCase)

          _lowerCamelCase     :		str 						=						[OptionalExample]
          if is_python_no_less_than_3_10:
              dataclass_types.append(_UpperCamelCase)

          for dataclass_type in dataclass_types:
              _lowerCamelCase     :		Tuple 						=						HfArgumentParser(_UpperCamelCase)

              self.argparsersEqual(_UpperCamelCase    ,  _UpperCamelCase)

              _lowerCamelCase     :		int 						=						parser.parse_args([])
              self.assertEqual(_UpperCamelCase    ,  Namespace(foo=_UpperCamelCase    ,  bar=_UpperCamelCase    ,  baz=_UpperCamelCase    ,  ces=[]    ,  des=[]))

              _lowerCamelCase     :		List[Any] 						=						parser.parse_args("""--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3""".split())
              self.assertEqual(_UpperCamelCase    ,  Namespace(foo=12    ,  bar=3.1_4    ,  baz="""42"""    ,  ces=["""a""", """b""", """c"""]    ,  des=[1, 2, 3]))



      def 	_SCREAMING_SNAKE_CASE    (					self     :				Optional[int])				->List[Any]:


          """simple docstring"""


          _lowerCamelCase     :		str 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		str 						=						argparse.ArgumentParser()
          expected.add_argument("""--required_list"""    ,  nargs="""+"""    ,  type=_UpperCamelCase    ,  required=_UpperCamelCase)
          expected.add_argument("""--required_str"""    ,  type=_UpperCamelCase    ,  required=_UpperCamelCase)
          expected.add_argument(
              """--required_enum"""    ,  type=make_choice_type_function(["""titi""", """toto"""])    ,  choices=["""titi""", """toto"""]    ,  required=_UpperCamelCase    ,  )
          self.argparsersEqual(_UpperCamelCase    ,  _UpperCamelCase)



      def 	_SCREAMING_SNAKE_CASE    (					self     :				str)				->Optional[int]:


          """simple docstring"""


          _lowerCamelCase     :		str 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		Optional[Any] 						=						argparse.ArgumentParser()
          expected.add_argument("""--foo"""    ,  type=_UpperCamelCase    ,  required=_UpperCamelCase)
          expected.add_argument(
              """--required_enum"""    ,  type=make_choice_type_function(["""titi""", """toto"""])    ,  choices=["""titi""", """toto"""]    ,  required=_UpperCamelCase    ,  )
          expected.add_argument("""--opt"""    ,  type=_UpperCamelCase    ,  default=_UpperCamelCase)
          expected.add_argument("""--baz"""    ,  default="""toto"""    ,  type=_UpperCamelCase    ,  help="""help message""")
          expected.add_argument("""--foo_str"""    ,  nargs="""+"""    ,  default=["""Hallo""", """Bonjour""", """Hello"""]    ,  type=_UpperCamelCase)
          self.argparsersEqual(_UpperCamelCase    ,  _UpperCamelCase)



      def 	_SCREAMING_SNAKE_CASE    (					self     :				str)				->Optional[int]:


          """simple docstring"""


          _lowerCamelCase     :		List[str] 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		List[Any] 						=						{
              """foo""": 12,
              """bar""": 3.1_4,
              """baz""": """42""",
              """flag""": True,
          }

          _lowerCamelCase     :		int 						=						parser.parse_dict(_UpperCamelCase)[0]
          _lowerCamelCase     :		List[Any] 						=						BasicExample(**_UpperCamelCase)
          self.assertEqual(_UpperCamelCase    ,  _UpperCamelCase)



      def 	_SCREAMING_SNAKE_CASE    (					self     :				Optional[Any])				->List[Any]:


          """simple docstring"""


          _lowerCamelCase     :		Dict 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		Tuple 						=						{
              """foo""": 12,
              """bar""": 3.1_4,
              """baz""": """42""",
              """flag""": True,
              """extra""": 42,
          }

          self.assertRaises(_UpperCamelCase    ,  parser.parse_dict    ,  _UpperCamelCase    ,  allow_extra_keys=_UpperCamelCase)



      def 	_SCREAMING_SNAKE_CASE    (					self     :				str)				->Tuple:


          """simple docstring"""


          _lowerCamelCase     :		str 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		List[str] 						=						{
              """foo""": 12,
              """bar""": 3.1_4,
              """baz""": """42""",
              """flag""": True,
          }
          with tempfile.TemporaryDirectory() as tmp_dir:
              _lowerCamelCase     :		Union[str, Any] 						=						os.path.join(_UpperCamelCase    ,  """temp_json""")
              os.mkdir(_UpperCamelCase)
              with open(temp_local_path + """.json"""    ,  """w+""") as f:
                  json.dump(_UpperCamelCase    ,  _UpperCamelCase)
              _lowerCamelCase     :		List[str] 						=						parser.parse_yaml_file(Path(temp_local_path + """.json"""))[0]

          _lowerCamelCase     :		Dict 						=						BasicExample(**_UpperCamelCase)
          self.assertEqual(_UpperCamelCase    ,  _UpperCamelCase)



      def 	_SCREAMING_SNAKE_CASE    (					self     :				str)				->Tuple:


          """simple docstring"""


          _lowerCamelCase     :		Tuple 						=						HfArgumentParser(_UpperCamelCase)

          _lowerCamelCase     :		Union[str, Any] 						=						{
              """foo""": 12,
              """bar""": 3.1_4,
              """baz""": """42""",
              """flag""": True,
          }
          with tempfile.TemporaryDirectory() as tmp_dir:
              _lowerCamelCase     :		int 						=						os.path.join(_UpperCamelCase    ,  """temp_yaml""")
              os.mkdir(_UpperCamelCase)
              with open(temp_local_path + """.yaml"""    ,  """w+""") as f:
                  yaml.dump(_UpperCamelCase    ,  _UpperCamelCase)
              _lowerCamelCase     :		Optional[int] 						=						parser.parse_yaml_file(Path(temp_local_path + """.yaml"""))[0]
          _lowerCamelCase     :		Any 						=						BasicExample(**_UpperCamelCase)
          self.assertEqual(_UpperCamelCase    ,  _UpperCamelCase)




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


          """simple docstring"""


          _lowerCamelCase     :		Optional[int] 						=						HfArgumentParser(_UpperCamelCase)
          self.assertIsNotNone(_UpperCamelCase)





import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow


if is_torch_available():
    import torch

    from transformers import XLMRobertaModel




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





      '''simple docstring'''






      @slow
      def 	_SCREAMING_SNAKE_CASE    (					self     :				Tuple)				->int:


          """simple docstring"""


          _lowerCamelCase     :		Tuple 						=						XLMRobertaModel.from_pretrained("""xlm-roberta-base""")
          _lowerCamelCase     :		Optional[int] 						=						torch.tensor([[0, 581, 1_0269, 83, 9_9942, 136, 6_0742, 23, 70, 8_0583, 1_8276, 2]])
          # The dog is cute and lives in the garden house

          _lowerCamelCase     :		Optional[Any] 						=						torch.Size((1, 12, 768))  # batch_size, sequence_length, embedding_vector_dim
          _lowerCamelCase     :		str 						=						torch.tensor(
              [[-0.0_1_0_1, 0.1_2_1_8, -0.0_8_0_3, 0.0_8_0_1, 0.1_3_2_7, 0.0_7_7_6, -0.1_2_1_5, 0.2_3_8_3, 0.3_3_3_8, 0.3_1_0_6, 0.0_3_0_0, 0.0_2_5_2]])
          #  xlmr = torch.hub.load('pytorch/fairseq', 'xlmr.base')
          #  xlmr.eval()
          #  expected_output_values_last_dim = xlmr.extract_features(input_ids[0])[:, :, -1]
          with torch.no_grad():
              _lowerCamelCase     :		List[str] 						=						model(_UpperCamelCase)["""last_hidden_state"""].detach()
          self.assertEqual(output.shape    ,  _UpperCamelCase)
          # compare the actual values for a slice of last dim
          self.assertTrue(torch.allclose(output[:, :, -1]    ,  _UpperCamelCase    ,  atol=1E-3))




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


          """simple docstring"""


          _lowerCamelCase     :		List[Any] 						=						XLMRobertaModel.from_pretrained("""xlm-roberta-large""")
          _lowerCamelCase     :		Optional[Any] 						=						torch.tensor([[0, 581, 1_0269, 83, 9_9942, 136, 6_0742, 23, 70, 8_0583, 1_8276, 2]])
          # The dog is cute and lives in the garden house

          _lowerCamelCase     :		str 						=						torch.Size((1, 12, 1024))  # batch_size, sequence_length, embedding_vector_dim
          _lowerCamelCase     :		Union[str, Any] 						=						torch.tensor(
              [[-0.0_6_9_9, -0.0_3_1_8, 0.0_7_0_5, -0.1_2_4_1, 0.0_9_9_9, -0.0_5_2_0, 0.1_0_0_4, -0.1_8_3_8, -0.4_7_0_4, 0.1_4_3_7, 0.0_8_2_1, 0.0_1_2_6]])
          #  xlmr = torch.hub.load('pytorch/fairseq', 'xlmr.large')
          #  xlmr.eval()
          #  expected_output_values_last_dim = xlmr.extract_features(input_ids[0])[:, :, -1]
          with torch.no_grad():
              _lowerCamelCase     :		int 						=						model(_UpperCamelCase)["""last_hidden_state"""].detach()
          self.assertEqual(output.shape    ,  _UpperCamelCase)
          # compare the actual values for a slice of last dim
          self.assertTrue(torch.allclose(output[:, :, -1]    ,  _UpperCamelCase    ,  atol=1E-3))




