code: 
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  import unittest
  
  from transformers import FunnelConfig, FunnelTokenizer, is_torch_available
  from transformers.models.auto import get_values
  from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
  
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, ids_tensor
  from ...test_pipeline_mixin import PipelineTesterMixin
  
  
  if is_torch_available():
         import torch
  
         from transformers import (
             MODEL_FOR_PRETRAINING_MAPPING,
             FunnelBaseModel,
             FunnelForMaskedLM,
             FunnelForMultipleChoice,
             FunnelForPreTraining,
             FunnelForQuestionAnswering,
             FunnelForSequenceClassification,
             FunnelForTokenClassification,
             FunnelModel,
         )
  
  
  
  
  
  
  class 						lowercase     :
  
  
  
  
  
  
        def __init__(self ,  a__ ,  a__=1_3 ,  a__=7 ,  a__=True ,  a__=True ,  a__=True ,  a__=True ,  a__=9_9 ,  a__=[1, 1, 2] ,  a__=1 ,  a__=3_2 ,  a__=4 ,  a__=8 ,  a__=3_7 ,  a__="gelu_new" ,  a__=0.1 ,  a__=0.1 ,  a__=0.0 ,  a__=5_1_2 ,  a__=3 ,  a__=0.02 ,  a__=3 ,  a__=4 ,  a__=None ,  a__=False ,  )       ->   List[Any]:
           SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= parent
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= batch_size
           SCREAMING_SNAKE_CASE__			:				Any       						= seq_length
           SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= is_training
           SCREAMING_SNAKE_CASE__			:				int       						= use_input_mask
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= use_token_type_ids
           SCREAMING_SNAKE_CASE__			:				int       						= use_labels
           SCREAMING_SNAKE_CASE__			:				int       						= vocab_size
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= block_sizes
           SCREAMING_SNAKE_CASE__			:				Dict       						= num_decoder_layers
           SCREAMING_SNAKE_CASE__			:				Tuple       						= d_model
           SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= n_head
           SCREAMING_SNAKE_CASE__			:				List[str]       						= d_head
           SCREAMING_SNAKE_CASE__			:				str       						= d_inner
           SCREAMING_SNAKE_CASE__			:				Dict       						= hidden_act
           SCREAMING_SNAKE_CASE__			:				int       						= hidden_dropout
           SCREAMING_SNAKE_CASE__			:				List[Any]       						= attention_dropout
           SCREAMING_SNAKE_CASE__			:				Tuple       						= activation_dropout
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= max_position_embeddings
           SCREAMING_SNAKE_CASE__			:				int       						= type_vocab_size
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= 2
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= num_labels
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= num_choices
           SCREAMING_SNAKE_CASE__			:				Dict       						= scope
           SCREAMING_SNAKE_CASE__			:				Tuple       						= initializer_std
  
           # Used in the tests to check the size of the first attention layer
           SCREAMING_SNAKE_CASE__			:				Dict       						= n_head
           # Used in the tests to check the size of the first hidden state
           SCREAMING_SNAKE_CASE__			:				List[str]       						= self.d_model
           # Used in the tests to check the number of output hidden states/attentions
           SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= sum(self.block_sizes					) + (0 if base else self.num_decoder_layers)
           # FunnelModel adds two hidden layers: input embeddings and the sum of the upsampled encoder hidden state with
           # the last hidden state of the first block (which is the first hidden state of the decoder).
           if not base:
              SCREAMING_SNAKE_CASE__			:				List[Any]       						= self.num_hidden_layers + 2
  
  
  
  
  
  
        def    A__(self					)       ->   str:
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= ids_tensor([self.batch_size, self.seq_length] ,  self.vocab_size					)
  
           SCREAMING_SNAKE_CASE__			:				Tuple       						= None
           if self.use_input_mask:
              SCREAMING_SNAKE_CASE__			:				int       						= ids_tensor([self.batch_size, self.seq_length] ,  vocab_size=2					)
  
           SCREAMING_SNAKE_CASE__			:				List[str]       						= None
           if self.use_token_type_ids:
              SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= ids_tensor([self.batch_size, self.seq_length] ,  self.type_vocab_size					)
  
           SCREAMING_SNAKE_CASE__			:				Any       						= None
           SCREAMING_SNAKE_CASE__			:				Dict       						= None
           SCREAMING_SNAKE_CASE__			:				int       						= None
           if self.use_labels:
              SCREAMING_SNAKE_CASE__			:				List[Any]       						= ids_tensor([self.batch_size] ,  self.type_sequence_label_size					)
              SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= ids_tensor([self.batch_size, self.seq_length] ,  self.num_labels					)
              SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= ids_tensor([self.batch_size] ,  self.num_choices					)
              SCREAMING_SNAKE_CASE__			:				Tuple       						= ids_tensor([self.batch_size, self.seq_length] ,  1					)
  
           SCREAMING_SNAKE_CASE__			:				List[str]       						= self.get_config()
  
           return (
               config,
               input_ids,
               token_type_ids,
               input_mask,
               sequence_labels,
               token_labels,
               choice_labels,
               fake_token_labels,
           )
  
  
  
  
  
  
        def    A__(self					)       ->   Tuple:
           return FunnelConfig(
               vocab_size=self.vocab_size ,  block_sizes=self.block_sizes ,  num_decoder_layers=self.num_decoder_layers ,  d_model=self.d_model ,  n_head=self.n_head ,  d_head=self.d_head ,  d_inner=self.d_inner ,  hidden_act=self.hidden_act ,  hidden_dropout=self.hidden_dropout ,  attention_dropout=self.attention_dropout ,  activation_dropout=self.activation_dropout ,  max_position_embeddings=self.max_position_embeddings ,  type_vocab_size=self.type_vocab_size ,  initializer_std=self.initializer_std ,  )
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  )       ->   str:
           SCREAMING_SNAKE_CASE__			:				Tuple       						= FunnelModel(config=a_					)
           model.to(a_					)
           model.eval()
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= model(a_ ,  attention_mask=a_ ,  token_type_ids=a_					)
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= model(a_ ,  token_type_ids=a_					)
           SCREAMING_SNAKE_CASE__			:				List[Any]       						= model(a_					)
           self.parent.assertEqual(result.last_hidden_state.shape ,  (self.batch_size, self.seq_length, self.d_model)					)
  
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= False
           SCREAMING_SNAKE_CASE__			:				Any       						= model(a_					)
           self.parent.assertEqual(result.last_hidden_state.shape ,  (self.batch_size, self.seq_length, self.d_model)					)
  
           SCREAMING_SNAKE_CASE__			:				Tuple       						= False
           SCREAMING_SNAKE_CASE__			:				Any       						= model(a_					)
           self.parent.assertEqual(result.last_hidden_state.shape ,  (self.batch_size, self.seq_length, self.d_model)					)
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  )       ->   Tuple:
           SCREAMING_SNAKE_CASE__			:				List[str]       						= FunnelBaseModel(config=a_					)
           model.to(a_					)
           model.eval()
           SCREAMING_SNAKE_CASE__			:				int       						= model(a_ ,  attention_mask=a_ ,  token_type_ids=a_					)
           SCREAMING_SNAKE_CASE__			:				Any       						= model(a_ ,  token_type_ids=a_					)
           SCREAMING_SNAKE_CASE__			:				List[str]       						= model(a_					)
           self.parent.assertEqual(result.last_hidden_state.shape ,  (self.batch_size, 2, self.d_model)					)
  
           SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= False
           SCREAMING_SNAKE_CASE__			:				Dict       						= model(a_					)
           self.parent.assertEqual(result.last_hidden_state.shape ,  (self.batch_size, 3, self.d_model)					)
  
           SCREAMING_SNAKE_CASE__			:				Tuple       						= False
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= model(a_					)
           self.parent.assertEqual(result.last_hidden_state.shape ,  (self.batch_size, 2, self.d_model)					)
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  )       ->   Tuple:
           SCREAMING_SNAKE_CASE__			:				int       						= self.num_labels
           SCREAMING_SNAKE_CASE__			:				Tuple       						= FunnelForPreTraining(config=a_					)
           model.to(a_					)
           model.eval()
           SCREAMING_SNAKE_CASE__			:				Dict       						= model(a_ ,  attention_mask=a_ ,  token_type_ids=a_ ,  labels=a_					)
           self.parent.assertEqual(result.logits.shape ,  (self.batch_size, self.seq_length)					)
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  )       ->   str:
           SCREAMING_SNAKE_CASE__			:				List[str]       						= FunnelForMaskedLM(config=a_					)
           model.to(a_					)
           model.eval()
           SCREAMING_SNAKE_CASE__			:				Dict       						= model(a_ ,  attention_mask=a_ ,  token_type_ids=a_ ,  labels=a_					)
           self.parent.assertEqual(result.logits.shape ,  (self.batch_size, self.seq_length, self.vocab_size)					)
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  )       ->   Union[str, Any]:
           SCREAMING_SNAKE_CASE__			:				int       						= self.num_labels
           SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= FunnelForSequenceClassification(a_					)
           model.to(a_					)
           model.eval()
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= model(a_ ,  attention_mask=a_ ,  token_type_ids=a_ ,  labels=a_					)
           self.parent.assertEqual(result.logits.shape ,  (self.batch_size, self.num_labels)					)
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  )       ->   Optional[Any]:
           SCREAMING_SNAKE_CASE__			:				List[str]       						= self.num_choices
           SCREAMING_SNAKE_CASE__			:				Tuple       						= FunnelForMultipleChoice(config=a_					)
           model.to(a_					)
           model.eval()
           SCREAMING_SNAKE_CASE__			:				Any       						= input_ids.unsqueeze(1					).expand(-1 ,  self.num_choices ,  -1					).contiguous()
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= token_type_ids.unsqueeze(1					).expand(-1 ,  self.num_choices ,  -1					).contiguous()
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= input_mask.unsqueeze(1					).expand(-1 ,  self.num_choices ,  -1					).contiguous()
           SCREAMING_SNAKE_CASE__			:				Dict       						= model(
               a_ ,  attention_mask=a_ ,  token_type_ids=a_ ,  labels=a_ ,  )
           self.parent.assertEqual(result.logits.shape ,  (self.batch_size, self.num_choices)					)
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  )       ->   Optional[Any]:
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= self.num_labels
           SCREAMING_SNAKE_CASE__			:				List[str]       						= FunnelForTokenClassification(config=a_					)
           model.to(a_					)
           model.eval()
           SCREAMING_SNAKE_CASE__			:				Any       						= model(a_ ,  attention_mask=a_ ,  token_type_ids=a_ ,  labels=a_					)
           self.parent.assertEqual(result.logits.shape ,  (self.batch_size, self.seq_length, self.num_labels)					)
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  a__ ,  )       ->   Any:
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= FunnelForQuestionAnswering(config=a_					)
           model.to(a_					)
           model.eval()
           SCREAMING_SNAKE_CASE__			:				List[str]       						= model(
               a_ ,  attention_mask=a_ ,  token_type_ids=a_ ,  start_positions=a_ ,  end_positions=a_ ,  )
           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    A__(self					)       ->   Dict:
           SCREAMING_SNAKE_CASE__			:				str       						= self.prepare_config_and_inputs()
           (
               (
               SCREAMING_SNAKE_CASE__		
           )						,				(
               SCREAMING_SNAKE_CASE__		
           )						,				(
               SCREAMING_SNAKE_CASE__		
           )						,				(
               SCREAMING_SNAKE_CASE__		
           )						,				(
               SCREAMING_SNAKE_CASE__		
           )						,				(
               SCREAMING_SNAKE_CASE__		
           )						,				(
               SCREAMING_SNAKE_CASE__		
           )						,				(
               SCREAMING_SNAKE_CASE__		
           )						,						
           )			:				Optional[Any]       						= config_and_inputs
           SCREAMING_SNAKE_CASE__			:				Dict       						= {'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': input_mask}
           return config, inputs_dict
  
  
  
  
  
  
  @require_torch
  class 						lowercase     (   SCREAMING_SNAKE_CASE__				,			SCREAMING_SNAKE_CASE__				,			unittest.TestCase):
        __lowercase 		=  False
        __lowercase 		=  False
        __lowercase 		=  (
            (
                FunnelModel,
                FunnelForMaskedLM,
                FunnelForPreTraining,
                FunnelForQuestionAnswering,
                FunnelForTokenClassification,
            )
            if is_torch_available()
            else ()
        )
        __lowercase 		=  (
            {
                'feature-extraction': (FunnelBaseModel, FunnelModel),
                'fill-mask': FunnelForMaskedLM,
                'question-answering': FunnelForQuestionAnswering,
                'text-classification': FunnelForSequenceClassification,
                'token-classification': FunnelForTokenClassification,
                'zero-shot': FunnelForSequenceClassification,
            }
            if is_torch_available()
            else {}
        )
  
  
  
  
  
  
        def    A__(self ,  a__ ,  a__ ,  a__=False					)       ->   str:
           SCREAMING_SNAKE_CASE__			:				Any       						= super()._prepare_for_class(a_ ,  a_ ,  return_labels=a_					)
  
           if return_labels:
              if model_class in get_values(a_					):
                 SCREAMING_SNAKE_CASE__			:				Optional[int]       						= torch.zeros(
                     (self.model_tester.batch_size, self.model_tester.seq_length) ,  dtype=torch.long ,  device=a_					)
           return inputs_dict
  
  
  
  
  
  
        def    A__(self					)       ->   Tuple:
           SCREAMING_SNAKE_CASE__			:				List[str]       						= FunnelModelTester(self					)
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= ConfigTester(self ,  config_class=a_					)
  
  
  
  
  
  
        def    A__(self					)       ->   int:
           self.config_tester.run_common_tests()
  
  
  
  
  
  
        def    A__(self					)       ->   List[Any]:
           SCREAMING_SNAKE_CASE__			:				Tuple       						= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_model(*a_					)
  
  
  
  
  
  
        def    A__(self					)       ->   str:
           SCREAMING_SNAKE_CASE__			:				List[str]       						= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_pretraining(*a_					)
  
  
  
  
  
  
        def    A__(self					)       ->   Optional[Any]:
           SCREAMING_SNAKE_CASE__			:				str       						= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_masked_lm(*a_					)
  
  
  
  
  
  
        def    A__(self					)       ->   List[str]:
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_token_classification(*a_					)
  
  
  
  
  
  
        def    A__(self					)       ->   Tuple:
           SCREAMING_SNAKE_CASE__			:				Any       						= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_question_answering(*a_					)
  
  
  
  
  
  
        def    A__(self ,  a__					)       ->   Optional[Any]:
  
  
  
           if hasattr(a_ ,  '''weight'''					) and module.weight is not None:
              module.weight.data.fill_(3					)
           if hasattr(a_ ,  '''bias'''					) and module.bias is not None:
              module.bias.data.fill_(3					)
  
           for param in ["r_w_bias", "r_r_bias", "r_kernel", "r_s_bias", "seg_embed"]:
              if hasattr(a_ ,  a_					) and getattr(a_ ,  a_					) is not None:
                 SCREAMING_SNAKE_CASE__			:				Dict       						= getattr(a_ ,  a_					)
                 weight.data.fill_(3					)
  
  
  
  
  
  
  @require_torch
  class 						lowercase     (   SCREAMING_SNAKE_CASE__				,			unittest.TestCase):
        __lowercase 		=  False
        __lowercase 		=  False
        __lowercase 		=  (
            (FunnelBaseModel, FunnelForMultipleChoice, FunnelForSequenceClassification) if is_torch_available() else ()
        )
  
  
  
  
  
  
        def    A__(self					)       ->   int:
           SCREAMING_SNAKE_CASE__			:				int       						= FunnelModelTester(self ,  base=a_					)
           SCREAMING_SNAKE_CASE__			:				List[str]       						= ConfigTester(self ,  config_class=a_					)
  
  
  
  
  
  
        def    A__(self					)       ->   int:
           self.config_tester.run_common_tests()
  
  
  
  
  
  
        def    A__(self					)       ->   Optional[int]:
           SCREAMING_SNAKE_CASE__			:				List[Any]       						= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_base_model(*a_					)
  
  
  
  
  
  
        def    A__(self					)       ->   str:
           SCREAMING_SNAKE_CASE__			:				int       						= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_sequence_classification(*a_					)
  
  
  
  
  
  
        def    A__(self					)       ->   Optional[Any]:
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_multiple_choice(*a_					)
  
  
  
  
  
  
        def    A__(self					)       ->   Dict:
           SCREAMING_SNAKE_CASE__						,				SCREAMING_SNAKE_CASE__			:				Dict       						= self.model_tester.prepare_config_and_inputs_for_common()
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= True
  
           for model_class in self.all_model_classes:
              if model_class.__name__ == "FunnelBaseModel":
                 continue
              SCREAMING_SNAKE_CASE__			:				Optional[Any]       						= model_class(a_					)
              model.to(a_					)
              model.train()
              SCREAMING_SNAKE_CASE__			:				List[str]       						= self._prepare_for_class(a_ ,  a_ ,  return_labels=a_					)
              SCREAMING_SNAKE_CASE__			:				Dict       						= model(**a_					).loss
              loss.backward()
  
  
  
  
  
  
        def    A__(self ,  a__					)       ->   Optional[int]:
  
  
  
           if hasattr(a_ ,  '''weight'''					) and module.weight is not None:
              module.weight.data.fill_(3					)
           if hasattr(a_ ,  '''bias'''					) and module.bias is not None:
              module.bias.data.fill_(3					)
  
           for param in ["r_w_bias", "r_r_bias", "r_kernel", "r_s_bias", "seg_embed"]:
              if hasattr(a_ ,  a_					) and getattr(a_ ,  a_					) is not None:
                 SCREAMING_SNAKE_CASE__			:				Optional[int]       						= getattr(a_ ,  a_					)
                 weight.data.fill_(3					)
  
  
  
  
  
  
  @require_torch
  @require_sentencepiece
  @require_tokenizers
  class 						lowercase     (   unittest.TestCase):
  
  
  
  
  
  
        def    A__(self					)       ->   Union[str, Any]:
           SCREAMING_SNAKE_CASE__			:				Tuple       						= 1_3
           SCREAMING_SNAKE_CASE__			:				Dict       						= 7
           SCREAMING_SNAKE_CASE__			:				int       						= torch.arange(0 ,  batch_size * sequence_length					).long().reshape(a_ ,  a_					)
           SCREAMING_SNAKE_CASE__			:				List[str]       						= [0, 1, 2, 3, 4, 5, 6, 4, 1, 3, 5, 0, 1]
           SCREAMING_SNAKE_CASE__			:				List[Any]       						= torch.tensor([[2] + [0] * a + [1] * (sequence_length - a - 1) for a in lengths]					)
  
           SCREAMING_SNAKE_CASE__			:				List[str]       						= FunnelModel.from_pretrained('''sgugger/funnel-random-tiny'''					)
           SCREAMING_SNAKE_CASE__			:				int       						= model(a_ ,  token_type_ids=a_					)[0].abs()
  
           SCREAMING_SNAKE_CASE__			:				Dict       						= torch.tensor(2_3_4_4.8_3_5_2					)
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= torch.tensor(0.80_52					)
           self.assertTrue(torch.allclose(output.sum() ,  a_ ,  atol=1E-4					)					)
           self.assertTrue(torch.allclose(output.mean() ,  a_ ,  atol=1E-4					)					)
  
           SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= torch.tensor([[1] * 7, [1] * 4 + [0] * 3] * 6 + [[0, 1, 1, 0, 0, 1, 1]]					)
           SCREAMING_SNAKE_CASE__			:				List[str]       						= model(a_ ,  attention_mask=a_ ,  token_type_ids=a_					)[0].abs()
  
           SCREAMING_SNAKE_CASE__			:				int       						= torch.tensor(2_3_4_3.8_4_2_5					)
           SCREAMING_SNAKE_CASE__			:				int       						= torch.tensor(0.80_49					)
           self.assertTrue(torch.allclose(output.sum() ,  a_ ,  atol=1E-4					)					)
           self.assertTrue(torch.allclose(output.mean() ,  a_ ,  atol=1E-4					)					)
  
  
  
  
  
  
        @slow
        def    A__(self					)       ->   Optional[int]:
           SCREAMING_SNAKE_CASE__			:				Any       						= FunnelTokenizer.from_pretrained('''huggingface/funnel-small'''					)
           SCREAMING_SNAKE_CASE__			:				Optional[int]       						= FunnelModel.from_pretrained('''huggingface/funnel-small'''					)
           SCREAMING_SNAKE_CASE__			:				int       						= tokenizer('''Hello! I am the Funnel Transformer model.''' ,  return_tensors='''pt'''					)
           SCREAMING_SNAKE_CASE__			:				Dict       						= model(**a_					)[0]
  
           SCREAMING_SNAKE_CASE__			:				List[str]       						= torch.tensor(2_35.72_46					)
           SCREAMING_SNAKE_CASE__			:				List[str]       						= torch.tensor(0.02_56					)
           self.assertTrue(torch.allclose(output.sum() ,  a_ ,  atol=1E-4					)					)
           self.assertTrue(torch.allclose(output.mean() ,  a_ ,  atol=1E-4					)					)
  
  
style_context: 
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  lowercase__			=	{
      '''+''': lambda x, y: x + y,
      '''-''': lambda x, y: x - y,
      '''*''': lambda x, y: x * y,
      '''/''': lambda x, y: x / y,
  }
  
  
  def 				UpperCamelCase	(  snake_case   ):
  
  
  
  
     '''simple docstring'''
  
     return c.isdigit()
  
  
  def 				UpperCamelCase	(  snake_case   ):
  
  
  
  
     '''simple docstring'''
  
     SCREAMING_SNAKE_CASE__			:				Union[str, Any]       						= []
  
     # iterate over the string in reverse order
     for c in expression.split()[::-1]:
        # push operand to stack
        if is_operand(snake_case   ):
           stack.append(int(snake_case   )   )
  
        else:
           # pop values from stack can calculate the result
           # push the result onto the stack again
           SCREAMING_SNAKE_CASE__			:				Dict       						= stack.pop()
           SCREAMING_SNAKE_CASE__			:				Any       						= stack.pop()
           stack.append(calc[c](snake_case	,     snake_case   )   )
  
     return stack.pop()
  
  
  # Driver code
  if __name__ == "__main__":
         lowercase__			=	'''+ 9 * 2 6'''
         print(evaluate(test_expression))
  
         lowercase__			=	'''/ * 10 2 + 4 1 '''
         print(evaluate(test_expression))
  
  