





import json
import os
import unittest

from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast
from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin



@require_tokenizers
class 					__snake_case	(  __SCREAMING_SNAKE_CASE			,     unittest.TestCase    ):


    '''simple docstring'''







    lowerCamelCase__    :		int				=	GPTaTokenizer
    lowerCamelCase__    :		Any				=	GPTaTokenizerFast
    lowerCamelCase__    :		Optional[int]				=	True
    lowerCamelCase__    :		int				=	{"""add_prefix_space""": True}
    lowerCamelCase__    :		List[str]				=	False



    def  lowercase_					(       self     ):





        '''simple docstring'''

        super().setUp()

        # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
        SCREAMING_SNAKE_CASE__											=			[
            '''l''',
            '''o''',
            '''w''',
            '''e''',
            '''r''',
            '''s''',
            '''t''',
            '''i''',
            '''d''',
            '''n''',
            '''\u0120''',
            '''\u0120l''',
            '''\u0120n''',
            '''\u0120lo''',
            '''\u0120low''',
            '''er''',
            '''\u0120lowest''',
            '''\u0120newer''',
            '''\u0120wider''',
            '''<unk>''',
            '''<|endoftext|>''',
        ]
        SCREAMING_SNAKE_CASE__											=			dict(zip(A_   ,				range(len(A_     )     )     )     )
        SCREAMING_SNAKE_CASE__											=			['''#version: 0.2''', '''\u0120 l''', '''\u0120l o''', '''\u0120lo w''', '''e r''', '''''']
        SCREAMING_SNAKE_CASE__											=			{'''unk_token''': '''<unk>'''}

        SCREAMING_SNAKE_CASE__											=			os.path.join(self.tmpdirname   ,				VOCAB_FILES_NAMES['''vocab_file''']     )
        SCREAMING_SNAKE_CASE__											=			os.path.join(self.tmpdirname   ,				VOCAB_FILES_NAMES['''merges_file''']     )
        with open(self.vocab_file   ,				'''w'''   ,				encoding='''utf-8'''     ) as fp:
            fp.write(json.dumps(A_     ) + '''\n'''     )
        with open(self.merges_file   ,				'''w'''   ,				encoding='''utf-8'''     ) as fp:
            fp.write('''\n'''.join(A_     )     )



    def  lowercase_					(       self   ,				**A_     ):





        '''simple docstring'''

        kwargs.update(self.special_tokens_map     )
        return GPTaTokenizer.from_pretrained(self.tmpdirname   ,				**A_     )



    def  lowercase_					(       self   ,				**A_     ):





        '''simple docstring'''

        kwargs.update(self.special_tokens_map     )
        return GPTaTokenizerFast.from_pretrained(self.tmpdirname   ,				**A_     )



    def  lowercase_					(       self   ,				A_     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			'''lower newer'''
        SCREAMING_SNAKE_CASE__											=			'''lower newer'''
        return input_text, output_text



    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			GPTaTokenizer(self.vocab_file   ,				self.merges_file   ,				**self.special_tokens_map     )
        SCREAMING_SNAKE_CASE__											=			'''lower newer'''
        SCREAMING_SNAKE_CASE__											=			['''\u0120low''', '''er''', '''\u0120''', '''n''', '''e''', '''w''', '''er''']
        SCREAMING_SNAKE_CASE__											=			tokenizer.tokenize(A_   ,				add_prefix_space=A_     )
        self.assertListEqual(A_   ,				A_     )

        SCREAMING_SNAKE_CASE__											=			tokens + [tokenizer.unk_token]
        SCREAMING_SNAKE_CASE__											=			[14, 15, 10, 9, 3, 2, 15, 19]
        self.assertListEqual(tokenizer.convert_tokens_to_ids(A_     )   ,				A_     )



    def  lowercase_					(       self     ):





        '''simple docstring'''

        if not self.test_rust_tokenizer:
            return

        SCREAMING_SNAKE_CASE__											=			self.get_tokenizer()
        SCREAMING_SNAKE_CASE__											=			self.get_rust_tokenizer(add_prefix_space=A_     )

        SCREAMING_SNAKE_CASE__											=			'''lower newer'''

        # Testing tokenization
        SCREAMING_SNAKE_CASE__											=			tokenizer.tokenize(A_   ,				add_prefix_space=A_     )
        SCREAMING_SNAKE_CASE__											=			rust_tokenizer.tokenize(A_     )
        self.assertListEqual(A_   ,				A_     )

        # Testing conversion to ids without special tokens
        SCREAMING_SNAKE_CASE__											=			tokenizer.encode(A_   ,				add_special_tokens=A_   ,				add_prefix_space=A_     )
        SCREAMING_SNAKE_CASE__											=			rust_tokenizer.encode(A_   ,				add_special_tokens=A_     )
        self.assertListEqual(A_   ,				A_     )

        # Testing conversion to ids with special tokens
        SCREAMING_SNAKE_CASE__											=			self.get_rust_tokenizer(add_prefix_space=A_     )
        SCREAMING_SNAKE_CASE__											=			tokenizer.encode(A_   ,				add_prefix_space=A_     )
        SCREAMING_SNAKE_CASE__											=			rust_tokenizer.encode(A_     )
        self.assertListEqual(A_   ,				A_     )

        # Testing the unknown token
        SCREAMING_SNAKE_CASE__											=			tokens + [rust_tokenizer.unk_token]
        SCREAMING_SNAKE_CASE__											=			[14, 15, 10, 9, 3, 2, 15, 19]
        self.assertListEqual(rust_tokenizer.convert_tokens_to_ids(A_     )   ,				A_     )



    def  lowercase_					(       self   ,				*A_   ,				**A_     ):





        '''simple docstring'''

        pass



    def  lowercase_					(       self   ,				A_=15     ):





        '''simple docstring'''

        for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
            with self.subTest(f'''{tokenizer.__class__.__name__} ({pretrained_name})'''     ):
                SCREAMING_SNAKE_CASE__											=			self.rust_tokenizer_class.from_pretrained(A_   ,				**A_     )

                # Simple input
                SCREAMING_SNAKE_CASE__											=			'''This is a simple input'''
                SCREAMING_SNAKE_CASE__											=			['''This is a simple input 1''', '''This is a simple input 2''']
                SCREAMING_SNAKE_CASE__											=			('''This is a simple input''', '''This is a pair''')
                SCREAMING_SNAKE_CASE__											=			[
                    ('''This is a simple input 1''', '''This is a simple input 2'''),
                    ('''This is a simple pair 1''', '''This is a simple pair 2'''),
                ]

                # Simple input tests
                self.assertRaises(A_   ,				tokenizer_r.encode   ,				A_   ,				max_length=A_   ,				padding='''max_length'''     )

                # Simple input
                self.assertRaises(A_   ,				tokenizer_r.encode_plus   ,				A_   ,				max_length=A_   ,				padding='''max_length'''     )

                # Simple input
                self.assertRaises(
                    A_   ,				tokenizer_r.batch_encode_plus   ,				A_   ,				max_length=A_   ,				padding='''max_length'''   ,				)

                # Pair input
                self.assertRaises(A_   ,				tokenizer_r.encode   ,				A_   ,				max_length=A_   ,				padding='''max_length'''     )

                # Pair input
                self.assertRaises(A_   ,				tokenizer_r.encode_plus   ,				A_   ,				max_length=A_   ,				padding='''max_length'''     )

                # Pair input
                self.assertRaises(
                    A_   ,				tokenizer_r.batch_encode_plus   ,				A_   ,				max_length=A_   ,				padding='''max_length'''   ,				)



    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			GPTaTokenizer.from_pretrained(self.tmpdirname   ,				pad_token='''<pad>'''     )

        # Simple input
        SCREAMING_SNAKE_CASE__											=			'''This is a simple input'''
        SCREAMING_SNAKE_CASE__											=			['''This is a simple input looooooooong''', '''This is a simple input''']
        SCREAMING_SNAKE_CASE__											=			('''This is a simple input''', '''This is a pair''')
        SCREAMING_SNAKE_CASE__											=			[
            ('''This is a simple input loooooong''', '''This is a simple input'''),
            ('''This is a simple pair loooooong''', '''This is a simple pair'''),
        ]

        SCREAMING_SNAKE_CASE__											=			tokenizer.pad_token_id

        SCREAMING_SNAKE_CASE__											=			tokenizer(A_   ,				padding='''max_length'''   ,				max_length=30   ,				return_tensors='''np'''     )
        SCREAMING_SNAKE_CASE__											=			tokenizer(A_   ,				padding=A_   ,				truncate=A_   ,				return_tensors='''np'''     )
        SCREAMING_SNAKE_CASE__											=			tokenizer(*A_   ,				padding='''max_length'''   ,				max_length=60   ,				return_tensors='''np'''     )
        SCREAMING_SNAKE_CASE__											=			tokenizer(A_   ,				padding=A_   ,				truncate=A_   ,				return_tensors='''np'''     )

        # s
        # test single string max_length padding
        self.assertEqual(out_s['''input_ids'''].shape[-1]   ,				30     )
        self.assertTrue(pad_token_id in out_s['''input_ids''']     )
        self.assertTrue(0 in out_s['''attention_mask''']     )

        # s2
        # test automatic padding
        self.assertEqual(out_sa['''input_ids'''].shape[-1]   ,				33     )
        # long slice doesn't have padding
        self.assertFalse(pad_token_id in out_sa['''input_ids'''][0]     )
        self.assertFalse(0 in out_sa['''attention_mask'''][0]     )
        # short slice does have padding
        self.assertTrue(pad_token_id in out_sa['''input_ids'''][1]     )
        self.assertTrue(0 in out_sa['''attention_mask'''][1]     )

        # p
        # test single pair max_length padding
        self.assertEqual(out_p['''input_ids'''].shape[-1]   ,				60     )
        self.assertTrue(pad_token_id in out_p['''input_ids''']     )
        self.assertTrue(0 in out_p['''attention_mask''']     )

        # p2
        # test automatic padding pair
        self.assertEqual(out_pa['''input_ids'''].shape[-1]   ,				52     )
        # long slice pair doesn't have padding
        self.assertFalse(pad_token_id in out_pa['''input_ids'''][0]     )
        self.assertFalse(0 in out_pa['''attention_mask'''][0]     )
        # short slice pair does have padding
        self.assertTrue(pad_token_id in out_pa['''input_ids'''][1]     )
        self.assertTrue(0 in out_pa['''attention_mask'''][1]     )



    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			'''$$$'''
        SCREAMING_SNAKE_CASE__											=			GPTaTokenizer.from_pretrained(self.tmpdirname   ,				bos_token=A_   ,				add_bos_token=A_     )

        SCREAMING_SNAKE_CASE__											=			'''This is a simple input'''
        SCREAMING_SNAKE_CASE__											=			['''This is a simple input 1''', '''This is a simple input 2''']

        SCREAMING_SNAKE_CASE__											=			tokenizer.bos_token_id

        SCREAMING_SNAKE_CASE__											=			tokenizer(A_     )
        SCREAMING_SNAKE_CASE__											=			tokenizer(A_     )

        self.assertEqual(out_s.input_ids[0]   ,				A_     )
        self.assertTrue(all(o[0] == bos_token_id for o in out_sa.input_ids     )     )

        SCREAMING_SNAKE_CASE__											=			tokenizer.decode(out_s.input_ids     )
        SCREAMING_SNAKE_CASE__											=			tokenizer.batch_decode(out_sa.input_ids     )

        self.assertEqual(decode_s.split()[0]   ,				A_     )
        self.assertTrue(all(d.split()[0] == bos_token for d in decode_sa     )     )



    def  lowercase_					(       self     ):





        '''simple docstring'''

        pass




    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			[self.get_tokenizer(do_lower_case=A_   ,				add_bos_token=A_     )]
        for tokenizer in tokenizers:
            with self.subTest(f'''{tokenizer.__class__.__name__}'''     ):
                SCREAMING_SNAKE_CASE__											=			'''Encode this.'''
                SCREAMING_SNAKE_CASE__											=			'''This one too please.'''
                SCREAMING_SNAKE_CASE__											=			tokenizer.encode(A_   ,				add_special_tokens=A_     )
                encoded_sequence += tokenizer.encode(A_   ,				add_special_tokens=A_     )
                SCREAMING_SNAKE_CASE__											=			tokenizer.encode_plus(
                    A_   ,				A_   ,				add_special_tokens=A_   ,				return_special_tokens_mask=A_   ,				)
                SCREAMING_SNAKE_CASE__											=			encoded_sequence_dict['''input_ids''']
                SCREAMING_SNAKE_CASE__											=			encoded_sequence_dict['''special_tokens_mask''']
                self.assertEqual(len(A_     )   ,				len(A_     )     )

                SCREAMING_SNAKE_CASE__											=			[
                    (x if not special_tokens_mask[i] else None) for i, x in enumerate(A_     )
                ]
                SCREAMING_SNAKE_CASE__											=			[x for x in filtered_sequence if x is not None]
                self.assertEqual(A_   ,				A_     )





@require_tokenizers
class 					__snake_case	(  unittest.TestCase    ):


    '''simple docstring'''







    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			AutoTokenizer.from_pretrained('''facebook/opt-350m'''   ,				from_slow=A_     )
        SCREAMING_SNAKE_CASE__											=			'''A photo of a cat'''

        SCREAMING_SNAKE_CASE__											=			tokenizer.encode(
            A_   ,				)
        self.assertEqual(A_   ,				[2, 2_50, 13_45, 9, 10, 47_58]     )
        tokenizer.save_pretrained('''test_opt'''     )

        SCREAMING_SNAKE_CASE__											=			AutoTokenizer.from_pretrained('''./test_opt'''     )
        SCREAMING_SNAKE_CASE__											=			tokenizer.encode(
            A_   ,				)
        self.assertEqual(A_   ,				[2, 2_50, 13_45, 9, 10, 47_58]     )



    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			AutoTokenizer.from_pretrained('''facebook/opt-350m'''   ,				use_slow=A_     )
        SCREAMING_SNAKE_CASE__											=			'''A photo of a cat'''

        SCREAMING_SNAKE_CASE__											=			tokenizer.encode(
            A_   ,				)
        # Same as above
        self.assertEqual(A_   ,				[2, 2_50, 13_45, 9, 10, 47_58]     )




    @unittest.skip('''This test is failing because of a bug in the fast tokenizer'''     )
    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			AutoTokenizer.from_pretrained('''facebook/opt-350m'''   ,				from_slow=A_     )

        SCREAMING_SNAKE_CASE__											=			'''bos'''
        SCREAMING_SNAKE_CASE__											=			tokenizer.get_vocab()['''bos''']

        SCREAMING_SNAKE_CASE__											=			'''A photo of a cat'''
        SCREAMING_SNAKE_CASE__											=			tokenizer.encode(
            A_   ,				)
        # We changed the bos token
        self.assertEqual(A_   ,				[3_19_57, 2_50, 13_45, 9, 10, 47_58]     )
        tokenizer.save_pretrained('''./tok'''     )
        SCREAMING_SNAKE_CASE__											=			AutoTokenizer.from_pretrained('''./tok'''     )
        self.assertTrue(tokenizer.is_fast     )
        SCREAMING_SNAKE_CASE__											=			tokenizer.encode(
            A_   ,				)
        self.assertEqual(A_   ,				[3_19_57, 2_50, 13_45, 9, 10, 47_58]     )


'''simple docstring'''



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


_lowercase          =						logging.get_logger(__name__)

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




@dataclass
class     UpperCAmelCase_	:






						'''simple docstring'''






						_lowercase						: str										=  field(
						    default=_SCREAMING_SNAKE_CASE			,				metadata={'''help''': '''Model type selected in the list: ''' + ''', '''.join(_SCREAMING_SNAKE_CASE					)}					)
						_lowercase						: str										=  field(
						    default=_SCREAMING_SNAKE_CASE			,				metadata={'''help''': '''The input data dir. Should contain the .json files for the SQuAD task.'''}					)
						_lowercase						: int										=  field(
						    default=1_2_8			,				metadata={
						        '''help''': (
						            '''The maximum total input sequence length after tokenization. Sequences longer '''
						            '''than this will be truncated, sequences shorter will be padded.'''
						        )
						    }			,				)
						_lowercase						: int										=  field(
						    default=1_2_8			,				metadata={'''help''': '''When splitting up a long document into chunks, how much stride to take between chunks.'''}			,				)
						_lowercase						: int										=  field(
						    default=6_4			,				metadata={
						        '''help''': (
						            '''The maximum number of tokens for the question. Questions longer than this will '''
						            '''be truncated to this length.'''
						        )
						    }			,				)
						_lowercase						: int										=  field(
						    default=3_0			,				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.'''
						        )
						    }			,				)
						_lowercase						: bool										=  field(
						    default=_SCREAMING_SNAKE_CASE			,				metadata={'''help''': '''Overwrite the cached training and evaluation sets'''}					)
						_lowercase						: bool										=  field(
						    default=_SCREAMING_SNAKE_CASE			,				metadata={'''help''': '''If true, the SQuAD examples contain some that do not have an answer.'''}					)
						_lowercase						: float										=  field(
						    default=0.0			,				metadata={'''help''': '''If null_score - best_non_null is greater than the threshold predict null.'''}					)
						_lowercase						: int										=  field(
						    default=2_0			,				metadata={'''help''': '''If null_score - best_non_null is greater than the threshold predict null.'''}					)
						_lowercase						: int										=  field(
						    default=0			,				metadata={
						        '''help''': (
						            '''language id of input for language-specific xlm models (see'''
						            ''' tokenization_xlm.PRETRAINED_INIT_CONFIGURATION)'''
						        )
						    }			,				)
						_lowercase						: int										=  field(default=1			,				metadata={'''help''': '''multiple threads for converting example to features'''}					)






class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: str										=  '''train'''
						_lowercase						: Union[str, Any]										=  '''dev'''






class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: SquadDataTrainingArguments
						_lowercase						: List[SquadFeatures]
						_lowercase						: Split
						_lowercase						: bool




						def __init__(   self       ,  _lowercase       ,  _lowercase       ,  _lowercase = None       ,  _lowercase = Split.train       ,  _lowercase = False       ,  _lowercase = None       ,  _lowercase = "pt"       ,  ):

												"""simple docstring"""



												_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 ):

												"""simple docstring"""



												return len(self.features )




						def __getitem__(   self       ,  _lowercase ):

												"""simple docstring"""



												_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
