




import os
import tempfile
import unittest

from transformers import NezhaConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
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 (
					    MODEL_FOR_PRETRAINING_MAPPING,
					    NezhaForMaskedLM,
					    NezhaForMultipleChoice,
					    NezhaForNextSentencePrediction,
					    NezhaForPreTraining,
					    NezhaForQuestionAnswering,
					    NezhaForSequenceClassification,
					    NezhaForTokenClassification,
					    NezhaModel,
					)
					from transformers.models.nezha.modeling_nezha import NEZHA_PRETRAINED_MODEL_ARCHIVE_LIST
class     a__					:






						def __init__(     self	,    _A	,    _A=1_3	,    _A=7	,    _A=True	,    _A=True	,    _A=True	,    _A=True	,    _A=9_9	,    _A=3_2	,    _A=5	,    _A=4	,    _A=3_7	,    _A="gelu"	,    _A=0.1	,    _A=0.1	,    _A=1_2_8	,    _A=3_2	,    _A=1_6	,    _A=2	,    _A=0.02	,    _A=3	,    _A=4	,    _A=None	,    ):




											"""simple docstring"""



											__lowerCAmelCase            = parent
											__lowerCAmelCase            = batch_size
											__lowerCAmelCase            = seq_length
											__lowerCAmelCase            = is_training
											__lowerCAmelCase            = use_input_mask
											__lowerCAmelCase            = use_token_type_ids
											__lowerCAmelCase            = use_labels
											__lowerCAmelCase            = vocab_size
											__lowerCAmelCase            = hidden_size
											__lowerCAmelCase            = num_hidden_layers
											__lowerCAmelCase            = num_attention_heads
											__lowerCAmelCase            = intermediate_size
											__lowerCAmelCase            = hidden_act
											__lowerCAmelCase            = hidden_dropout_prob
											__lowerCAmelCase            = attention_probs_dropout_prob
											__lowerCAmelCase            = max_position_embeddings
											__lowerCAmelCase            = type_vocab_size
											__lowerCAmelCase            = type_sequence_label_size
											__lowerCAmelCase            = initializer_range
											__lowerCAmelCase            = num_labels
											__lowerCAmelCase            = num_choices
											__lowerCAmelCase            = scope






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = ids_tensor([self.batch_size, self.seq_length]	,    self.vocab_size    )

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

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

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

											__lowerCAmelCase            = self.get_config()

											return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											return NezhaConfig(
											    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=_A	,    initializer_range=self.initializer_range	,    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											(
											    (
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							
											)            = self.prepare_config_and_inputs()

											__lowerCAmelCase            = True
											__lowerCAmelCase            = floats_tensor([self.batch_size, self.seq_length, self.hidden_size]    )
											__lowerCAmelCase            = 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        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = NezhaModel(config=_A    )
											model.to(_A    )
											model.eval()
											__lowerCAmelCase            = model(_A	,    attention_mask=_A	,    token_type_ids=_A    )
											__lowerCAmelCase            = model(_A	,    token_type_ids=_A    )
											__lowerCAmelCase            = model(_A    )
											self.parent.assertEqual(result.last_hidden_state.shape	,    (self.batch_size, self.seq_length, self.hidden_size)    )
											self.parent.assertEqual(result.pooler_output.shape	,    (self.batch_size, self.hidden_size)    )






						def        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    ):




											"""simple docstring"""



											__lowerCAmelCase            = True
											__lowerCAmelCase            = NezhaModel(_A    )
											model.to(_A    )
											model.eval()
											__lowerCAmelCase            = model(
											    _A	,    attention_mask=_A	,    token_type_ids=_A	,    encoder_hidden_states=_A	,    encoder_attention_mask=_A	,    )
											__lowerCAmelCase            = model(
											    _A	,    attention_mask=_A	,    token_type_ids=_A	,    encoder_hidden_states=_A	,    )
											__lowerCAmelCase            = model(_A	,    attention_mask=_A	,    token_type_ids=_A    )
											self.parent.assertEqual(result.last_hidden_state.shape	,    (self.batch_size, self.seq_length, self.hidden_size)    )
											self.parent.assertEqual(result.pooler_output.shape	,    (self.batch_size, self.hidden_size)    )






						def        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = NezhaForMaskedLM(config=_A    )
											model.to(_A    )
											model.eval()
											__lowerCAmelCase            = 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        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = NezhaForNextSentencePrediction(config=_A    )
											model.to(_A    )
											model.eval()
											__lowerCAmelCase            = model(
											    _A	,    attention_mask=_A	,    token_type_ids=_A	,    labels=_A	,    )
											self.parent.assertEqual(result.logits.shape	,    (self.batch_size, 2)    )






						def        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = NezhaForPreTraining(config=_A    )
											model.to(_A    )
											model.eval()
											__lowerCAmelCase            = model(
											    _A	,    attention_mask=_A	,    token_type_ids=_A	,    labels=_A	,    next_sentence_label=_A	,    )
											self.parent.assertEqual(result.prediction_logits.shape	,    (self.batch_size, self.seq_length, self.vocab_size)    )
											self.parent.assertEqual(result.seq_relationship_logits.shape	,    (self.batch_size, 2)    )






						def        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = NezhaForQuestionAnswering(config=_A    )
											model.to(_A    )
											model.eval()
											__lowerCAmelCase            = 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        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.num_labels
											__lowerCAmelCase            = NezhaForSequenceClassification(_A    )
											model.to(_A    )
											model.eval()
											__lowerCAmelCase            = model(_A	,    attention_mask=_A	,    token_type_ids=_A	,    labels=_A    )
											self.parent.assertEqual(result.logits.shape	,    (self.batch_size, self.num_labels)    )






						def        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.num_labels
											__lowerCAmelCase            = NezhaForTokenClassification(config=_A    )
											model.to(_A    )
											model.eval()
											__lowerCAmelCase            = 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        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.num_choices
											__lowerCAmelCase            = NezhaForMultipleChoice(config=_A    )
											model.to(_A    )
											model.eval()
											__lowerCAmelCase            = input_ids.unsqueeze(1    ).expand(-1	,    self.num_choices	,    -1    ).contiguous()
											__lowerCAmelCase            = token_type_ids.unsqueeze(1    ).expand(-1	,    self.num_choices	,    -1    ).contiguous()
											__lowerCAmelCase            = input_mask.unsqueeze(1    ).expand(-1	,    self.num_choices	,    -1    ).contiguous()
											__lowerCAmelCase            = model(
											    _A	,    attention_mask=_A	,    token_type_ids=_A	,    labels=_A	,    )
											self.parent.assertEqual(result.logits.shape	,    (self.batch_size, self.num_choices)    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.prepare_config_and_inputs()
											(
											    (
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							
											)            = config_and_inputs
											__lowerCAmelCase            = {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
											return config, inputs_dict






@require_torch
class     a__					(      snake_case__				,       snake_case__				,       snake_case__				,       unittest.TestCase   ):
						_a							:					Optional[int]      =					(
						    (
						        NezhaModel,
						        NezhaForMaskedLM,
						        NezhaForMultipleChoice,
						        NezhaForNextSentencePrediction,
						        NezhaForPreTraining,
						        NezhaForQuestionAnswering,
						        NezhaForSequenceClassification,
						        NezhaForTokenClassification,
						    )
						    if is_torch_available()
						    else ()
						)
						_a							:					Dict      =					(
						    {
						        """feature-extraction""": NezhaModel,
						        """fill-mask""": NezhaForMaskedLM,
						        """question-answering""": NezhaForQuestionAnswering,
						        """text-classification""": NezhaForSequenceClassification,
						        """token-classification""": NezhaForTokenClassification,
						        """zero-shot""": NezhaForSequenceClassification,
						    }
						    if is_torch_available()
						    else {}
						)
						_a							:					List[Any]      =					True






						def        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A=False    ):




											"""simple docstring"""



											__lowerCAmelCase            = super()._prepare_for_class(_A	,    _A	,    return_labels=_A    )

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






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = NezhaModelTester(self    )
											__lowerCAmelCase            = ConfigTester(self	,    config_class=_A	,    hidden_size=3_7    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											self.config_tester.run_common_tests()






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*_A    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs_for_decoder()
											self.model_tester.create_and_check_model_as_decoder(*_A    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											(
											    (
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							(
											    __lowerCAmelCase
											)     ,							
											)            = self.model_tester.prepare_config_and_inputs_for_decoder()

											__lowerCAmelCase            = None

											self.model_tester.create_and_check_model_as_decoder(
											    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    _A	,    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_masked_lm(*_A    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_multiple_choice(*_A    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_next_sequence_prediction(*_A    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_pretraining(*_A    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_question_answering(*_A    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_sequence_classification(*_A    )






						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_token_classification(*_A    )






						@slow
						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											for model_name in NEZHA_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																__lowerCAmelCase            = NezhaModel.from_pretrained(_A    )
																self.assertIsNotNone(_A    )






						@slow
						@require_torch_gpu
						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase     ,							__lowerCAmelCase            = self.model_tester.prepare_config_and_inputs_for_common()
											for model_class in self.all_model_classes:
																# NezhaForMultipleChoice behaves incorrectly in JIT environments.
																if model_class == NezhaForMultipleChoice:
																					return

																__lowerCAmelCase            = True
																__lowerCAmelCase            = model_class(config=_A    )

																__lowerCAmelCase            = self._prepare_for_class(_A	,    _A    )
																__lowerCAmelCase            = torch.jit.trace(
																    _A	,    (inputs_dict["input_ids"].to("cpu"    ), inputs_dict["attention_mask"].to("cpu"    ))    )

																with tempfile.TemporaryDirectory() as tmp:
																					torch.jit.save(_A	,    os.path.join(_A	,    "bert.pt"    )    )
																					__lowerCAmelCase            = torch.jit.load(os.path.join(_A	,    "bert.pt"    )	,    map_location=_A    )
																					loaded(inputs_dict["input_ids"].to(_A    )	,    inputs_dict["attention_mask"].to(_A    )    )






@require_torch
class     a__					(      unittest.TestCase   ):






						@slow
						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = NezhaModel.from_pretrained("sijunhe/nezha-cn-base"    )
											__lowerCAmelCase            = torch.tensor([[0, 1, 2, 3, 4, 5]]    )
											__lowerCAmelCase            = torch.tensor([[0, 1, 1, 1, 1, 1]]    )
											with torch.no_grad():
																__lowerCAmelCase            = model(_A	,    attention_mask=_A    )[0]
											__lowerCAmelCase            = torch.Size((1, 6, 7_6_8)    )
											self.assertEqual(output.shape	,    _A    )
											__lowerCAmelCase            = torch.tensor([[[0.06_85, 0.24_41, 0.11_02], [0.06_00, 0.19_06, 0.13_49], [0.02_21, 0.08_19, 0.05_86]]]    )

											self.assertTrue(torch.allclose(output[:, 1:4, 1:4]	,    _A	,    atol=1E-4    )    )






						@slow
						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = NezhaForMaskedLM.from_pretrained("sijunhe/nezha-cn-base"    )
											__lowerCAmelCase            = torch.tensor([[0, 1, 2, 3, 4, 5]]    )
											__lowerCAmelCase            = torch.tensor([[1, 1, 1, 1, 1, 1]]    )
											with torch.no_grad():
																__lowerCAmelCase            = model(_A	,    attention_mask=_A    )[0]
											__lowerCAmelCase            = torch.Size((1, 6, 2_1_1_2_8)    )
											self.assertEqual(output.shape	,    _A    )
											__lowerCAmelCase            = torch.tensor(
											    [[-2.79_39, -1.79_02, -2.21_89], [-2.85_85, -1.89_08, -2.37_23], [-2.64_99, -1.77_50, -2.25_58]]    )

											self.assertTrue(torch.allclose(output[:, 1:4, 1:4]	,    _A	,    atol=1E-4    )    )










import unittest

from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available
from transformers.pipelines import pipeline
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_tf,
    require_torch,
    require_vision,
    slow,
)

from .test_pipelines_common import ANY


if is_vision_available():
					from PIL import Image
else:
					class     a__					:






											@staticmethod
											def        __SCREAMING_SNAKE_CASE(     *_A	,    **_A    ):




																"""simple docstring"""



																pass
@is_pipeline_test
@require_torch
@require_vision
class     a__					(      unittest.TestCase   ):
						_a							:					Any      =					MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING






						def        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = pipeline("visual-question-answering"	,    model="hf-internal-testing/tiny-vilt-random-vqa"    )
											__lowerCAmelCase            = [
											    {
											        "image": Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"    ),
											        "question": "How many cats are there?",
											    },
											    {
											        "image": "./tests/fixtures/tests_samples/COCO/000000039769.png",
											        "question": "How many cats are there?",
											    },
											]
											return vqa_pipeline, examples






						def        __SCREAMING_SNAKE_CASE(     self	,    _A	,    _A    ):




											"""simple docstring"""



											__lowerCAmelCase            = vqa_pipeline(_A	,    top_k=1    )
											self.assertEqual(
											    _A	,    [
											        [{"score": ANY(_A    ), "answer": ANY(_A    )}],
											        [{"score": ANY(_A    ), "answer": ANY(_A    )}],
											    ]	,    )






						@require_torch
						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = pipeline("visual-question-answering"	,    model="hf-internal-testing/tiny-vilt-random-vqa"    )
											__lowerCAmelCase            = "./tests/fixtures/tests_samples/COCO/000000039769.png"
											__lowerCAmelCase            = "How many cats are there?"

											__lowerCAmelCase            = vqa_pipeline(image=_A	,    question="How many cats are there?"	,    top_k=2    )
											self.assertEqual(
											    _A	,    [{"score": ANY(_A    ), "answer": ANY(_A    )}, {"score": ANY(_A    ), "answer": ANY(_A    )}]    )

											__lowerCAmelCase            = vqa_pipeline({"image": image, "question": question}	,    top_k=2    )
											self.assertEqual(
											    _A	,    [{"score": ANY(_A    ), "answer": ANY(_A    )}, {"score": ANY(_A    ), "answer": ANY(_A    )}]    )






						@slow
						@require_torch
						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											__lowerCAmelCase            = pipeline("visual-question-answering"	,    model="dandelin/vilt-b32-finetuned-vqa"    )
											__lowerCAmelCase            = "./tests/fixtures/tests_samples/COCO/000000039769.png"
											__lowerCAmelCase            = "How many cats are there?"

											__lowerCAmelCase            = vqa_pipeline(image=_A	,    question=_A	,    top_k=2    )
											self.assertEqual(
											    nested_simplify(_A	,    decimals=4    )	,    [{"score": 0.87_99, "answer": "2"}, {"score": 0.2_96, "answer": "1"}]    )

											__lowerCAmelCase            = vqa_pipeline({"image": image, "question": question}	,    top_k=2    )
											self.assertEqual(
											    nested_simplify(_A	,    decimals=4    )	,    [{"score": 0.87_99, "answer": "2"}, {"score": 0.2_96, "answer": "1"}]    )

											__lowerCAmelCase            = vqa_pipeline(
											    [{"image": image, "question": question}, {"image": image, "question": question}]	,    top_k=2    )
											self.assertEqual(
											    nested_simplify(_A	,    decimals=4    )	,    [[{"score": 0.87_99, "answer": "2"}, {"score": 0.2_96, "answer": "1"}]] * 2	,    )






						@require_tf
						@unittest.skip("Visual question answering not implemented in TF"    )
						def        __SCREAMING_SNAKE_CASE(     self    ):




											"""simple docstring"""



											pass




