






import json
import os
import pickle
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import patch

import numpy as np
from datasets import Dataset

from transformers import is_faiss_available
from transformers.models.bart.configuration_bart import BartConfig
from transformers.models.bart.tokenization_bart import BartTokenizer
from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES as DPR_VOCAB_FILES_NAMES
from transformers.models.dpr.configuration_dpr import DPRConfig
from transformers.models.dpr.tokenization_dpr import DPRContextEncoderTokenizer, DPRQuestionEncoderTokenizer
from transformers.models.rag.configuration_rag import RagConfig
from transformers.models.rag.retrieval_rag import CustomHFIndex, RagRetriever
from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES as BART_VOCAB_FILES_NAMES
from transformers.testing_utils import require_faiss, require_sentencepiece, require_tokenizers, require_torch


if is_faiss_available():
				import faiss





@require_faiss
class 						SCREAMING_SNAKE_CASE				( snake_case					):





							"""simple docstring"""

							def       __A (  self:   Optional[Any]   )    ->				int:
												_A								= tempfile.mkdtemp()
												_A								= 8

												# DPR tok
												_A								= [
												    '''[UNK]''',
												    '''[CLS]''',
												    '''[SEP]''',
												    '''[PAD]''',
												    '''[MASK]''',
												    '''want''',
												    '''##want''',
												    '''##ed''',
												    '''wa''',
												    '''un''',
												    '''runn''',
												    '''##ing''',
												    ''',''',
												    '''low''',
												    '''lowest''',
												]
												_A								= os.path.join(self.tmpdirname		,     '''dpr_tokenizer'''   )
												os.makedirs(__A		,     exist_ok=__A   )
												_A								= os.path.join(__A		,     DPR_VOCAB_FILES_NAMES['''vocab_file''']   )
												with open(self.vocab_file		,     '''w'''		,     encoding='''utf-8'''   ) as vocab_writer:
																	vocab_writer.write(''''''.join([x + '''\n''' for x in vocab_tokens]   )   )

												# BART tok
												_A								= [
												    '''l''',
												    '''o''',
												    '''w''',
												    '''e''',
												    '''r''',
												    '''s''',
												    '''t''',
												    '''i''',
												    '''d''',
												    '''n''',
												    '''\u0120''',
												    '''\u0120l''',
												    '''\u0120n''',
												    '''\u0120lo''',
												    '''\u0120low''',
												    '''er''',
												    '''\u0120lowest''',
												    '''\u0120newer''',
												    '''\u0120wider''',
												    '''<unk>''',
												]
												_A								= dict(zip(__A		,     range(len(__A   )   )   )   )
												_A								= ['''#version: 0.2''', '''\u0120 l''', '''\u0120l o''', '''\u0120lo w''', '''e r''', '''''']
												_A								= {'''unk_token''': '''<unk>'''}

												_A								= os.path.join(self.tmpdirname		,     '''bart_tokenizer'''   )
												os.makedirs(__A		,     exist_ok=__A   )
												_A								= os.path.join(__A		,     BART_VOCAB_FILES_NAMES['''vocab_file''']   )
												_A								= os.path.join(__A		,     BART_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       __A (  self:   int   )    ->				DPRQuestionEncoderTokenizer:
												return DPRQuestionEncoderTokenizer.from_pretrained(os.path.join(self.tmpdirname		,     '''dpr_tokenizer'''   )   )

							def       __A (  self:   Union[str, Any]   )    ->				DPRContextEncoderTokenizer:
												return DPRContextEncoderTokenizer.from_pretrained(os.path.join(self.tmpdirname		,     '''dpr_tokenizer'''   )   )

							def       __A (  self:   int   )    ->				BartTokenizer:
												return BartTokenizer.from_pretrained(os.path.join(self.tmpdirname		,     '''bart_tokenizer'''   )   )

							def       __A (  self:   Dict   )    ->				str:
												shutil.rmtree(self.tmpdirname   )

							def       __A (  self:   int   )    ->				Dict:
												_A								= Dataset.from_dict(
												    {
												        '''id''': ['''0''', '''1'''],
												        '''text''': ['''foo''', '''bar'''],
												        '''title''': ['''Foo''', '''Bar'''],
												        '''embeddings''': [np.ones(self.retrieval_vector_size   ), 2 * np.ones(self.retrieval_vector_size   )],
												    }   )
												dataset.add_faiss_index('''embeddings'''		,     string_factory='''Flat'''		,     metric_type=faiss.METRIC_INNER_PRODUCT   )
												return dataset

							def       __A (  self:   Optional[Any]   )    ->				str:
												_A								= self.get_dummy_dataset()
												_A								= RagConfig(
												    retrieval_vector_size=self.retrieval_vector_size		,     question_encoder=DPRConfig().to_dict()		,     generator=BartConfig().to_dict()		,     )
												with patch('''transformers.models.rag.retrieval_rag.load_dataset'''   ) as mock_load_dataset:
																	_A								= dataset
																	_A								= RagRetriever(
																	    __A		,     question_encoder_tokenizer=self.get_dpr_tokenizer()		,     generator_tokenizer=self.get_bart_tokenizer()		,     )
												return retriever

							def       __A (  self:   Dict		,     __A:   bool   )    ->				int:
												_A								= self.get_dummy_dataset()
												_A								= RagConfig(
												    retrieval_vector_size=self.retrieval_vector_size		,     question_encoder=DPRConfig().to_dict()		,     generator=BartConfig().to_dict()		,     index_name='''custom'''		,     )
												if from_disk:
																	_A								= os.path.join(self.tmpdirname		,     '''dataset'''   )
																	_A								= os.path.join(self.tmpdirname		,     '''index.faiss'''   )
																	dataset.get_index('''embeddings'''   ).save(os.path.join(self.tmpdirname		,     '''index.faiss'''   )   )
																	dataset.drop_index('''embeddings'''   )
																	dataset.save_to_disk(os.path.join(self.tmpdirname		,     '''dataset'''   )   )
																	del dataset
																	_A								= RagRetriever(
																	    __A		,     question_encoder_tokenizer=self.get_dpr_tokenizer()		,     generator_tokenizer=self.get_bart_tokenizer()		,     )
												else:
																	_A								= RagRetriever(
																	    __A		,     question_encoder_tokenizer=self.get_dpr_tokenizer()		,     generator_tokenizer=self.get_bart_tokenizer()		,     index=CustomHFIndex(config.retrieval_vector_size		,     __A   )		,     )
												return retriever

							def       __A (  self:   Optional[Any]   )    ->				List[Any]:
												_A								= Dataset.from_dict(
												    {
												        '''id''': ['''0''', '''1'''],
												        '''text''': ['''foo''', '''bar'''],
												        '''title''': ['''Foo''', '''Bar'''],
												        '''embeddings''': [np.ones(self.retrieval_vector_size + 1   ), 2 * np.ones(self.retrieval_vector_size + 1   )],
												    }   )
												dataset.add_faiss_index('''embeddings'''		,     string_factory='''Flat'''		,     metric_type=faiss.METRIC_INNER_PRODUCT   )

												_A								= os.path.join(self.tmpdirname		,     '''hf_bert_base.hnswSQ8_correct_phi_128.c_index'''   )
												dataset.save_faiss_index('''embeddings'''		,     index_file_name + '''.index.dpr'''   )
												pickle.dump(dataset['''id''']		,     open(index_file_name + '''.index_meta.dpr'''		,     '''wb'''   )   )

												_A								= os.path.join(self.tmpdirname		,     '''psgs_w100.tsv.pkl'''   )
												_A								= {sample['''id''']: [sample['''text'''], sample['''title''']] for sample in dataset}
												pickle.dump(__A		,     open(__A		,     '''wb'''   )   )

												_A								= RagConfig(
												    retrieval_vector_size=self.retrieval_vector_size		,     question_encoder=DPRConfig().to_dict()		,     generator=BartConfig().to_dict()		,     index_name='''legacy'''		,     index_path=self.tmpdirname		,     )
												_A								= RagRetriever(
												    __A		,     question_encoder_tokenizer=self.get_dpr_tokenizer()		,     generator_tokenizer=self.get_bart_tokenizer()   )
												return retriever

							def       __A (  self:   Tuple   )    ->				Dict:
												_A								= 1
												_A								= self.get_dummy_canonical_hf_index_retriever()
												_A								= np.array(
												    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
												_A							,_A							,_A								= retriever.retrieve(__A		,     n_docs=__A   )
												self.assertEqual(retrieved_doc_embeds.shape		,     (2, n_docs, self.retrieval_vector_size)   )
												self.assertEqual(len(__A   )		,     2   )
												self.assertEqual(sorted(doc_dicts[0]   )		,     ['''embeddings''', '''id''', '''text''', '''title''']   )
												self.assertEqual(len(doc_dicts[0]['''id''']   )		,     __A   )
												self.assertEqual(doc_dicts[0]['''id'''][0]		,     '''1'''   )  # max inner product is reached with second doc
												self.assertEqual(doc_dicts[1]['''id'''][0]		,     '''0'''   )  # max inner product is reached with first doc
												self.assertListEqual(doc_ids.tolist()		,     [[1], [0]]   )

							def       __A (  self:   Optional[int]   )    ->				Dict:
												_A								= self.get_dummy_canonical_hf_index_retriever()
												with tempfile.TemporaryDirectory() as tmp_dirname:
																	with patch('''transformers.models.rag.retrieval_rag.load_dataset'''   ) as mock_load_dataset:
																						_A								= self.get_dummy_dataset()
																						retriever.save_pretrained(__A   )
																						_A								= RagRetriever.from_pretrained(__A   )
																						self.assertIsInstance(__A		,     __A   )
																						_A								= np.array(
																						    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
																						_A								= retriever.retrieve(__A		,     n_docs=1   )
																						self.assertTrue(out is not None   )

							def       __A (  self:   Any   )    ->				List[Any]:
												_A								= 1
												_A								= self.get_dummy_custom_hf_index_retriever(from_disk=__A   )
												_A								= np.array(
												    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
												_A							,_A							,_A								= retriever.retrieve(__A		,     n_docs=__A   )
												self.assertEqual(retrieved_doc_embeds.shape		,     (2, n_docs, self.retrieval_vector_size)   )
												self.assertEqual(len(__A   )		,     2   )
												self.assertEqual(sorted(doc_dicts[0]   )		,     ['''embeddings''', '''id''', '''text''', '''title''']   )
												self.assertEqual(len(doc_dicts[0]['''id''']   )		,     __A   )
												self.assertEqual(doc_dicts[0]['''id'''][0]		,     '''1'''   )  # max inner product is reached with second doc
												self.assertEqual(doc_dicts[1]['''id'''][0]		,     '''0'''   )  # max inner product is reached with first doc
												self.assertListEqual(doc_ids.tolist()		,     [[1], [0]]   )

							def       __A (  self:   str   )    ->				Dict:
												_A								= self.get_dummy_custom_hf_index_retriever(from_disk=__A   )
												with tempfile.TemporaryDirectory() as tmp_dirname:
																	retriever.save_pretrained(__A   )
																	_A								= RagRetriever.from_pretrained(__A   )
																	self.assertIsInstance(__A		,     __A   )
																	_A								= np.array(
																	    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
																	_A								= retriever.retrieve(__A		,     n_docs=1   )
																	self.assertTrue(out is not None   )

							def       __A (  self:   str   )    ->				List[str]:
												_A								= 1
												_A								= self.get_dummy_custom_hf_index_retriever(from_disk=__A   )
												_A								= np.array(
												    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
												_A							,_A							,_A								= retriever.retrieve(__A		,     n_docs=__A   )
												self.assertEqual(retrieved_doc_embeds.shape		,     (2, n_docs, self.retrieval_vector_size)   )
												self.assertEqual(len(__A   )		,     2   )
												self.assertEqual(sorted(doc_dicts[0]   )		,     ['''embeddings''', '''id''', '''text''', '''title''']   )
												self.assertEqual(len(doc_dicts[0]['''id''']   )		,     __A   )
												self.assertEqual(doc_dicts[0]['''id'''][0]		,     '''1'''   )  # max inner product is reached with second doc
												self.assertEqual(doc_dicts[1]['''id'''][0]		,     '''0'''   )  # max inner product is reached with first doc
												self.assertListEqual(doc_ids.tolist()		,     [[1], [0]]   )

							def       __A (  self:   int   )    ->				Optional[Any]:
												_A								= self.get_dummy_custom_hf_index_retriever(from_disk=__A   )
												with tempfile.TemporaryDirectory() as tmp_dirname:
																	retriever.save_pretrained(__A   )
																	_A								= RagRetriever.from_pretrained(__A   )
																	self.assertIsInstance(__A		,     __A   )
																	_A								= np.array(
																	    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
																	_A								= retriever.retrieve(__A		,     n_docs=1   )
																	self.assertTrue(out is not None   )

							def       __A (  self:   int   )    ->				str:
												_A								= 1
												_A								= self.get_dummy_legacy_index_retriever()
												_A								= np.array(
												    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
												_A							,_A							,_A								= retriever.retrieve(__A		,     n_docs=__A   )
												self.assertEqual(retrieved_doc_embeds.shape		,     (2, n_docs, self.retrieval_vector_size)   )
												self.assertEqual(len(__A   )		,     2   )
												self.assertEqual(sorted(doc_dicts[0]   )		,     ['''text''', '''title''']   )
												self.assertEqual(len(doc_dicts[0]['''text''']   )		,     __A   )
												self.assertEqual(doc_dicts[0]['''text'''][0]		,     '''bar'''   )  # max inner product is reached with second doc
												self.assertEqual(doc_dicts[1]['''text'''][0]		,     '''foo'''   )  # max inner product is reached with first doc
												self.assertListEqual(doc_ids.tolist()		,     [[1], [0]]   )

							def       __A (  self:   int   )    ->				List[Any]:
												_A								= self.get_dummy_legacy_index_retriever()
												with tempfile.TemporaryDirectory() as tmp_dirname:
																	retriever.save_pretrained(__A   )
																	_A								= RagRetriever.from_pretrained(__A   )
																	self.assertIsInstance(__A		,     __A   )
																	_A								= np.array(
																	    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
																	_A								= retriever.retrieve(__A		,     n_docs=1   )
																	self.assertTrue(out is not None   )

							@require_torch
							@require_tokenizers
							@require_sentencepiece
							def       __A (  self:   Union[str, Any]   )    ->				List[Any]:
												import torch

												_A								= 1
												_A								= self.get_dummy_canonical_hf_index_retriever()
												_A								= [[5, 7], [10, 11]]
												_A								= np.array(
												    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
												_A								= retriever(__A		,     __A		,     prefix=retriever.config.generator.prefix		,     n_docs=__A   )
												_A							,_A							,_A								= (
												    out['''context_input_ids'''],
												    out['''context_attention_mask'''],
												    out['''retrieved_doc_embeds'''],
												)
												self.assertEqual(retrieved_doc_embeds.shape		,     (2, n_docs, self.retrieval_vector_size)   )
												self.assertIsInstance(__A		,     __A   )
												self.assertIsInstance(__A		,     __A   )
												self.assertIsInstance(__A		,     np.ndarray   )

												_A								= retriever(
												    __A		,     __A		,     prefix=retriever.config.generator.prefix		,     n_docs=__A		,     return_tensors='''pt'''		,     )
												_A							,_A							,_A							,_A								= (  # noqa: F841
												    out['''context_input_ids'''],
												    out['''context_attention_mask'''],
												    out['''retrieved_doc_embeds'''],
												    out['''doc_ids'''],
												)
												self.assertEqual(retrieved_doc_embeds.shape		,     (2, n_docs, self.retrieval_vector_size)   )
												self.assertIsInstance(__A		,     torch.Tensor   )
												self.assertIsInstance(__A		,     torch.Tensor   )
												self.assertIsInstance(__A		,     torch.Tensor   )



							@require_torch
							@require_tokenizers
							@require_sentencepiece
							def       __A (  self:   int   )    ->				str:
												_A								= self.get_dpr_ctx_encoder_tokenizer()
												_A								= 1
												_A								= self.get_dummy_custom_hf_index_retriever(from_disk=__A   )
												retriever.set_ctx_encoder_tokenizer(__A   )

												_A								= [[5, 7], [10, 11]]
												_A								= np.array(
												    [np.ones(self.retrieval_vector_size   ), -np.ones(self.retrieval_vector_size   )]		,     dtype=np.floataa   )
												_A								= retriever(__A		,     __A		,     prefix=retriever.config.generator.prefix		,     n_docs=__A   )

												self.assertEqual(
												    len(__A   )		,     6   )  # check whether the retriever output consist of 6 attributes including tokenized docs
												self.assertEqual(
												    all(k in out for k in ('''tokenized_doc_ids''', '''tokenized_doc_attention_mask''')   )		,     __A   )  # check for doc token related keys in dictionary.











import logging
import os

import quant_trainer
import torch
from torch.utils.data import DataLoader

from transformers import Trainer, is_torch_tpu_available
from transformers.trainer_utils import PredictionOutput


__A      =				logging.getLogger(__name__)

if is_torch_tpu_available(check_device=False):
				import torch_xla.core.xla_model as xm
				import torch_xla.debug.metrics as met





class 						SCREAMING_SNAKE_CASE				( snake_case					):





							"""simple docstring"""

							def __init__(  self:   int		,     *__A:   str		,     __A:   List[Any]=None		,     __A:   Union[str, Any]=None		,     __A:   List[Any]=None		,     **__A:   int   )    ->				List[Any]:
												super().__init__(*__A		,     **__A   )
												_A								= eval_examples
												_A								= post_process_function
												_A								= quant_trainer_args
												_A								= 1_28  # default number of calibration samples

							def       __A (  self:   Union[str, Any]		,     __A:   List[Any]=None   )    ->				Optional[Any]:
												if calib_dataset is None and self.calib_dataset is None:
																	raise ValueError('''Trainer: calibration requires an calib_dataset.'''   )
												_A								= calib_dataset if calib_dataset is not None else self.calib_dataset

												_A								= self._remove_unused_columns(__A		,     description='''Calibration'''   )

												return DataLoader(
												    __A		,     batch_size=self.args.eval_batch_size		,     collate_fn=self.data_collator		,     drop_last=self.args.dataloader_drop_last		,     num_workers=self.args.dataloader_num_workers		,     pin_memory=self.args.dataloader_pin_memory		,     shuffle=__A		,     )

							def       __A (  self:   List[Any]		,     __A:   Any=None   )    ->				Optional[int]:
												_A								= self.train_dataset if calib_dataset is None else calib_dataset
												_A								= self.get_calib_dataloader(__A   )

												_A								= self.model
												quant_trainer.configure_model(__A		,     self.quant_trainer_args		,     calib=__A   )
												model.eval()
												quant_trainer.enable_calibration(__A   )

												logger.info('''***** Running calibration *****'''   )
												logger.info(f"""  Num examples = {self.calib_num}"""   )
												logger.info(f"""  Batch size = {calib_dataloader.batch_size}"""   )

												for step, inputs in enumerate(__A   ):
																	# Prediction step
																	_A							,_A							,_A								= self.prediction_step(__A		,     __A		,     prediction_loss_only=__A   )
																	if (step + 1) * calib_dataloader.batch_size >= self.calib_num:
																						break

												quant_trainer.finish_calibration(__A		,     self.quant_trainer_args   )
												_A								= model

							def       __A (  self:   Any		,     __A:   Dict=None		,     __A:   Tuple=None		,     __A:   List[Any]=None		,     __A:   str = "eval"   )    ->				int:
												_A								= self.eval_dataset if eval_dataset is None else eval_dataset
												_A								= self.get_eval_dataloader(__A   )
												_A								= self.eval_examples if eval_examples is None else eval_examples

												# Temporarily disable metric computation, we will do it in the loop here.
												_A								= self.compute_metrics
												_A								= None
												_A								= self.prediction_loop if self.args.use_legacy_prediction_loop else self.evaluation_loop
												try:
																	_A								= eval_loop(
																	    __A		,     description='''Evaluation'''		,     prediction_loss_only=True if compute_metrics is None else None		,     ignore_keys=__A		,     )
												finally:
																	_A								= compute_metrics

												if self.post_process_function is not None and self.compute_metrics is not None:
																	_A								= self.post_process_function(__A		,     __A		,     output.predictions   )
																	_A								= self.compute_metrics(__A   )

																	# Prefix all keys with metric_key_prefix + '_'
																	for key in list(metrics.keys()   ):
																						if not key.startswith(f"""{metric_key_prefix}_"""   ):
																											_A								= metrics.pop(__A   )

																	self.log(__A   )
												else:
																	_A								= {}

												if self.args.tpu_metrics_debug or self.args.debug:
																	# tpu-comment: Logging debug metrics for PyTorch/XLA (compile, execute times, ops, etc.)
																	xm.master_print(met.metrics_report()   )

												_A								= self.callback_handler.on_evaluate(self.args		,     self.state		,     self.control		,     __A   )
												return metrics

							def       __A (  self:   Union[str, Any]		,     __A:   Optional[int]		,     __A:   int		,     __A:   List[Any]=None		,     __A:   str = "test"   )    ->				Union[str, Any]:
												_A								= self.get_test_dataloader(__A   )

												# Temporarily disable metric computation, we will do it in the loop here.
												_A								= self.compute_metrics
												_A								= None
												_A								= self.prediction_loop if self.args.use_legacy_prediction_loop else self.evaluation_loop
												try:
																	_A								= eval_loop(
																	    __A		,     description='''Prediction'''		,     prediction_loss_only=True if compute_metrics is None else None		,     ignore_keys=__A		,     )
												finally:
																	_A								= compute_metrics

												if self.post_process_function is None or self.compute_metrics is None:
																	return output

												_A								= self.post_process_function(__A		,     __A		,     output.predictions		,     '''predict'''   )
												_A								= self.compute_metrics(__A   )

												# Prefix all keys with metric_key_prefix + '_'
												for key in list(metrics.keys()   ):
																	if not key.startswith(f"""{metric_key_prefix}_"""   ):
																						_A								= metrics.pop(__A   )

												return PredictionOutput(predictions=predictions.predictions		,     label_ids=predictions.label_ids		,     metrics=__A   )



							def       __A (  self:   Tuple		,     __A:   Optional[Any]="./"   )    ->				List[str]:
												_A								= self.eval_dataset
												_A								= self.get_eval_dataloader(__A   )

												_A								= next(iter(__A   )   )

												# saving device - to make it consistent
												_A								= torch.device('''cuda''' if torch.cuda.is_available() else '''cpu'''   )

												# convert to tuple
												_A								= tuple(v.to(__A   ) for k, v in batch.items()   )

												logger.info('''Converting model to be onnx compatible'''   )
												from pytorch_quantization.nn import TensorQuantizer

												_A								= True

												_A								= self.model.to(__A   )

												model.eval()
												model.float()

												_A								= model.module if hasattr(__A		,     '''module'''   ) else model
												quant_trainer.configure_model(__A		,     self.quant_trainer_args   )

												_A								= os.path.join(__A		,     '''model.onnx'''   )
												logger.info(f"""exporting model to {output_model_file}"""   )

												_A								= {0: '''batch_size''', 1: '''seq_len'''}

												torch.onnx.export(
												    __A		,     __A		,     __A		,     export_params=__A		,     opset_version=13		,     do_constant_folding=__A		,     input_names=['''input_ids''', '''attention_mask''', '''token_type_ids''']		,     output_names=['''output_start_logits''', '''output_end_logits''']		,     dynamic_axes={
												        '''input_ids''': axes,
												        '''attention_mask''': axes,
												        '''token_type_ids''': axes,
												        '''output_start_logits''': axes,
												        '''output_end_logits''': axes,
												    }		,     verbose=__A		,     )
												logger.info('''onnx export finished'''   )



