






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 				_UpperCAmelCase :

				"""simple docstring"""




				def __init__(					self						:   Optional[int],  lowerCamelCase						:   int,  lowerCamelCase						:   Optional[int]=13,  lowerCamelCase						:   List[Any]=7,  lowerCamelCase						:   Optional[Any]=True,  lowerCamelCase						:   List[Any]=True,  lowerCamelCase						:   List[Any]=True,  lowerCamelCase						:   Any=True,  lowerCamelCase						:   Optional[Any]=99,  lowerCamelCase						:   str=[1, 1, 2],  lowerCamelCase						:   str=1,  lowerCamelCase						:   Tuple=32,  lowerCamelCase						:   str=4,  lowerCamelCase						:   str=8,  lowerCamelCase						:   List[Any]=37,  lowerCamelCase						:   Tuple="gelu_new",  lowerCamelCase						:   Tuple=0.1,  lowerCamelCase						:   Optional[int]=0.1,  lowerCamelCase						:   Any=0.0,  lowerCamelCase						:   Any=512,  lowerCamelCase						:   str=3,  lowerCamelCase						:   Dict=0.02,  lowerCamelCase						:   Tuple=3,  lowerCamelCase						:   str=4,  lowerCamelCase						:   int=None,  lowerCamelCase						:   Optional[int]=False,  ):

								'''simple docstring'''
								lowercase__       			=      parent
								lowercase__       			=      batch_size
								lowercase__       			=      seq_length
								lowercase__       			=      is_training
								lowercase__       			=      use_input_mask
								lowercase__       			=      use_token_type_ids
								lowercase__       			=      use_labels
								lowercase__       			=      vocab_size
								lowercase__       			=      block_sizes
								lowercase__       			=      num_decoder_layers
								lowercase__       			=      d_model
								lowercase__       			=      n_head
								lowercase__       			=      d_head
								lowercase__       			=      d_inner
								lowercase__       			=      hidden_act
								lowercase__       			=      hidden_dropout
								lowercase__       			=      attention_dropout
								lowercase__       			=      activation_dropout
								lowercase__       			=      max_position_embeddings
								lowercase__       			=      type_vocab_size
								lowercase__       			=      2
								lowercase__       			=      num_labels
								lowercase__       			=      num_choices
								lowercase__       			=      scope
								lowercase__       			=      initializer_std

								# Used in the tests to check the size of the first attention layer
								lowercase__       			=      n_head
								# Used in the tests to check the size of the first hidden state
								lowercase__       			=      self.d_model
								# Used in the tests to check the number of output hidden states/attentions
								lowercase__       			=      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:
												lowercase__       			=      self.num_hidden_layers + 2




				def     lowercase__       (					self						:   Optional[Any]  ):

								'''simple docstring'''
								lowercase__       			=      ids_tensor([self.batch_size, self.seq_length],  self.vocab_size  )

								lowercase__       			=      None
								if self.use_input_mask:
												lowercase__       			=      ids_tensor([self.batch_size, self.seq_length],  vocab_size=2  )

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

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

								lowercase__       			=      self.get_config()

								return (
								    config,
								    input_ids,
								    token_type_ids,
								    input_mask,
								    sequence_labels,
								    token_labels,
								    choice_labels,
								    fake_token_labels,
								)




				def     lowercase__       (					self						:   str  ):

								'''simple docstring'''
								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     lowercase__       (					self						:   Any,  lowerCamelCase						:   str,  lowerCamelCase						:   Dict,  lowerCamelCase						:   List[str],  lowerCamelCase						:   List[Any],  lowerCamelCase						:   Dict,  lowerCamelCase						:   List[Any],  lowerCamelCase						:   Any,  lowerCamelCase						:   Any,  ):

								'''simple docstring'''
								lowercase__       			=      FunnelModel(config=lowerCamelCase  )
								model.to(lowerCamelCase  )
								model.eval()
								lowercase__       			=      model(lowerCamelCase,  attention_mask=lowerCamelCase,  token_type_ids=lowerCamelCase  )
								lowercase__       			=      model(lowerCamelCase,  token_type_ids=lowerCamelCase  )
								lowercase__       			=      model(lowerCamelCase  )
								self.parent.assertEqual(result.last_hidden_state.shape,  (self.batch_size, self.seq_length, self.d_model)  )

								lowercase__       			=      False
								lowercase__       			=      model(lowerCamelCase  )
								self.parent.assertEqual(result.last_hidden_state.shape,  (self.batch_size, self.seq_length, self.d_model)  )

								lowercase__       			=      False
								lowercase__       			=      model(lowerCamelCase  )
								self.parent.assertEqual(result.last_hidden_state.shape,  (self.batch_size, self.seq_length, self.d_model)  )




				def     lowercase__       (					self						:   int,  lowerCamelCase						:   Optional[int],  lowerCamelCase						:   List[Any],  lowerCamelCase						:   List[Any],  lowerCamelCase						:   Any,  lowerCamelCase						:   Optional[int],  lowerCamelCase						:   int,  lowerCamelCase						:   str,  lowerCamelCase						:   Optional[Any],  ):

								'''simple docstring'''
								lowercase__       			=      FunnelBaseModel(config=lowerCamelCase  )
								model.to(lowerCamelCase  )
								model.eval()
								lowercase__       			=      model(lowerCamelCase,  attention_mask=lowerCamelCase,  token_type_ids=lowerCamelCase  )
								lowercase__       			=      model(lowerCamelCase,  token_type_ids=lowerCamelCase  )
								lowercase__       			=      model(lowerCamelCase  )
								self.parent.assertEqual(result.last_hidden_state.shape,  (self.batch_size, 2, self.d_model)  )

								lowercase__       			=      False
								lowercase__       			=      model(lowerCamelCase  )
								self.parent.assertEqual(result.last_hidden_state.shape,  (self.batch_size, 3, self.d_model)  )

								lowercase__       			=      False
								lowercase__       			=      model(lowerCamelCase  )
								self.parent.assertEqual(result.last_hidden_state.shape,  (self.batch_size, 2, self.d_model)  )




				def     lowercase__       (					self						:   Optional[Any],  lowerCamelCase						:   int,  lowerCamelCase						:   Optional[Any],  lowerCamelCase						:   Union[str, Any],  lowerCamelCase						:   Any,  lowerCamelCase						:   Union[str, Any],  lowerCamelCase						:   List[Any],  lowerCamelCase						:   str,  lowerCamelCase						:   Dict,  ):

								'''simple docstring'''
								lowercase__       			=      self.num_labels
								lowercase__       			=      FunnelForPreTraining(config=lowerCamelCase  )
								model.to(lowerCamelCase  )
								model.eval()
								lowercase__       			=      model(lowerCamelCase,  attention_mask=lowerCamelCase,  token_type_ids=lowerCamelCase,  labels=lowerCamelCase  )
								self.parent.assertEqual(result.logits.shape,  (self.batch_size, self.seq_length)  )




				def     lowercase__       (					self						:   Dict,  lowerCamelCase						:   Tuple,  lowerCamelCase						:   List[str],  lowerCamelCase						:   str,  lowerCamelCase						:   Dict,  lowerCamelCase						:   str,  lowerCamelCase						:   List[Any],  lowerCamelCase						:   Union[str, Any],  lowerCamelCase						:   int,  ):

								'''simple docstring'''
								lowercase__       			=      FunnelForMaskedLM(config=lowerCamelCase  )
								model.to(lowerCamelCase  )
								model.eval()
								lowercase__       			=      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     lowercase__       (					self						:   Dict,  lowerCamelCase						:   Union[str, Any],  lowerCamelCase						:   str,  lowerCamelCase						:   Optional[int],  lowerCamelCase						:   List[Any],  lowerCamelCase						:   Any,  lowerCamelCase						:   Dict,  lowerCamelCase						:   Tuple,  lowerCamelCase						:   str,  ):

								'''simple docstring'''
								lowercase__       			=      self.num_labels
								lowercase__       			=      FunnelForSequenceClassification(lowerCamelCase  )
								model.to(lowerCamelCase  )
								model.eval()
								lowercase__       			=      model(lowerCamelCase,  attention_mask=lowerCamelCase,  token_type_ids=lowerCamelCase,  labels=lowerCamelCase  )
								self.parent.assertEqual(result.logits.shape,  (self.batch_size, self.num_labels)  )




				def     lowercase__       (					self						:   List[Any],  lowerCamelCase						:   str,  lowerCamelCase						:   int,  lowerCamelCase						:   Optional[int],  lowerCamelCase						:   Any,  lowerCamelCase						:   Optional[Any],  lowerCamelCase						:   Any,  lowerCamelCase						:   List[str],  lowerCamelCase						:   Optional[Any],  ):

								'''simple docstring'''
								lowercase__       			=      self.num_choices
								lowercase__       			=      FunnelForMultipleChoice(config=lowerCamelCase  )
								model.to(lowerCamelCase  )
								model.eval()
								lowercase__       			=      input_ids.unsqueeze(1  ).expand(-1,  self.num_choices,  -1  ).contiguous()
								lowercase__       			=      token_type_ids.unsqueeze(1  ).expand(-1,  self.num_choices,  -1  ).contiguous()
								lowercase__       			=      input_mask.unsqueeze(1  ).expand(-1,  self.num_choices,  -1  ).contiguous()
								lowercase__       			=      model(
								    lowerCamelCase,  attention_mask=lowerCamelCase,  token_type_ids=lowerCamelCase,  labels=lowerCamelCase,  )
								self.parent.assertEqual(result.logits.shape,  (self.batch_size, self.num_choices)  )




				def     lowercase__       (					self						:   Optional[int],  lowerCamelCase						:   str,  lowerCamelCase						:   int,  lowerCamelCase						:   int,  lowerCamelCase						:   Tuple,  lowerCamelCase						:   Dict,  lowerCamelCase						:   Tuple,  lowerCamelCase						:   List[Any],  lowerCamelCase						:   List[Any],  ):

								'''simple docstring'''
								lowercase__       			=      self.num_labels
								lowercase__       			=      FunnelForTokenClassification(config=lowerCamelCase  )
								model.to(lowerCamelCase  )
								model.eval()
								lowercase__       			=      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     lowercase__       (					self						:   Dict,  lowerCamelCase						:   int,  lowerCamelCase						:   Tuple,  lowerCamelCase						:   str,  lowerCamelCase						:   Any,  lowerCamelCase						:   Optional[int],  lowerCamelCase						:   Dict,  lowerCamelCase						:   Union[str, Any],  lowerCamelCase						:   Tuple,  ):

								'''simple docstring'''
								lowercase__       			=      FunnelForQuestionAnswering(config=lowerCamelCase  )
								model.to(lowerCamelCase  )
								model.eval()
								lowercase__       			=      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     lowercase__       (					self						:   Dict  ):

								'''simple docstring'''
								lowercase__       			=      self.prepare_config_and_inputs()
								(
								    (
								    lowercase__						
								)			,						(
								    lowercase__						
								)			,						(
								    lowercase__						
								)			,						(
								    lowercase__						
								)			,						(
								    lowercase__						
								)			,						(
								    lowercase__						
								)			,						(
								    lowercase__						
								)			,						(
								    lowercase__						
								)			,												
								)       			=      config_and_inputs
								lowercase__       			=      {'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': input_mask}
								return config, inputs_dict



@require_torch
class 				_UpperCAmelCase (	A__		,A__		,unittest.TestCase     ):

				"""simple docstring"""




				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     lowercase__       (					self						:   Optional[int],  lowerCamelCase						:   Dict,  lowerCamelCase						:   Optional[Any],  lowerCamelCase						:   int=False  ):

								'''simple docstring'''
								lowercase__       			=      super()._prepare_for_class(lowerCamelCase,  lowerCamelCase,  return_labels=lowerCamelCase  )

								if return_labels:
												if model_class in get_values(lowerCamelCase  ):
																lowercase__       			=      torch.zeros(
																    (self.model_tester.batch_size, self.model_tester.seq_length),  dtype=torch.long,  device=lowerCamelCase  )
								return inputs_dict




				def     lowercase__       (					self						:   List[str]  ):

								'''simple docstring'''
								lowercase__       			=      FunnelModelTester(self  )
								lowercase__       			=      ConfigTester(self,  config_class=lowerCamelCase  )




				def     lowercase__       (					self						:   Union[str, Any]  ):

								'''simple docstring'''
								self.config_tester.run_common_tests()




				def     lowercase__       (					self						:   Union[str, Any]  ):

								'''simple docstring'''
								lowercase__       			=      self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*lowerCamelCase  )




				def     lowercase__       (					self						:   Optional[Any]  ):

								'''simple docstring'''
								lowercase__       			=      self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_pretraining(*lowerCamelCase  )




				def     lowercase__       (					self						:   Union[str, Any]  ):

								'''simple docstring'''
								lowercase__       			=      self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_masked_lm(*lowerCamelCase  )




				def     lowercase__       (					self						:   Optional[int]  ):

								'''simple docstring'''
								lowercase__       			=      self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_token_classification(*lowerCamelCase  )




				def     lowercase__       (					self						:   List[str]  ):

								'''simple docstring'''
								lowercase__       			=      self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_question_answering(*lowerCamelCase  )




				def     lowercase__       (					self						:   str,  lowerCamelCase						:   List[Any]  ):

								'''simple docstring'''
								if hasattr(lowerCamelCase,  '''weight'''  ) and module.weight is not None:
												module.weight.data.fill_(3  )
								if hasattr(lowerCamelCase,  '''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(lowerCamelCase,  lowerCamelCase  ) and getattr(lowerCamelCase,  lowerCamelCase  ) is not None:
																lowercase__       			=      getattr(lowerCamelCase,  lowerCamelCase  )
																weight.data.fill_(3  )



@require_torch
class 				_UpperCAmelCase (	A__		,unittest.TestCase     ):

				"""simple docstring"""




				lowercase__    							=	False
				lowercase__    							=	False
				lowercase__    							=	(
				    (FunnelBaseModel, FunnelForMultipleChoice, FunnelForSequenceClassification) if is_torch_available() else ()
				)




				def     lowercase__       (					self						:   Any  ):

								'''simple docstring'''
								lowercase__       			=      FunnelModelTester(self,  base=lowerCamelCase  )
								lowercase__       			=      ConfigTester(self,  config_class=lowerCamelCase  )




				def     lowercase__       (					self						:   Optional[int]  ):

								'''simple docstring'''
								self.config_tester.run_common_tests()




				def     lowercase__       (					self						:   int  ):

								'''simple docstring'''
								lowercase__       			=      self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_base_model(*lowerCamelCase  )




				def     lowercase__       (					self						:   List[Any]  ):

								'''simple docstring'''
								lowercase__       			=      self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_sequence_classification(*lowerCamelCase  )




				def     lowercase__       (					self						:   Optional[Any]  ):

								'''simple docstring'''
								lowercase__       			=      self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_multiple_choice(*lowerCamelCase  )




				def     lowercase__       (					self						:   Optional[Any]  ):

								'''simple docstring'''
								lowercase__			,						lowercase__       			=      self.model_tester.prepare_config_and_inputs_for_common()
								lowercase__       			=      True

								for model_class in self.all_model_classes:
												if model_class.__name__ == "FunnelBaseModel":
																continue
												lowercase__       			=      model_class(lowerCamelCase  )
												model.to(lowerCamelCase  )
												model.train()
												lowercase__       			=      self._prepare_for_class(lowerCamelCase,  lowerCamelCase,  return_labels=lowerCamelCase  )
												lowercase__       			=      model(**lowerCamelCase  ).loss
												loss.backward()




				def     lowercase__       (					self						:   Tuple,  lowerCamelCase						:   int  ):

								'''simple docstring'''
								if hasattr(lowerCamelCase,  '''weight'''  ) and module.weight is not None:
												module.weight.data.fill_(3  )
								if hasattr(lowerCamelCase,  '''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(lowerCamelCase,  lowerCamelCase  ) and getattr(lowerCamelCase,  lowerCamelCase  ) is not None:
																lowercase__       			=      getattr(lowerCamelCase,  lowerCamelCase  )
																weight.data.fill_(3  )



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

				"""simple docstring"""




				def     lowercase__       (					self						:   Dict  ):

								'''simple docstring'''
								lowercase__       			=      13
								lowercase__       			=      7
								lowercase__       			=      torch.arange(0,  batch_size * sequence_length  ).long().reshape(lowerCamelCase,  lowerCamelCase  )
								lowercase__       			=      [0, 1, 2, 3, 4, 5, 6, 4, 1, 3, 5, 0, 1]
								lowercase__       			=      torch.tensor([[2] + [0] * a + [1] * (sequence_length - a - 1) for a in lengths]  )

								lowercase__       			=      FunnelModel.from_pretrained('''sgugger/funnel-random-tiny'''  )
								lowercase__       			=      model(lowerCamelCase,  token_type_ids=lowerCamelCase  )[0].abs()

								lowercase__       			=      torch.tensor(2344.8352  )
								lowercase__       			=      torch.tensor(0.8052  )
								self.assertTrue(torch.allclose(output.sum(),  lowerCamelCase,  atol=1E-4  )  )
								self.assertTrue(torch.allclose(output.mean(),  lowerCamelCase,  atol=1E-4  )  )

								lowercase__       			=      torch.tensor([[1] * 7, [1] * 4 + [0] * 3] * 6 + [[0, 1, 1, 0, 0, 1, 1]]  )
								lowercase__       			=      model(lowerCamelCase,  attention_mask=lowerCamelCase,  token_type_ids=lowerCamelCase  )[0].abs()

								lowercase__       			=      torch.tensor(2343.8425  )
								lowercase__       			=      torch.tensor(0.8049  )
								self.assertTrue(torch.allclose(output.sum(),  lowerCamelCase,  atol=1E-4  )  )
								self.assertTrue(torch.allclose(output.mean(),  lowerCamelCase,  atol=1E-4  )  )




				@slow
				def     lowercase__       (					self						:   Union[str, Any]  ):

								'''simple docstring'''
								lowercase__       			=      FunnelTokenizer.from_pretrained('''huggingface/funnel-small'''  )
								lowercase__       			=      FunnelModel.from_pretrained('''huggingface/funnel-small'''  )
								lowercase__       			=      tokenizer('''Hello! I am the Funnel Transformer model.''',  return_tensors='''pt'''  )
								lowercase__       			=      model(**lowerCamelCase  )[0]

								lowercase__       			=      torch.tensor(235.7246  )
								lowercase__       			=      torch.tensor(0.0256  )
								self.assertTrue(torch.allclose(output.sum(),  lowerCamelCase,  atol=1E-4  )  )
								self.assertTrue(torch.allclose(output.mean(),  lowerCamelCase,  atol=1E-4  )  )










import unittest

from datasets import load_dataset

from transformers import load_tool

from .test_tools_common import ToolTesterMixin
class 				_UpperCAmelCase (	unittest.TestCase		,A__     ):

				"""simple docstring"""




				def     lowercase__       (					self						:   str  ):

								'''simple docstring'''
								lowercase__       			=      load_tool('''document-question-answering'''  )
								self.tool.setup()
								lowercase__       			=      load_tool('''document-question-answering''',  remote=lowerCamelCase  )




				def     lowercase__       (					self						:   List[Any]  ):

								'''simple docstring'''
								lowercase__       			=      load_dataset('''hf-internal-testing/example-documents''',  split='''test'''  )
								lowercase__       			=      dataset[0]['''image''']

								lowercase__       			=      self.tool(lowerCamelCase,  '''When is the coffee break?'''  )
								self.assertEqual(lowerCamelCase,  '''11-14 to 11:39 a.m.'''  )




				def     lowercase__       (					self						:   Optional[Any]  ):

								'''simple docstring'''
								lowercase__       			=      load_dataset('''hf-internal-testing/example-documents''',  split='''test'''  )
								lowercase__       			=      dataset[0]['''image''']

								lowercase__       			=      self.remote_tool(lowerCamelCase,  '''When is the coffee break?'''  )
								self.assertEqual(lowerCamelCase,  '''11-14 to 11:39 a.m.'''  )




				def     lowercase__       (					self						:   Any  ):

								'''simple docstring'''
								lowercase__       			=      load_dataset('''hf-internal-testing/example-documents''',  split='''test'''  )
								lowercase__       			=      dataset[0]['''image''']

								self.tool(document=lowerCamelCase,  question='''When is the coffee break?'''  )




				def     lowercase__       (					self						:   Tuple  ):

								'''simple docstring'''
								lowercase__       			=      load_dataset('''hf-internal-testing/example-documents''',  split='''test'''  )
								lowercase__       			=      dataset[0]['''image''']

								lowercase__       			=      self.remote_tool(document=lowerCamelCase,  question='''When is the coffee break?'''  )
								self.assertEqual(lowerCamelCase,  '''11-14 to 11:39 a.m.'''  )




