




from __future__ import annotations

import os
class      _UpperCamelCase :
      UpperCAmelCase_            =						(
          """High card""",
          """One pair""",
          """Two pairs""",
          """Three of a kind""",
          """Straight""",
          """Flush""",
          """Full house""",
          """Four of a kind""",
          """Straight flush""",
          """Royal flush""",
      )

      UpperCAmelCase_            =						(
          """""",  # placeholder as tuples are zero-indexed
          """One""",
          """Two""",
          """Three""",
          """Four""",
          """Five""",
          """Six""",
          """Seven""",
          """Eight""",
          """Nine""",
          """Ten""",
          """Jack""",
          """Queen""",
          """King""",
          """Ace""",
      )
      def __init__(     self				:Dict	, lowerCamelCase				:str )       ->     None:
       if not isinstance(lowerCamelCase	, lowerCamelCase ):
        UpperCAmelCase__								=  f'''Hand should be of type \'str\': {hand!r}'''
        raise TypeError(lowerCamelCase )
       # split removes duplicate whitespaces so no need of strip
       if len(hand.split(" " ) ) != 5:
        UpperCAmelCase__								=  f'''Hand should contain only 5 cards: {hand!r}'''
        raise ValueError(lowerCamelCase )
       UpperCAmelCase__								=  hand
       UpperCAmelCase__								=  0
       UpperCAmelCase__								=  0
       UpperCAmelCase__	,	UpperCAmelCase__								=  self._internal_state()
       UpperCAmelCase__								=  self._get_hand_type()
       UpperCAmelCase__								=  self._card_values[0]
      @property
      def 		UpperCAmelCase_  (     self				:Any )       ->     str:
       return self._hand
      def 		UpperCAmelCase_  (     self				:str	, lowerCamelCase				:PokerHand )       ->     str:
       # Breaking the tie works on the following order of precedence:
       # 1. First pair (default 0)
       # 2. Second pair (default 0)
       # 3. Compare all cards in reverse order because they are sorted.

       # First pair and second pair will only be a non-zero value if the card
       # type is either from the following:
       # 21: Four of a kind
       # 20: Full house
       # 17: Three of a kind
       # 16: Two pairs
       # 15: One pair
       if self._hand_type > other._hand_type:
        return "Win"
       elif self._hand_type < other._hand_type:
        return "Loss"
       elif self._first_pair == other._first_pair:
        if self._second_pair == other._second_pair:
         return self._compare_cards(lowerCamelCase )
        else:
         return "Win" if self._second_pair > other._second_pair else "Loss"
       return "Win" if self._first_pair > other._first_pair else "Loss"
      def 		UpperCAmelCase_  (     self				:List[Any] )       ->     str:
       UpperCAmelCase__								=  PokerHand._HAND_NAME[self._hand_type - 14]
       UpperCAmelCase__								=  PokerHand._CARD_NAME[self._high_card]
       UpperCAmelCase__								=  PokerHand._CARD_NAME[self._first_pair]
       UpperCAmelCase__								=  PokerHand._CARD_NAME[self._second_pair]
       if self._hand_type in [22, 19, 18]:
        return name + f''', {high}-high'''
       elif self._hand_type in [21, 17, 15]:
        return name + f''', {paira}s'''
       elif self._hand_type in [20, 16]:
        UpperCAmelCase__								=  "over" if self._hand_type == 20 else "and"
        return name + f''', {paira}s {join} {paira}s'''
       elif self._hand_type == 23:
        return name
       else:
        return name + f''', {high}'''
      def 		UpperCAmelCase_  (     self				:Any	, lowerCamelCase				:PokerHand )       ->     str:
       # Enumerate gives us the index as well as the element of a list
       for index, card_value in enumerate(self._card_values ):
        if card_value != other._card_values[index]:
         return "Win" if card_value > other._card_values[index] else "Loss"
       return "Tie"
      def 		UpperCAmelCase_  (     self				:List[Any] )       ->     int:
       # Number representing the type of hand internally:
       # 23: Royal flush
       # 22: Straight flush
       # 21: Four of a kind
       # 20: Full house
       # 19: Flush
       # 18: Straight
       # 17: Three of a kind
       # 16: Two pairs
       # 15: One pair
       # 14: High card
       if self._is_flush():
        if self._is_five_high_straight() or self._is_straight():
         return 23 if sum(self._card_values ) == 60 else 22
        return 19
       elif self._is_five_high_straight() or self._is_straight():
        return 18
       return 14 + self._is_same_kind()
      def 		UpperCAmelCase_  (     self				:Any )       ->     bool:
       return len(self._card_suit ) == 1
      def 		UpperCAmelCase_  (     self				:Optional[int] )       ->     bool:
       # If a card is a five high straight (low ace) change the location of
       # ace from the start of the list to the end. Check whether the first
       # element is ace or not. (Don't want to change again)
       # Five high straight (low ace): AH 2H 3S 4C 5D
       # Why use sorted here? One call to this function will mutate the list to
       # [5, 4, 3, 2, 14] and so for subsequent calls (which will be rare) we
       # need to compare the sorted version.
       # Refer test_multiple_calls_five_high_straight in test_poker_hand.py
       if sorted(self._card_values ) == [2, 3, 4, 5, 14]:
        if self._card_values[0] == 14:
         # Remember, our list is sorted in reverse order
         UpperCAmelCase__								=  self._card_values.pop(0 )
         self._card_values.append(lowerCamelCase )
        return True
       return False
      def 		UpperCAmelCase_  (     self				:int )       ->     bool:
       for i in range(4 ):
        if self._card_values[i] - self._card_values[i + 1] != 1:
         return False
       return True
      def 		UpperCAmelCase_  (     self				:Optional[int] )       ->     int:
       # Kind Values for internal use:
       # 7: Four of a kind
       # 6: Full house
       # 3: Three of a kind
       # 2: Two pairs
       # 1: One pair
       # 0: False
       UpperCAmelCase__								=  UpperCAmelCase__								=  UpperCAmelCase__								=  0
       for i in range(4 ):
        # Compare two cards at a time, if they are same increase 'kind',
        # add the value of the card to val1, if it is repeating again we
        # will add 2 to 'kind' as there are now 3 cards with same value.
        # If we get card of different value than val1, we will do the same
        # thing with val2
        if self._card_values[i] == self._card_values[i + 1]:
         if not vala:
          UpperCAmelCase__								=  self._card_values[i]
          kind += 1
         elif vala == self._card_values[i]:
          kind += 2
         elif not vala:
          UpperCAmelCase__								=  self._card_values[i]
          kind += 1
         elif vala == self._card_values[i]:
          kind += 2
        # For consistency in hand type (look at note in _get_hand_type function)
       UpperCAmelCase__								=  kind + 2 if kind in [4, 5] else kind
       # first meaning first pair to compare in 'compare_with'
       UpperCAmelCase__								=  max(lowerCamelCase	, lowerCamelCase )
       UpperCAmelCase__								=  min(lowerCamelCase	, lowerCamelCase )
       # If it's full house (three count pair + two count pair), make sure
       # first pair is three count and if not then switch them both.
       if kind == 6 and self._card_values.count(lowerCamelCase ) != 3:
        UpperCAmelCase__	,	UpperCAmelCase__								=  second, first
       UpperCAmelCase__								=  first
       UpperCAmelCase__								=  second
       return kind
      def 		UpperCAmelCase_  (     self				:List[str] )       ->     tuple[list[int], set[str]]:
       # Internal representation of hand as a list of card values and
       # a set of card suit
       UpperCAmelCase__								=  {"T": "10", "J": "11", "Q": "12", "K": "13", "A": "14"}
       UpperCAmelCase__								=  self._hand.translate(str.maketrans(lowerCamelCase ) ).split()
       UpperCAmelCase__								=  [int(card[:-1] ) for card in new_hand]
       UpperCAmelCase__								=  {card[-1] for card in new_hand}
       return sorted(lowerCamelCase	, reverse=lowerCamelCase ), card_suit
      def __repr__(     self				:List[str] )       ->     Optional[Any]:
       return f'''{self.__class__}("{self._hand}")'''
      def __str__(     self				:Dict )       ->     Optional[Any]:
       return self._hand
      def __eq__(     self				:Union[str, Any]	, lowerCamelCase				:str )       ->     List[Any]:
       if isinstance(lowerCamelCase	, lowerCamelCase ):
        return self.compare_with(lowerCamelCase ) == "Tie"
       return NotImplemented
      def __lt__(     self				:List[str]	, lowerCamelCase				:Tuple )       ->     str:
       if isinstance(lowerCamelCase	, lowerCamelCase ):
        return self.compare_with(lowerCamelCase ) == "Loss"
       return NotImplemented
      def __le__(     self				:Dict	, lowerCamelCase				:List[str] )       ->     List[str]:
       if isinstance(lowerCamelCase	, lowerCamelCase ):
        return self < other or self == other
       return NotImplemented
      def __gt__(     self				:Any	, lowerCamelCase				:str )       ->     str:
       if isinstance(lowerCamelCase	, lowerCamelCase ):
        return not self < other and self != other
       return NotImplemented
      def __ge__(     self				:List[Any]	, lowerCamelCase				:List[Any] )       ->     Optional[Any]:
       if isinstance(lowerCamelCase	, lowerCamelCase ):
        return not self < other
       return NotImplemented







      def __hash__(     self				:int )       ->     Dict:
       return object.__hash__(self )



def   lowerCAmelCase						(						):




 """simple docstring"""







 UpperCAmelCase__								=  0
 UpperCAmelCase__								=  os.path.abspath(os.path.dirname(_lowerCAmelCase		)		)
 UpperCAmelCase__								=  os.path.join(_lowerCAmelCase  ,							"poker_hands.txt"		)
 with open(_lowerCAmelCase		) as file_hand:
  for line in file_hand:
   UpperCAmelCase__								=  line[:14].strip()
   UpperCAmelCase__								=  line[15:].strip()
   UpperCAmelCase__	,	UpperCAmelCase__								=  PokerHand(_lowerCAmelCase		), PokerHand(_lowerCAmelCase		)
   UpperCAmelCase__								=  player.compare_with(_lowerCAmelCase		)
   if output == "Win":
    answer += 1
 return answer


if __name__ == "__main__":
  solution()











import unittest

from transformers import YosoConfig, 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, floats_tensor, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
  import torch

  from transformers import (
      YosoForMaskedLM,
      YosoForMultipleChoice,
      YosoForQuestionAnswering,
      YosoForSequenceClassification,
      YosoForTokenClassification,
      YosoModel,
  )
  from transformers.models.yoso.modeling_yoso import YOSO_PRETRAINED_MODEL_ARCHIVE_LIST
class      _UpperCamelCase :
      def __init__(     self				:int	, lowerCamelCase				:int	, lowerCamelCase				:Optional[Any]=13	, lowerCamelCase				:Optional[Any]=7	, lowerCamelCase				:Union[str, Any]=True	, lowerCamelCase				:Tuple=True	, lowerCamelCase				:Optional[Any]=True	, lowerCamelCase				:str=True	, lowerCamelCase				:Any=99	, lowerCamelCase				:Optional[int]=32	, lowerCamelCase				:Any=5	, lowerCamelCase				:List[Any]=4	, lowerCamelCase				:Optional[Any]=37	, lowerCamelCase				:Tuple="gelu"	, lowerCamelCase				:Optional[int]=0.1	, lowerCamelCase				:Any=0.1	, lowerCamelCase				:List[Any]=512	, lowerCamelCase				:Tuple=16	, lowerCamelCase				:Optional[int]=2	, lowerCamelCase				:str=0.02	, lowerCamelCase				:Dict=3	, lowerCamelCase				:Union[str, Any]=4	, lowerCamelCase				:Union[str, Any]=None	, )       ->     List[Any]:
       UpperCAmelCase__								=  parent
       UpperCAmelCase__								=  batch_size
       UpperCAmelCase__								=  seq_length
       UpperCAmelCase__								=  is_training
       UpperCAmelCase__								=  use_input_mask
       UpperCAmelCase__								=  use_token_type_ids
       UpperCAmelCase__								=  use_labels
       UpperCAmelCase__								=  vocab_size
       UpperCAmelCase__								=  hidden_size
       UpperCAmelCase__								=  num_hidden_layers
       UpperCAmelCase__								=  num_attention_heads
       UpperCAmelCase__								=  intermediate_size
       UpperCAmelCase__								=  hidden_act
       UpperCAmelCase__								=  hidden_dropout_prob
       UpperCAmelCase__								=  attention_probs_dropout_prob
       UpperCAmelCase__								=  max_position_embeddings
       UpperCAmelCase__								=  type_vocab_size
       UpperCAmelCase__								=  type_sequence_label_size
       UpperCAmelCase__								=  initializer_range
       UpperCAmelCase__								=  num_labels
       UpperCAmelCase__								=  num_choices
       UpperCAmelCase__								=  scope
      def 		UpperCAmelCase_  (     self				:Union[str, Any] )       ->     Any:
       UpperCAmelCase__								=  ids_tensor([self.batch_size, self.seq_length]	, self.vocab_size )

       UpperCAmelCase__								=  None
       if self.use_input_mask:
        UpperCAmelCase__								=  random_attention_mask([self.batch_size, self.seq_length] )

       UpperCAmelCase__								=  None
       if self.use_token_type_ids:
        UpperCAmelCase__								=  ids_tensor([self.batch_size, self.seq_length]	, self.type_vocab_size )

       UpperCAmelCase__								=  None
       UpperCAmelCase__								=  None
       UpperCAmelCase__								=  None
       if self.use_labels:
        UpperCAmelCase__								=  ids_tensor([self.batch_size]	, self.type_sequence_label_size )
        UpperCAmelCase__								=  ids_tensor([self.batch_size, self.seq_length]	, self.num_labels )
        UpperCAmelCase__								=  ids_tensor([self.batch_size]	, self.num_choices )

       UpperCAmelCase__								=  self.get_config()

       return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels
      def 		UpperCAmelCase_  (     self				:List[Any] )       ->     Optional[Any]:
       return YosoConfig(
           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	, is_decoder=lowerCamelCase	, initializer_range=self.initializer_range	, )
      def 		UpperCAmelCase_  (     self				:int )       ->     Any:
       UpperCAmelCase__								=  self.get_config()
       UpperCAmelCase__								=  300
       return config
      def 		UpperCAmelCase_  (     self				:List[str] )       ->     Tuple:
       (
           (
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	
       )								=  self.prepare_config_and_inputs()

       UpperCAmelCase__								=  True
       UpperCAmelCase__								=  floats_tensor([self.batch_size, self.seq_length, self.hidden_size] )
       UpperCAmelCase__								=  ids_tensor([self.batch_size, self.seq_length]	, vocab_size=2 )

       return (
           config,
           input_ids,
           token_type_ids,
           input_mask,
           sequence_labels,
           token_labels,
           choice_labels,
           encoder_hidden_states,
           encoder_attention_mask,
       )
      def 		UpperCAmelCase_  (     self				:Any	, lowerCamelCase				:List[str]	, lowerCamelCase				:List[str]	, lowerCamelCase				:str	, lowerCamelCase				:Union[str, Any]	, lowerCamelCase				:Optional[int]	, lowerCamelCase				:Any	, lowerCamelCase				:Tuple )       ->     List[Any]:
       UpperCAmelCase__								=  YosoModel(config=lowerCamelCase )
       model.to(lowerCamelCase )
       model.eval()
       UpperCAmelCase__								=  model(lowerCamelCase	, attention_mask=lowerCamelCase	, token_type_ids=lowerCamelCase )
       UpperCAmelCase__								=  model(lowerCamelCase	, token_type_ids=lowerCamelCase )
       UpperCAmelCase__								=  model(lowerCamelCase )
       self.parent.assertEqual(result.last_hidden_state.shape	, (self.batch_size, self.seq_length, self.hidden_size) )
      def 		UpperCAmelCase_  (     self				:Any	, lowerCamelCase				:str	, lowerCamelCase				:Dict	, lowerCamelCase				:Any	, lowerCamelCase				:Any	, lowerCamelCase				:int	, lowerCamelCase				:Dict	, lowerCamelCase				:Any	, lowerCamelCase				:Union[str, Any]	, lowerCamelCase				:List[Any]	, )       ->     Optional[int]:
       UpperCAmelCase__								=  True
       UpperCAmelCase__								=  YosoModel(lowerCamelCase )
       model.to(lowerCamelCase )
       model.eval()
       UpperCAmelCase__								=  model(
           lowerCamelCase	, attention_mask=lowerCamelCase	, token_type_ids=lowerCamelCase	, encoder_hidden_states=lowerCamelCase	, encoder_attention_mask=lowerCamelCase	, )
       UpperCAmelCase__								=  model(
           lowerCamelCase	, attention_mask=lowerCamelCase	, token_type_ids=lowerCamelCase	, encoder_hidden_states=lowerCamelCase	, )
       UpperCAmelCase__								=  model(lowerCamelCase	, attention_mask=lowerCamelCase	, token_type_ids=lowerCamelCase )
       self.parent.assertEqual(result.last_hidden_state.shape	, (self.batch_size, self.seq_length, self.hidden_size) )
      def 		UpperCAmelCase_  (     self				:Tuple	, lowerCamelCase				:List[Any]	, lowerCamelCase				:Tuple	, lowerCamelCase				:List[str]	, lowerCamelCase				:Optional[Any]	, lowerCamelCase				:Tuple	, lowerCamelCase				:Optional[Any]	, lowerCamelCase				:int )       ->     Optional[int]:
       UpperCAmelCase__								=  YosoForMaskedLM(config=lowerCamelCase )
       model.to(lowerCamelCase )
       model.eval()
       UpperCAmelCase__								=  model(lowerCamelCase	, attention_mask=lowerCamelCase	, token_type_ids=lowerCamelCase	, labels=lowerCamelCase )
       self.parent.assertEqual(result.logits.shape	, (self.batch_size, self.seq_length, self.vocab_size) )
      def 		UpperCAmelCase_  (     self				:Dict	, lowerCamelCase				:str	, lowerCamelCase				:Dict	, lowerCamelCase				:List[Any]	, lowerCamelCase				:Optional[int]	, lowerCamelCase				:Union[str, Any]	, lowerCamelCase				:int	, lowerCamelCase				:Optional[Any] )       ->     Any:
       UpperCAmelCase__								=  YosoForQuestionAnswering(config=lowerCamelCase )
       model.to(lowerCamelCase )
       model.eval()
       UpperCAmelCase__								=  model(
           lowerCamelCase	, attention_mask=lowerCamelCase	, token_type_ids=lowerCamelCase	, start_positions=lowerCamelCase	, end_positions=lowerCamelCase	, )
       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 		UpperCAmelCase_  (     self				:Optional[Any]	, lowerCamelCase				:Optional[Any]	, lowerCamelCase				:Any	, lowerCamelCase				:List[str]	, lowerCamelCase				:Dict	, lowerCamelCase				:str	, lowerCamelCase				:Tuple	, lowerCamelCase				:int )       ->     Dict:
       UpperCAmelCase__								=  self.num_labels
       UpperCAmelCase__								=  YosoForSequenceClassification(lowerCamelCase )
       model.to(lowerCamelCase )
       model.eval()
       UpperCAmelCase__								=  model(lowerCamelCase	, attention_mask=lowerCamelCase	, token_type_ids=lowerCamelCase	, labels=lowerCamelCase )
       self.parent.assertEqual(result.logits.shape	, (self.batch_size, self.num_labels) )
      def 		UpperCAmelCase_  (     self				:Tuple	, lowerCamelCase				:str	, lowerCamelCase				:int	, lowerCamelCase				:Optional[Any]	, lowerCamelCase				:List[str]	, lowerCamelCase				:Dict	, lowerCamelCase				:Optional[int]	, lowerCamelCase				:str )       ->     Dict:
       UpperCAmelCase__								=  self.num_labels
       UpperCAmelCase__								=  YosoForTokenClassification(config=lowerCamelCase )
       model.to(lowerCamelCase )
       model.eval()
       UpperCAmelCase__								=  model(lowerCamelCase	, attention_mask=lowerCamelCase	, token_type_ids=lowerCamelCase	, labels=lowerCamelCase )
       self.parent.assertEqual(result.logits.shape	, (self.batch_size, self.seq_length, self.num_labels) )
      def 		UpperCAmelCase_  (     self				:Optional[int]	, lowerCamelCase				:Tuple	, lowerCamelCase				:Tuple	, lowerCamelCase				:int	, lowerCamelCase				:Tuple	, lowerCamelCase				:List[str]	, lowerCamelCase				:Optional[Any]	, lowerCamelCase				:List[str] )       ->     List[Any]:
       UpperCAmelCase__								=  self.num_choices
       UpperCAmelCase__								=  YosoForMultipleChoice(config=lowerCamelCase )
       model.to(lowerCamelCase )
       model.eval()
       UpperCAmelCase__								=  input_ids.unsqueeze(1 ).expand(-1	, self.num_choices	, -1 ).contiguous()
       UpperCAmelCase__								=  token_type_ids.unsqueeze(1 ).expand(-1	, self.num_choices	, -1 ).contiguous()
       UpperCAmelCase__								=  input_mask.unsqueeze(1 ).expand(-1	, self.num_choices	, -1 ).contiguous()
       UpperCAmelCase__								=  model(
           lowerCamelCase	, attention_mask=lowerCamelCase	, token_type_ids=lowerCamelCase	, labels=lowerCamelCase	, )
       self.parent.assertEqual(result.logits.shape	, (self.batch_size, self.num_choices) )







      def 		UpperCAmelCase_  (     self				:int )       ->     List[Any]:
       UpperCAmelCase__								=  self.prepare_config_and_inputs()
       (
           (
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	(
           UpperCAmelCase__
       )	,	
       )								=  config_and_inputs
       UpperCAmelCase__								=  {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
       return config, inputs_dict



@require_torch
class      _UpperCamelCase (			lowerCAmelCase		,    lowerCAmelCase		,    unittest.TestCase						):
      UpperCAmelCase_            =						(
          (
              YosoModel,
              YosoForMaskedLM,
              YosoForMultipleChoice,
              YosoForQuestionAnswering,
              YosoForSequenceClassification,
              YosoForTokenClassification,
          )
          if is_torch_available()
          else ()
      )
      UpperCAmelCase_            =						False
      UpperCAmelCase_            =						False
      UpperCAmelCase_            =						False

      UpperCAmelCase_            =						()
      UpperCAmelCase_            =						(
          {
              """feature-extraction""": YosoModel,
              """fill-mask""": YosoForMaskedLM,
              """question-answering""": YosoForQuestionAnswering,
              """text-classification""": YosoForSequenceClassification,
              """token-classification""": YosoForTokenClassification,
              """zero-shot""": YosoForSequenceClassification,
          }
          if is_torch_available()
          else {}
      )
      def 		UpperCAmelCase_  (     self				:Any )       ->     Optional[Any]:
       UpperCAmelCase__								=  YosoModelTester(self )
       UpperCAmelCase__								=  ConfigTester(self	, config_class=lowerCamelCase	, hidden_size=37 )
      def 		UpperCAmelCase_  (     self				:List[Any] )       ->     List[str]:
       self.config_tester.run_common_tests()
      def 		UpperCAmelCase_  (     self				:Optional[int] )       ->     List[Any]:
       UpperCAmelCase__								=  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_model(*lowerCamelCase )
      def 		UpperCAmelCase_  (     self				:Tuple )       ->     Optional[Any]:
       UpperCAmelCase__								=  self.model_tester.prepare_config_and_inputs()
       for type in ["absolute", "relative_key", "relative_key_query"]:
        UpperCAmelCase__								=  type
        self.model_tester.create_and_check_model(*lowerCamelCase )
      def 		UpperCAmelCase_  (     self				:Tuple )       ->     Optional[int]:
       UpperCAmelCase__								=  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_masked_lm(*lowerCamelCase )
      def 		UpperCAmelCase_  (     self				:Union[str, Any] )       ->     Dict:
       UpperCAmelCase__								=  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_multiple_choice(*lowerCamelCase )
      def 		UpperCAmelCase_  (     self				:str )       ->     Optional[Any]:
       UpperCAmelCase__								=  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_question_answering(*lowerCamelCase )
      def 		UpperCAmelCase_  (     self				:Any )       ->     List[str]:
       UpperCAmelCase__								=  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_sequence_classification(*lowerCamelCase )
      def 		UpperCAmelCase_  (     self				:Any )       ->     str:
       UpperCAmelCase__								=  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_token_classification(*lowerCamelCase )
      @slow
      def 		UpperCAmelCase_  (     self				:List[Any] )       ->     Optional[int]:
       for model_name in YOSO_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        UpperCAmelCase__								=  YosoModel.from_pretrained(lowerCamelCase )
        self.assertIsNotNone(lowerCamelCase )







      def 		UpperCAmelCase_  (     self				:int )       ->     List[str]:
       return



@require_torch
class      _UpperCamelCase (			unittest.TestCase						):
      @slow
      def 		UpperCAmelCase_  (     self				:Optional[Any] )       ->     Optional[int]:
       UpperCAmelCase__								=  YosoModel.from_pretrained("uw-madison/yoso-4096" )
       UpperCAmelCase__								=  torch.tensor([[0, 1, 2, 3, 4, 5]] )

       with torch.no_grad():
        UpperCAmelCase__								=  model(lowerCamelCase )[0]

       UpperCAmelCase__								=  torch.Size((1, 6, 768) )
       self.assertEqual(output.shape	, lowerCamelCase )

       UpperCAmelCase__								=  torch.tensor(
           [[[-0.06_11, 0.12_42, 0.08_40], [0.02_80, -0.00_48, 0.11_25], [0.01_06, 0.02_26, 0.07_51]]] )

       self.assertTrue(torch.allclose(output[:, :3, :3]	, lowerCamelCase	, atol=1e-4 ) )
      @slow
      def 		UpperCAmelCase_  (     self				:Optional[Any] )       ->     List[Any]:
       UpperCAmelCase__								=  YosoForMaskedLM.from_pretrained("uw-madison/yoso-4096" )
       UpperCAmelCase__								=  torch.tensor([[0, 1, 2, 3, 4, 5]] )

       with torch.no_grad():
        UpperCAmelCase__								=  model(lowerCamelCase )[0]

       UpperCAmelCase__								=  5_0265

       UpperCAmelCase__								=  torch.Size((1, 6, vocab_size) )
       self.assertEqual(output.shape	, lowerCamelCase )

       UpperCAmelCase__								=  torch.tensor(
           [[[-2.13_13, -3.72_85, -2.24_07], [-2.70_47, -3.33_14, -2.64_08], [0.06_29, -2.51_66, -0.33_56]]] )

       self.assertTrue(torch.allclose(output[:, :3, :3]	, lowerCamelCase	, atol=1e-4 ) )







      @slow
      def 		UpperCAmelCase_  (     self				:Any )       ->     str:
       UpperCAmelCase__								=  YosoForMaskedLM.from_pretrained("uw-madison/yoso-4096" )
       UpperCAmelCase__								=  torch.arange(4096 ).unsqueeze(0 )

       with torch.no_grad():
        UpperCAmelCase__								=  model(lowerCamelCase )[0]

       UpperCAmelCase__								=  5_0265

       UpperCAmelCase__								=  torch.Size((1, 4096, vocab_size) )
       self.assertEqual(output.shape	, lowerCamelCase )

       UpperCAmelCase__								=  torch.tensor(
           [[[-2.39_14, -4.37_42, -5.09_56], [-4.09_88, -4.23_84, -7.04_06], [-3.14_27, -3.71_92, -6.68_00]]] )

       self.assertTrue(torch.allclose(output[:, :3, :3]	, lowerCamelCase	, atol=1e-4 ) )





