





from __future__ import annotations

import unittest

from transformers import LEDConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
     import tensorflow as tf

     from transformers import TFLEDForConditionalGeneration, TFLEDModel







@require_tf
class 				__lowerCAmelCase       :
      _lowercase				:					Optional[int]						=			LEDConfig
      _lowercase				:					Optional[Any]						=			{}
      _lowercase				:					Optional[int]						=			"""gelu"""







      def __init__(    self		,      lowerCAmelCase__		,      lowerCAmelCase__=1_3		,      lowerCAmelCase__=7		,      lowerCAmelCase__=True		,      lowerCAmelCase__=False		,      lowerCAmelCase__=9_9		,      lowerCAmelCase__=3_2		,      lowerCAmelCase__=2		,      lowerCAmelCase__=4		,      lowerCAmelCase__=3_7		,      lowerCAmelCase__=0.1		,      lowerCAmelCase__=0.1		,      lowerCAmelCase__=2_0		,      lowerCAmelCase__=2		,      lowerCAmelCase__=1		,      lowerCAmelCase__=0		,      lowerCAmelCase__=4		,      )   ->						int:



        '''simple docstring'''




        a__	:					int										=parent
        a__	:					int										=batch_size
        a__	:					Dict										=seq_length
        a__	:					str										=is_training
        a__	:					Optional[int]										=use_labels
        a__	:					Optional[Any]										=vocab_size
        a__	:					List[str]										=hidden_size
        a__	:					Dict										=num_hidden_layers
        a__	:					str										=num_attention_heads
        a__	:					str										=intermediate_size

        a__	:					Dict										=hidden_dropout_prob
        a__	:					Tuple										=attention_probs_dropout_prob
        a__	:					List[str]										=max_position_embeddings
        a__	:					Dict										=eos_token_id
        a__	:					Tuple										=pad_token_id
        a__	:					Optional[Any]										=bos_token_id
        a__	:					int										=attention_window

        # `ModelTesterMixin.test_attention_outputs` is expecting attention tensors to be of size
        # [num_attention_heads, encoder_seq_length, encoder_key_length], but TFLongformerSelfAttention
        # returns attention of shape [num_attention_heads, encoder_seq_length, self.attention_window + 1]
        # because its local attention only attends to `self.attention_window` and one before and one after
        a__	:					Union[str, Any]										=self.attention_window + 2

        # because of padding `encoder_seq_length`, is different from `seq_length`. Relevant for
        # the `test_attention_outputs` and `test_hidden_states_output` tests
        a__	:					List[str]										=(
            self.seq_length + (self.attention_window - self.seq_length % self.attention_window) % self.attention_window
        )







      def    _lowercase  (    self							)   ->						List[Any]:



        '''simple docstring'''




        a__	:					Any										=ids_tensor([self.batch_size, self.seq_length - 1]		,      self.vocab_size							)
        a__	:					List[Any]										=tf.expand_dims(tf.constant([self.eos_token_id] * self.batch_size							)		,      1							)
        a__	:					List[Any]										=tf.concat([input_ids, eos_tensor]		,      axis=1							)

        a__	:					Any										=ids_tensor([self.batch_size, self.seq_length]		,      self.vocab_size							)

        a__	:					Tuple										=self.config_cls(
            vocab_size=self.vocab_size		,      d_model=self.hidden_size		,      encoder_layers=self.num_hidden_layers		,      decoder_layers=self.num_hidden_layers		,      encoder_attention_heads=self.num_attention_heads		,      decoder_attention_heads=self.num_attention_heads		,      encoder_ffn_dim=self.intermediate_size		,      decoder_ffn_dim=self.intermediate_size		,      dropout=self.hidden_dropout_prob		,      attention_dropout=self.attention_probs_dropout_prob		,      max_position_embeddings=self.max_position_embeddings		,      eos_token_ids=[2]		,      bos_token_id=self.bos_token_id		,      pad_token_id=self.pad_token_id		,      decoder_start_token_id=self.pad_token_id		,      attention_window=self.attention_window		,      **self.config_updates		,      )
        a__	:					int										=prepare_led_inputs_dict(lowerCAmelCase__		,      lowerCAmelCase__		,      lowerCAmelCase__							)
        a__	:					str										=tf.concat(
            [tf.zeros_like(lowerCAmelCase__							)[:, :-1], tf.ones_like(lowerCAmelCase__							)[:, -1:]]		,      axis=-1		,      )
        a__	:					Dict										=global_attention_mask
        return config, inputs_dict







      def    _lowercase  (    self		,      lowerCAmelCase__		,      lowerCAmelCase__							)   ->						Tuple:



        '''simple docstring'''




        a__	:					Any										=TFLEDModel(config=lowerCAmelCase__							).get_decoder()
        a__	:					Tuple										=inputs_dict["input_ids"]

        a__	:					Any										=input_ids[:1, :]
        a__	:					List[str]										=inputs_dict["attention_mask"][:1, :]
        a__	:					List[Any]										=1

        # first forward pass
        a__	:					Any										=model(lowerCAmelCase__		,      attention_mask=lowerCAmelCase__		,      use_cache=lowerCAmelCase__							)

        a__					,							a__	:					Optional[int]										=outputs.to_tuple()

        # create hypothetical next token and extent to next_input_ids
        a__	:					Optional[Any]										=ids_tensor((self.batch_size, 3)		,      config.vocab_size							)
        a__	:					str										=tf.cast(ids_tensor((self.batch_size, 3)		,      2							)		,      tf.inta							)

        # append to next input_ids and
        a__	:					Optional[int]										=tf.concat([input_ids, next_tokens]		,      axis=-1							)
        a__	:					List[str]										=tf.concat([attention_mask, next_attn_mask]		,      axis=-1							)

        a__	:					List[Any]										=model(lowerCAmelCase__		,      attention_mask=lowerCAmelCase__							)[0]
        a__	:					Tuple										=model(lowerCAmelCase__		,      attention_mask=lowerCAmelCase__		,      past_key_values=lowerCAmelCase__							)[0]

        self.parent.assertEqual(next_tokens.shape[1]		,      output_from_past.shape[1]							)

        # select random slice
        a__	:					Any										=int(ids_tensor((1,)		,      output_from_past.shape[-1]							)							)
        a__	:					Optional[Any]										=output_from_no_past[:, -3:, random_slice_idx]
        a__	:					int										=output_from_past[:, :, random_slice_idx]

        # test that outputs are equal for slice
        tf.debugging.assert_near(lowerCAmelCase__		,      lowerCAmelCase__		,      rtol=1E-3							)
def      _A       (		SCREAMING_SNAKE_CASE     :   Tuple       ,       SCREAMING_SNAKE_CASE     :   List[str]       ,       SCREAMING_SNAKE_CASE     :   int       ,       SCREAMING_SNAKE_CASE     :   Optional[int]=None       ,       SCREAMING_SNAKE_CASE     :   str=None       ,       SCREAMING_SNAKE_CASE     :   Optional[Any]=None       ,       SCREAMING_SNAKE_CASE     :   Optional[Any]=None       ,       ):





  """simple docstring"""



  if attention_mask is None:
    a__	:					Optional[int]										=tf.cast(tf.math.not_equal(SCREAMING_SNAKE_CASE       ,       config.pad_token_id						)       ,       tf.inta						)
  if decoder_attention_mask is None:
    a__	:					Any										=tf.concat(
        [
            tf.ones(decoder_input_ids[:, :1].shape       ,       dtype=tf.inta						),
            tf.cast(tf.math.not_equal(decoder_input_ids[:, 1:]       ,       config.pad_token_id						)       ,       tf.inta						),
        ]       ,       axis=-1       ,       )
  if head_mask is None:
    a__	:					int										=tf.ones((config.encoder_layers, config.encoder_attention_heads)						)
  if decoder_head_mask is None:
    a__	:					Optional[int]										=tf.ones((config.decoder_layers, config.decoder_attention_heads)						)
  return {
      "input_ids": input_ids,
      "attention_mask": attention_mask,
      "decoder_input_ids": decoder_input_ids,
      "decoder_attention_mask": decoder_attention_mask,
      "head_mask": head_mask,
      "decoder_head_mask": decoder_head_mask,
  }







@require_tf
class 				__lowerCAmelCase       (    UpperCamelCase__						,				UpperCamelCase__						,				unittest.TestCase):
      _lowercase				:					int						=			(TFLEDForConditionalGeneration, TFLEDModel) if is_tf_available() else ()
      _lowercase				:					Union[str, Any]						=			(TFLEDForConditionalGeneration,) if is_tf_available() else ()
      _lowercase				:					Optional[int]						=			(
          {
              """conversational""": TFLEDForConditionalGeneration,
              """feature-extraction""": TFLEDModel,
              """summarization""": TFLEDForConditionalGeneration,
              """text2text-generation""": TFLEDForConditionalGeneration,
              """translation""": TFLEDForConditionalGeneration,
          }
          if is_tf_available()
          else {}
      )
      _lowercase				:					Union[str, Any]						=			True
      _lowercase				:					List[str]						=			False
      _lowercase				:					List[str]						=			False
      _lowercase				:					Dict						=			False







      def    _lowercase  (    self							)   ->						int:



        '''simple docstring'''




        a__	:					List[str]										=TFLEDModelTester(self							)
        a__	:					Any										=ConfigTester(self		,      config_class=lowerCAmelCase__							)







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



        '''simple docstring'''




        self.config_tester.run_common_tests()







      def    _lowercase  (    self							)   ->						str:



        '''simple docstring'''




        a__	:					Any										=self.model_tester.prepare_config_and_inputs_for_common()
        self.model_tester.check_decoder_model_past_large_inputs(*lowerCAmelCase__							)







      def    _lowercase  (    self							)   ->						Tuple:



        '''simple docstring'''




        a__					,							a__	:					Any										=self.model_tester.prepare_config_and_inputs_for_common()
        a__	:					List[str]										=tf.zeros_like(inputs_dict["attention_mask"]							)
        a__	:					Tuple										=2
        a__	:					int										=tf.where(
            tf.range(self.model_tester.seq_length							)[None, :] < num_global_attn_indices		,      1		,      inputs_dict["global_attention_mask"]		,      )

        a__	:					Dict										=True
        a__	:					List[Any]										=self.model_tester.seq_length
        a__	:					Dict										=self.model_tester.encoder_seq_length

        def check_decoder_attentions_output(lowerCAmelCase__							):
          a__	:					List[Any]										=outputs.decoder_attentions
          self.assertEqual(len(lowerCAmelCase__							)		,      self.model_tester.num_hidden_layers							)
          self.assertListEqual(
              list(decoder_attentions[0].shape[-3:]							)		,      [self.model_tester.num_attention_heads, seq_length, seq_length]		,      )

        def check_encoder_attentions_output(lowerCAmelCase__							):
          a__	:					Optional[int]										=[t.numpy() for t in outputs.encoder_attentions]
          a__	:					Any										=[t.numpy() for t in outputs.encoder_global_attentions]
          self.assertEqual(len(lowerCAmelCase__							)		,      self.model_tester.num_hidden_layers							)
          self.assertEqual(len(lowerCAmelCase__							)		,      self.model_tester.num_hidden_layers							)
          self.assertListEqual(
              list(attentions[0].shape[-3:]							)		,      [self.model_tester.num_attention_heads, seq_length, seq_length]		,      )
          self.assertListEqual(
              list(global_attentions[0].shape[-3:]							)		,      [self.model_tester.num_attention_heads, encoder_seq_length, num_global_attn_indices]		,      )

        for model_class in self.all_model_classes:
          a__	:					Optional[int]										=True
          a__	:					List[Any]										=False
          a__	:					Any										=False
          a__	:					List[str]										=model_class(lowerCAmelCase__							)
          a__	:					Optional[Any]										=model(self._prepare_for_class(lowerCAmelCase__		,      lowerCAmelCase__							)							)
          a__	:					Optional[int]										=len(lowerCAmelCase__							)
          self.assertEqual(config.output_hidden_states		,      lowerCAmelCase__							)
          check_encoder_attentions_output(lowerCAmelCase__							)

          if self.is_encoder_decoder:
            a__	:					Union[str, Any]										=model_class(lowerCAmelCase__							)
            a__	:					Dict										=model(self._prepare_for_class(lowerCAmelCase__		,      lowerCAmelCase__							)							)
            self.assertEqual(config.output_hidden_states		,      lowerCAmelCase__							)
            check_decoder_attentions_output(lowerCAmelCase__							)

          # Check that output attentions can also be changed via the config
          del inputs_dict["output_attentions"]
          a__	:					str										=True
          a__	:					Union[str, Any]										=model_class(lowerCAmelCase__							)
          a__	:					Optional[Any]										=model(self._prepare_for_class(lowerCAmelCase__		,      lowerCAmelCase__							)							)
          self.assertEqual(config.output_hidden_states		,      lowerCAmelCase__							)
          check_encoder_attentions_output(lowerCAmelCase__							)

          # Check attention is always last and order is fine
          a__	:					int										=True
          a__	:					Tuple										=True
          a__	:					Tuple										=model_class(lowerCAmelCase__							)
          a__	:					Optional[Any]										=model(self._prepare_for_class(lowerCAmelCase__		,      lowerCAmelCase__							)							)

          self.assertEqual(out_len + (2 if self.is_encoder_decoder else 1)		,      len(lowerCAmelCase__							)							)
          self.assertEqual(model.config.output_hidden_states		,      lowerCAmelCase__							)
          check_encoder_attentions_output(lowerCAmelCase__							)







      @unittest.skip("LED keeps using potentially symbolic tensors in conditionals and breaks tracing."							)
      def    _lowercase  (    self							)   ->						Optional[Any]:



        '''simple docstring'''




        pass







      def    _lowercase  (    self							)   ->						str:



        '''simple docstring'''




        pass
def      _A       (		SCREAMING_SNAKE_CASE     :   str						):





  """simple docstring"""



  return tf.constant(SCREAMING_SNAKE_CASE       ,       dtype=tf.intaa						)


UpperCAmelCase	:	Dict		     =       1E-4







@slow
@require_tf
class 				__lowerCAmelCase       (    unittest.TestCase):







      def    _lowercase  (    self							)   ->						Dict:



        '''simple docstring'''




        a__	:					Tuple										=TFLEDForConditionalGeneration.from_pretrained("allenai/led-base-16384"							).led

        # change to intended input here
        a__	:					Any										=_long_tensor([5_1_2 * [0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9]]							)
        a__	:					int										=_long_tensor([1_2_8 * [0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9]]							)
        a__	:					List[str]										=prepare_led_inputs_dict(model.config		,      lowerCAmelCase__		,      lowerCAmelCase__							)
        a__	:					Tuple										=model(**lowerCAmelCase__							)[0]
        a__	:					Optional[int]										=(1, 1_0_2_4, 7_6_8)
        self.assertEqual(output.shape		,      lowerCAmelCase__							)
        # change to expected output here
        a__	:					Optional[int]										=tf.convert_to_tensor(
            [[2.30_50, 2.82_79, 0.65_31], [-1.84_57, -0.14_55, -3.56_61], [-1.01_86, 0.45_86, -2.20_43]]		,      )
        tf.debugging.assert_near(output[:, :3, :3]		,      lowerCAmelCase__		,      atol=1E-3							)







      def    _lowercase  (    self							)   ->						Any:



        '''simple docstring'''




        a__	:					Tuple										=TFLEDForConditionalGeneration.from_pretrained("allenai/led-base-16384"							)

        # change to intended input here
        a__	:					Union[str, Any]										=_long_tensor([5_1_2 * [0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9]]							)
        a__	:					Dict										=_long_tensor([1_2_8 * [0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9]]							)
        a__	:					int										=prepare_led_inputs_dict(model.config		,      lowerCAmelCase__		,      lowerCAmelCase__							)
        a__	:					Optional[int]										=model(**lowerCAmelCase__							)[0]
        a__	:					Any										=(1, 1_0_2_4, model.config.vocab_size)
        self.assertEqual(output.shape		,      lowerCAmelCase__							)
        # change to expected output here
        a__	:					Dict										=tf.convert_to_tensor(
            [[33.65_07, 6.45_72, 16.80_89], [5.87_39, -2.42_38, 11.29_02], [-3.21_39, -4.31_49, 4.27_83]]		,      )
        tf.debugging.assert_near(output[:, :3, :3]		,      lowerCAmelCase__		,      atol=1E-3		,      rtol=1E-3							)








import os
import time
from dataclasses import dataclass, field
from enum import Enum
from typing import Dict, List, Optional, Union

import torch
from filelock import FileLock
from torch.utils.data import Dataset

from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
from ..processors.squad import SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features


__A				=logging.get_logger(__name__)

__A				=list(MODEL_FOR_QUESTION_ANSWERING_MAPPING.keys())
__A				=tuple(conf.model_type for conf in MODEL_CONFIG_CLASSES)




@dataclass
class     _SCREAMING_SNAKE_CASE     :
	lowerCAmelCase__         = field(
	    default=snake_case_			,       metadata={'help': 'Model type selected in the list: ' + ', '.join(snake_case_						)}						)
	lowerCAmelCase__         = field(
	    default=snake_case_			,       metadata={'help': 'The input data dir. Should contain the .json files for the SQuAD task.'}						)
	lowerCAmelCase__         = field(
	    default=1_28			,       metadata={
	        'help': (
	            'The maximum total input sequence length after tokenization. Sequences longer '
	            'than this will be truncated, sequences shorter will be padded.'
	        )
	    }			,       )
	lowerCAmelCase__         = field(
	    default=1_28			,       metadata={'help': 'When splitting up a long document into chunks, how much stride to take between chunks.'}			,       )
	lowerCAmelCase__         = field(
	    default=64			,       metadata={
	        'help': (
	            'The maximum number of tokens for the question. Questions longer than this will '
	            'be truncated to this length.'
	        )
	    }			,       )
	lowerCAmelCase__         = field(
	    default=30			,       metadata={
	        'help': (
	            'The maximum length of an answer that can be generated. This is needed because the start '
	            'and end predictions are not conditioned on one another.'
	        )
	    }			,       )
	lowerCAmelCase__         = field(
	    default=snake_case_			,       metadata={'help': 'Overwrite the cached training and evaluation sets'}						)
	lowerCAmelCase__         = field(
	    default=snake_case_			,       metadata={'help': 'If true, the SQuAD examples contain some that do not have an answer.'}						)
	lowerCAmelCase__         = field(
	    default=0.0			,       metadata={'help': 'If null_score - best_non_null is greater than the threshold predict null.'}						)
	lowerCAmelCase__         = field(
	    default=20			,       metadata={'help': 'If null_score - best_non_null is greater than the threshold predict null.'}						)
	lowerCAmelCase__         = field(
	    default=0			,       metadata={
	        'help': (
	            'language id of input for language-specific xlm models (see'
	            ' tokenization_xlm.PRETRAINED_INIT_CONFIGURATION)'
	        )
	    }			,       )
	lowerCAmelCase__         = field(default=1			,       metadata={'help': 'multiple threads for converting example to features'}						)




class     _SCREAMING_SNAKE_CASE     (      snake_case_						):
	lowerCAmelCase__         = 'train'
	lowerCAmelCase__         = 'dev'




class     _SCREAMING_SNAKE_CASE     (      snake_case_						):
	lowerCAmelCase__         = 42
	lowerCAmelCase__         = 42
	lowerCAmelCase__         = 42
	lowerCAmelCase__         = 42



	def __init__(    self						,  lowercase						,  lowercase						,  lowercase = None						,  lowercase = Split.train						,  lowercase = False						,  lowercase = None						,  lowercase = "pt"						,  )				->       List[str]:
					lowerCamelCase_						=			args
					lowerCamelCase_						=			is_language_sensitive
					lowerCamelCase_						=			SquadVaProcessor() if args.version_2_with_negative else SquadVaProcessor()
					if isinstance(lowercase						,  lowercase ):
									try:
													lowerCamelCase_						=			Split[mode]
									except KeyError:
													raise KeyError("mode is not a valid split name" )
					lowerCamelCase_						=			mode
					# Load data features from cache or dataset file
					lowerCamelCase_						=			"v2" if args.version_2_with_negative else "v1"
					lowerCamelCase_						=			os.path.join(
					    cache_dir if cache_dir is not None else args.data_dir						,  f'cached_{mode.value}_{tokenizer.__class__.__name__}_{args.max_seq_length}_{version_tag}'						,  )

					# Make sure only the first process in distributed training processes the dataset,
					# and the others will use the cache.
					lowerCamelCase_						=			cached_features_file + ".lock"
					with FileLock(lowercase ):
									if os.path.exists(lowercase ) and not args.overwrite_cache:
													lowerCamelCase_						=			time.time()
													lowerCamelCase_						=			torch.load(lowercase )

													# Legacy cache files have only features, while new cache files
													# will have dataset and examples also.
													lowerCamelCase_						=			self.old_features["features"]
													lowerCamelCase_						=			self.old_features.get("dataset"						,  lowercase )
													lowerCamelCase_						=			self.old_features.get("examples"						,  lowercase )
													logger.info(
													    f'Loading features from cached file {cached_features_file} [took %.3f s]'						,  time.time() - start )

													if self.dataset is None or self.examples is None:
																	logger.warning(
																	    f'Deleting cached file {cached_features_file} will allow dataset and examples to be cached in'
																	    " future run" )
									else:
													if mode == Split.dev:
																	lowerCamelCase_						=			self.processor.get_dev_examples(args.data_dir )
													else:
																	lowerCamelCase_						=			self.processor.get_train_examples(args.data_dir )

													lowerCamelCase_	,    lowerCamelCase_						=			squad_convert_examples_to_features(
													    examples=self.examples						,  tokenizer=lowercase						,  max_seq_length=args.max_seq_length						,  doc_stride=args.doc_stride						,  max_query_length=args.max_query_length						,  is_training=mode == Split.train						,  threads=args.threads						,  return_dataset=lowercase						,  )

													lowerCamelCase_						=			time.time()
													torch.save(
													    {"features": self.features, "dataset": self.dataset, "examples": self.examples}						,  lowercase						,  )
													# ^ This seems to take a lot of time so I want to investigate why and how we can improve.
													logger.info(
													    f'Saving features into cached file {cached_features_file} [took {time.time() - start:.3f} s]' )



	def __len__(    self )				->       Tuple:
					return len(self.features )



	def __getitem__(    self						,  lowercase )				->       Dict[str, torch.Tensor]:
					# Convert to Tensors and build dataset
					lowerCamelCase_						=			self.features[i]

					lowerCamelCase_						=			torch.tensor(feature.input_ids						,  dtype=torch.long )
					lowerCamelCase_						=			torch.tensor(feature.attention_mask						,  dtype=torch.long )
					lowerCamelCase_						=			torch.tensor(feature.token_type_ids						,  dtype=torch.long )
					lowerCamelCase_						=			torch.tensor(feature.cls_index						,  dtype=torch.long )
					lowerCamelCase_						=			torch.tensor(feature.p_mask						,  dtype=torch.float )
					lowerCamelCase_						=			torch.tensor(feature.is_impossible						,  dtype=torch.float )

					lowerCamelCase_						=			{
					    "input_ids": input_ids,
					    "attention_mask": attention_mask,
					    "token_type_ids": token_type_ids,
					}

					if self.args.model_type in ["xlm", "roberta", "distilbert", "camembert"]:
									del inputs["token_type_ids"]

					if self.args.model_type in ["xlnet", "xlm"]:
									inputs.update({"cls_index": cls_index, "p_mask": p_mask} )
									if self.args.version_2_with_negative:
													inputs.update({"is_impossible": is_impossible} )
									if self.is_language_sensitive:
													inputs.update({"langs": (torch.ones(input_ids.shape						,  dtype=torch.intaa ) * self.args.lang_id)} )

					if self.mode == Split.train:
									lowerCamelCase_						=			torch.tensor(feature.start_position						,  dtype=torch.long )
									lowerCamelCase_						=			torch.tensor(feature.end_position						,  dtype=torch.long )
									inputs.update({"start_positions": start_positions, "end_positions": end_positions} )

					return inputs


