


import copy
import inspect
import unittest

import numpy as np
from huggingface_hub import hf_hub_download

from transformers import VideoMAEConfig
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
							import torch
							from torch import nn

							from transformers import (
							    MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING,
							    VideoMAEForPreTraining,
							    VideoMAEForVideoClassification,
							    VideoMAEModel,
							)
							from transformers.models.videomae.modeling_videomae import VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
							from transformers import VideoMAEImageProcessor

class 						A__							:




						def __init__(       self					:      List[Any]				,    _a					:      Any				,    _a					:      Any=13				,    _a					:      Dict=10				,    _a					:      Optional[Any]=3				,    _a					:      Tuple=2				,    _a					:      Union[str, Any]=2				,    _a					:      str=2				,    _a					:      Optional[int]=True				,    _a					:      Optional[int]=True				,    _a					:      Tuple=32				,    _a					:      Dict=5				,    _a					:      List[str]=4				,    _a					:      Union[str, Any]=37				,    _a					:      Tuple="gelu"				,    _a					:      Any=0.1				,    _a					:      Tuple=0.1				,    _a					:      Union[str, Any]=10				,    _a					:      Optional[Any]=0.02				,    _a					:      str=0.9				,    _a					:      Tuple=None				,    )							->     Any:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =parent
										_SCREAMING_SNAKE_CASE			  =batch_size
										_SCREAMING_SNAKE_CASE			  =image_size
										_SCREAMING_SNAKE_CASE			  =num_channels
										_SCREAMING_SNAKE_CASE			  =patch_size
										_SCREAMING_SNAKE_CASE			  =tubelet_size
										_SCREAMING_SNAKE_CASE			  =num_frames
										_SCREAMING_SNAKE_CASE			  =is_training
										_SCREAMING_SNAKE_CASE			  =use_labels
										_SCREAMING_SNAKE_CASE			  =hidden_size
										_SCREAMING_SNAKE_CASE			  =num_hidden_layers
										_SCREAMING_SNAKE_CASE			  =num_attention_heads
										_SCREAMING_SNAKE_CASE			  =intermediate_size
										_SCREAMING_SNAKE_CASE			  =hidden_act
										_SCREAMING_SNAKE_CASE			  =hidden_dropout_prob
										_SCREAMING_SNAKE_CASE			  =attention_probs_dropout_prob
										_SCREAMING_SNAKE_CASE			  =type_sequence_label_size
										_SCREAMING_SNAKE_CASE			  =initializer_range
										_SCREAMING_SNAKE_CASE			  =mask_ratio
										_SCREAMING_SNAKE_CASE			  =scope

										# in VideoMAE, the number of tokens equals num_frames/tubelet_size * num_patches per frame
										_SCREAMING_SNAKE_CASE			  =(image_size // patch_size) ** 2
										_SCREAMING_SNAKE_CASE			  =(num_frames // tubelet_size) * self.num_patches_per_frame

										# use this variable to define bool_masked_pos
										_SCREAMING_SNAKE_CASE			  =int(mask_ratio * self.seq_length  )




						def 							__UpperCamelCase				(       self					:      Any  )							->     Any:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =floats_tensor(
										    [self.batch_size, self.num_frames, self.num_channels, self.image_size, self.image_size]  )

										_SCREAMING_SNAKE_CASE			  =None
										if self.use_labels:
														_SCREAMING_SNAKE_CASE			  =ids_tensor([self.batch_size]				,    self.type_sequence_label_size  )

										_SCREAMING_SNAKE_CASE			  =self.get_config()

										return config, pixel_values, labels




						def 							__UpperCamelCase				(       self					:      Union[str, Any]  )							->     Tuple:


										"""simple docstring"""





										return VideoMAEConfig(
										    image_size=self.image_size				,    patch_size=self.patch_size				,    num_channels=self.num_channels				,    num_frames=self.num_frames				,    tubelet_size=self.tubelet_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				,    is_decoder=_a				,    initializer_range=self.initializer_range				,    )




						def 							__UpperCamelCase				(       self					:      Optional[Any]				,    _a					:      Dict				,    _a					:      Optional[Any]				,    _a					:      str  )							->     Union[str, Any]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =VideoMAEModel(config=_a  )
										model.to(_a  )
										model.eval()
										_SCREAMING_SNAKE_CASE			  =model(_a  )
										self.parent.assertEqual(result.last_hidden_state.shape				,    (self.batch_size, self.seq_length, self.hidden_size)  )




						def 							__UpperCamelCase				(       self					:      List[str]				,    _a					:      List[str]				,    _a					:      str				,    _a					:      List[str]  )							->     List[str]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =VideoMAEForPreTraining(_a  )
										model.to(_a  )
										model.eval()
										# important: each video needs to have the same number of masked patches
										# hence we define a single mask, which we then repeat for each example in the batch
										_SCREAMING_SNAKE_CASE			  =torch.ones((self.num_masks,)  )
										_SCREAMING_SNAKE_CASE			  =torch.cat([mask, torch.zeros(self.seq_length - mask.size(0  )  )]  )
										_SCREAMING_SNAKE_CASE			  =mask.expand(self.batch_size				,    -1  ).bool()

										_SCREAMING_SNAKE_CASE			  =model(_a				,    _a  )
										# model only returns predictions for masked patches
										_SCREAMING_SNAKE_CASE			  =mask.sum().item()
										_SCREAMING_SNAKE_CASE			  =3 * self.tubelet_size * self.patch_size**2
										self.parent.assertEqual(result.logits.shape				,    (self.batch_size, num_masked_patches, decoder_num_labels)  )




						def 							__UpperCamelCase				(       self					:      Any  )							->     str:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =self.prepare_config_and_inputs()
										_SCREAMING_SNAKE_CASE  ,				_SCREAMING_SNAKE_CASE  ,				_SCREAMING_SNAKE_CASE			  =config_and_inputs
										_SCREAMING_SNAKE_CASE			  ={'''pixel_values''': pixel_values}
										return config, inputs_dict

@require_torch
class 						A__							(		UpperCamelCase__   ,     UpperCamelCase__   ,     unittest.TestCase  ):
						UpperCAmelCase             =						(
						    (VideoMAEModel, VideoMAEForPreTraining, VideoMAEForVideoClassification) if is_torch_available() else ()
						)
						UpperCAmelCase             =						(
						    {"feature-extraction": VideoMAEModel, "video-classification": VideoMAEForVideoClassification}
						    if is_torch_available()
						    else {}
						)

						UpperCAmelCase             =						False
						UpperCAmelCase             =						False
						UpperCAmelCase             =						False
						UpperCAmelCase             =						False




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


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =VideoMAEModelTester(self  )
										_SCREAMING_SNAKE_CASE			  =ConfigTester(self				,    config_class=_a				,    has_text_modality=_a				,    hidden_size=37  )




						def 							__UpperCamelCase				(       self					:      Tuple				,    _a					:      Dict				,    _a					:      str				,    _a					:      Dict=False  )							->     Dict:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =copy.deepcopy(_a  )

										if model_class == VideoMAEForPreTraining:
														# important: each video needs to have the same number of masked patches
														# hence we define a single mask, which we then repeat for each example in the batch
														_SCREAMING_SNAKE_CASE			  =torch.ones((self.model_tester.num_masks,)  )
														_SCREAMING_SNAKE_CASE			  =torch.cat([mask, torch.zeros(self.model_tester.seq_length - mask.size(0  )  )]  )
														_SCREAMING_SNAKE_CASE			  =mask.expand(self.model_tester.batch_size				,    -1  ).bool()
														_SCREAMING_SNAKE_CASE			  =bool_masked_pos.to(_a  )

										if return_labels:
														if model_class in [
														    *get_values(_a  ),
														]:
																		_SCREAMING_SNAKE_CASE			  =torch.zeros(
																		    self.model_tester.batch_size				,    dtype=torch.long				,    device=_a  )

										return inputs_dict




						def 							__UpperCamelCase				(       self					:      Tuple  )							->     Union[str, Any]:


										"""simple docstring"""





										self.config_tester.run_common_tests()




						@unittest.skip(reason='''VideoMAE does not use inputs_embeds'''  )
						def 							__UpperCamelCase				(       self					:      Tuple  )							->     List[str]:


										"""simple docstring"""





										pass




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


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE  ,				_SCREAMING_SNAKE_CASE			  =self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
														_SCREAMING_SNAKE_CASE			  =model_class(_a  )
														self.assertIsInstance(model.get_input_embeddings()				,    (nn.Module)  )
														_SCREAMING_SNAKE_CASE			  =model.get_output_embeddings()
														self.assertTrue(x is None or isinstance(_a				,    nn.Linear  )  )




						def 							__UpperCamelCase				(       self					:      int  )							->     int:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE  ,				_SCREAMING_SNAKE_CASE			  =self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
														_SCREAMING_SNAKE_CASE			  =model_class(_a  )
														_SCREAMING_SNAKE_CASE			  =inspect.signature(model.forward  )
														# signature.parameters is an OrderedDict => so arg_names order is deterministic
														_SCREAMING_SNAKE_CASE			  =[*signature.parameters.keys()]

														_SCREAMING_SNAKE_CASE			  =['''pixel_values''']
														self.assertListEqual(arg_names[:1]				,    _a  )




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


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_model(*_a  )




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


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_for_pretraining(*_a  )




						@slow
						def 							__UpperCamelCase				(       self					:      List[str]  )							->     Union[str, Any]:


										"""simple docstring"""





										for model_name in VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														_SCREAMING_SNAKE_CASE			  =VideoMAEModel.from_pretrained(_a  )
														self.assertIsNotNone(_a  )




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


										"""simple docstring"""





										if not self.has_attentions:
														pass

										else:
														_SCREAMING_SNAKE_CASE  ,				_SCREAMING_SNAKE_CASE			  =self.model_tester.prepare_config_and_inputs_for_common()
														_SCREAMING_SNAKE_CASE			  =True

														for model_class in self.all_model_classes:
																		_SCREAMING_SNAKE_CASE			  =self.model_tester.seq_length - self.model_tester.num_masks
																		_SCREAMING_SNAKE_CASE			  =(
																		    num_visible_patches if model_class == VideoMAEForPreTraining else self.model_tester.seq_length
																		)

																		_SCREAMING_SNAKE_CASE			  =True
																		_SCREAMING_SNAKE_CASE			  =False
																		_SCREAMING_SNAKE_CASE			  =True
																		_SCREAMING_SNAKE_CASE			  =model_class(_a  )
																		model.to(_a  )
																		model.eval()
																		with torch.no_grad():
																						_SCREAMING_SNAKE_CASE			  =model(**self._prepare_for_class(_a				,    _a  )  )
																		_SCREAMING_SNAKE_CASE			  =outputs.attentions
																		self.assertEqual(len(_a  )				,    self.model_tester.num_hidden_layers  )

																		# check that output_attentions also work using config
																		del inputs_dict["output_attentions"]
																		_SCREAMING_SNAKE_CASE			  =True
																		_SCREAMING_SNAKE_CASE			  =model_class(_a  )
																		model.to(_a  )
																		model.eval()
																		with torch.no_grad():
																						_SCREAMING_SNAKE_CASE			  =model(**self._prepare_for_class(_a				,    _a  )  )
																		_SCREAMING_SNAKE_CASE			  =outputs.attentions
																		self.assertEqual(len(_a  )				,    self.model_tester.num_hidden_layers  )

																		self.assertListEqual(
																		    list(attentions[0].shape[-3:]  )				,    [self.model_tester.num_attention_heads, seq_len, seq_len]				,    )
																		_SCREAMING_SNAKE_CASE			  =len(_a  )

																		# Check attention is always last and order is fine
																		_SCREAMING_SNAKE_CASE			  =True
																		_SCREAMING_SNAKE_CASE			  =True
																		_SCREAMING_SNAKE_CASE			  =model_class(_a  )
																		model.to(_a  )
																		model.eval()
																		with torch.no_grad():
																						_SCREAMING_SNAKE_CASE			  =model(**self._prepare_for_class(_a				,    _a  )  )

																		self.assertEqual(out_len + 1				,    len(_a  )  )

																		_SCREAMING_SNAKE_CASE			  =outputs.attentions

																		self.assertEqual(len(_a  )				,    self.model_tester.num_hidden_layers  )
																		self.assertListEqual(
																		    list(self_attentions[0].shape[-3:]  )				,    [self.model_tester.num_attention_heads, seq_len, seq_len]				,    )




						def 							__UpperCamelCase				(       self					:      str  )							->     List[str]:


										"""simple docstring"""





										def check_hidden_states_output(_a					:      Optional[Any]				,    _a					:      int				,    _a					:      Union[str, Any]  ):
														_SCREAMING_SNAKE_CASE			  =model_class(_a  )
														model.to(_a  )
														model.eval()

														with torch.no_grad():
																		_SCREAMING_SNAKE_CASE			  =model(**self._prepare_for_class(_a				,    _a  )  )

														_SCREAMING_SNAKE_CASE			  =outputs.hidden_states
														_SCREAMING_SNAKE_CASE			  =self.model_tester.num_hidden_layers + 1
														self.assertEqual(len(_a  )				,    _a  )

														_SCREAMING_SNAKE_CASE			  =self.model_tester.seq_length - self.model_tester.num_masks
														_SCREAMING_SNAKE_CASE			  =num_visible_patches if model_class == VideoMAEForPreTraining else self.model_tester.seq_length

														self.assertListEqual(
														    list(hidden_states[0].shape[-2:]  )				,    [seq_length, self.model_tester.hidden_size]				,    )

										_SCREAMING_SNAKE_CASE  ,				_SCREAMING_SNAKE_CASE			  =self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
														_SCREAMING_SNAKE_CASE			  =True
														check_hidden_states_output(_a				,    _a				,    _a  )

														# check that output_hidden_states also work using config
														del inputs_dict["output_hidden_states"]
														_SCREAMING_SNAKE_CASE			  =True

														check_hidden_states_output(_a				,    _a				,    _a  )




						@unittest.skip('''Will be fixed soon by reducing the size of the model used for common tests.'''  )
						def 							__UpperCamelCase				(       self					:      Any  )							->     Tuple:


										"""simple docstring"""





										pass







def 						SCREAMING_SNAKE_CASE__(   ):
				_SCREAMING_SNAKE_CASE			  =hf_hub_download(
				    repo_id='''hf-internal-testing/spaghetti-video'''	,filename='''eating_spaghetti.npy'''	,repo_type='''dataset''')
				_SCREAMING_SNAKE_CASE			  =np.load(a__)
				return list(a__)


@require_torch
@require_vision
class 						A__							(		unittest.TestCase  ):




						@cached_property
						def 							__UpperCamelCase				(       self					:      Optional[Any]  )							->     List[Any]:


										"""simple docstring"""





										return (
										    VideoMAEImageProcessor(image_mean=[0.5, 0.5, 0.5]				,    image_std=[0.5, 0.5, 0.5]  )
										    if is_vision_available()
										    else None
										)




						@slow
						def 							__UpperCamelCase				(       self					:      Dict  )							->     Union[str, Any]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =VideoMAEForVideoClassification.from_pretrained('''MCG-NJU/videomae-base-finetuned-kinetics'''  ).to(
										    _a  )

										_SCREAMING_SNAKE_CASE			  =self.default_image_processor
										_SCREAMING_SNAKE_CASE			  =prepare_video()
										_SCREAMING_SNAKE_CASE			  =image_processor(_a				,    return_tensors='''pt'''  ).to(_a  )

										# forward pass
										with torch.no_grad():
														_SCREAMING_SNAKE_CASE			  =model(**_a  )

										# verify the logits
										_SCREAMING_SNAKE_CASE			  =torch.Size((1, 400)  )
										self.assertEqual(outputs.logits.shape				,    _a  )

										_SCREAMING_SNAKE_CASE			  =torch.tensor([0.36_69, -0.06_88, -0.24_21]  ).to(_a  )

										self.assertTrue(torch.allclose(outputs.logits[0, :3]				,    _a				,    atol=1E-4  )  )




						@slow
						def 							__UpperCamelCase				(       self					:      int  )							->     List[str]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =VideoMAEForPreTraining.from_pretrained('''MCG-NJU/videomae-base-short'''  ).to(_a  )

										_SCREAMING_SNAKE_CASE			  =self.default_image_processor
										_SCREAMING_SNAKE_CASE			  =prepare_video()
										_SCREAMING_SNAKE_CASE			  =image_processor(_a				,    return_tensors='''pt'''  ).to(_a  )

										# add boolean mask, indicating which patches to mask
										_SCREAMING_SNAKE_CASE			  =hf_hub_download(repo_id='''hf-internal-testing/bool-masked-pos'''				,    filename='''bool_masked_pos.pt'''  )
										_SCREAMING_SNAKE_CASE			  =torch.load(_a  )

										# forward pass
										with torch.no_grad():
														_SCREAMING_SNAKE_CASE			  =model(**_a  )

										# verify the logits
										_SCREAMING_SNAKE_CASE			  =torch.Size([1, 1408, 1536]  )
										_SCREAMING_SNAKE_CASE			  =torch.tensor(
										    [[0.79_94, 0.96_12, 0.85_08], [0.74_01, 0.89_58, 0.83_02], [0.58_62, 0.74_68, 0.73_25]]				,    device=_a  )
										self.assertEqual(outputs.logits.shape				,    _a  )
										self.assertTrue(torch.allclose(outputs.logits[0, :3, :3]				,    _a				,    atol=1E-4  )  )

										# verify the loss (`config.norm_pix_loss` = `True`)
										_SCREAMING_SNAKE_CASE			  =torch.tensor([0.51_42]				,    device=_a  )
										self.assertTrue(torch.allclose(outputs.loss				,    _a				,    atol=1E-4  )  )

										# verify the loss (`config.norm_pix_loss` = `False`)
										_SCREAMING_SNAKE_CASE			  =VideoMAEForPreTraining.from_pretrained('''MCG-NJU/videomae-base-short'''				,    norm_pix_loss=_a  ).to(
										    _a  )

										with torch.no_grad():
														_SCREAMING_SNAKE_CASE			  =model(**_a  )

										_SCREAMING_SNAKE_CASE			  =torch.tensor(torch.tensor([0.64_69]  )				,    device=_a  )
										self.assertTrue(torch.allclose(outputs.loss				,    _a				,    atol=1E-4  )  )



# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re

from ..models.auto import AutoProcessor
from ..models.vision_encoder_decoder import VisionEncoderDecoderModel
from ..utils import is_vision_available
from .base import PipelineTool


if is_vision_available():
							from PIL import Image

class 						A__							(		UpperCamelCase__  ):
						UpperCAmelCase             =						"naver-clova-ix/donut-base-finetuned-docvqa"
						UpperCAmelCase             =						(
						    "This is a tool that answers a question about an document (pdf). It takes an input named `document` which "
						    "should be the document containing the information, as well as a `question` that is the question about the "
						    "document. It returns a text that contains the answer to the question."
						)
						UpperCAmelCase             =						"document_qa"
						UpperCAmelCase             =						AutoProcessor
						UpperCAmelCase             =						VisionEncoderDecoderModel

						UpperCAmelCase             =						["image", "text"]
						UpperCAmelCase             =						["text"]




						def __init__(       self					:      Any				,    *_a					:      int				,    **_a					:      Dict  )							->     int:


										"""simple docstring"""





										if not is_vision_available():
														raise ValueError('''Pillow must be installed to use the DocumentQuestionAnsweringTool.'''  )

										super().__init__(*_a				,    **_a  )




						def 							__UpperCamelCase				(       self					:      Optional[Any]				,    _a					:      "Image"				,    _a					:      str  )							->     Tuple:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  ='''<s_docvqa><s_question>{user_input}</s_question><s_answer>'''
										_SCREAMING_SNAKE_CASE			  =task_prompt.replace('''{user_input}'''				,    _a  )
										_SCREAMING_SNAKE_CASE			  =self.pre_processor.tokenizer(
										    _a				,    add_special_tokens=_a				,    return_tensors='''pt'''  ).input_ids
										_SCREAMING_SNAKE_CASE			  =self.pre_processor(_a				,    return_tensors='''pt'''  ).pixel_values

										return {"decoder_input_ids": decoder_input_ids, "pixel_values": pixel_values}




						def 							__UpperCamelCase				(       self					:      List[Any]				,    _a					:      Optional[Any]  )							->     int:


										"""simple docstring"""





										return self.model.generate(
										    inputs['''pixel_values'''].to(self.device  )				,    decoder_input_ids=inputs['''decoder_input_ids'''].to(self.device  )				,    max_length=self.model.decoder.config.max_position_embeddings				,    early_stopping=_a				,    pad_token_id=self.pre_processor.tokenizer.pad_token_id				,    eos_token_id=self.pre_processor.tokenizer.eos_token_id				,    use_cache=_a				,    num_beams=1				,    bad_words_ids=[[self.pre_processor.tokenizer.unk_token_id]]				,    return_dict_in_generate=_a				,    ).sequences




						def 							__UpperCamelCase				(       self					:      Any				,    _a					:      int  )							->     Any:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE			  =self.pre_processor.batch_decode(_a  )[0]
										_SCREAMING_SNAKE_CASE			  =sequence.replace(self.pre_processor.tokenizer.eos_token				,    ''''''  )
										_SCREAMING_SNAKE_CASE			  =sequence.replace(self.pre_processor.tokenizer.pad_token				,    ''''''  )
										_SCREAMING_SNAKE_CASE			  =re.sub(R'''<.*?>'''				,    ''''''				,    _a				,    count=1  ).strip()  # remove first task start token
										_SCREAMING_SNAKE_CASE			  =self.pre_processor.tokenajson(_a  )

										return sequence["answer"]