



'''simple docstring'''







from typing import Optional, Tuple

import flax.linen as nn
import jax
import jax.numpy as jnp
from configuration_hybrid_clip import HybridCLIPConfig
from flax.core.frozen_dict import FrozenDict

from transformers import FLAX_MODEL_MAPPING, FlaxCLIPVisionModel
from transformers.modeling_flax_utils import FlaxPreTrainedModel
from transformers.models.clip.modeling_flax_clip import FlaxCLIPOutput
from transformers.utils import logging


SCREAMING_SNAKE_CASE__     : List[Any]				=   logging.get_logger(__name__)




class 				__lowerCAmelCase(							nn.Module      ):
			__snake_case  :		Tuple		=      4_2
			__snake_case  :		Dict		=      jnp.floataa






			def 				_lowercase	(   self  :							Optional[Any]	):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      self.config.text_config
					SCREAMING_SNAKE_CASE_						:Tuple										=      self.config.vision_config

					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      self.config.projection_dim
					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      text_config.hidden_size
					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      vision_config.hidden_size

					SCREAMING_SNAKE_CASE_						:int										=      FLAX_MODEL_MAPPING[self.config.text_config.__class__].module_class
					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      FLAX_MODEL_MAPPING.get(self.config.vision_config.__class__      ,       SCREAMING_SNAKE_CASE__	).module_class

					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      text_module(SCREAMING_SNAKE_CASE__      ,       dtype=self.dtype	)
					SCREAMING_SNAKE_CASE_						:List[Any]										=      vision_module(SCREAMING_SNAKE_CASE__      ,       dtype=self.dtype	)

					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      nn.Dense(
					    self.projection_dim      ,       dtype=self.dtype      ,       kernel_init=jax.nn.initializers.normal(0.02	)      ,       use_bias=SCREAMING_SNAKE_CASE__      ,       )
					SCREAMING_SNAKE_CASE_						:int										=      nn.Dense(
					    self.projection_dim      ,       dtype=self.dtype      ,       kernel_init=jax.nn.initializers.normal(0.02	)      ,       use_bias=SCREAMING_SNAKE_CASE__      ,       )
					SCREAMING_SNAKE_CASE_						:Dict										=      self.param('logit_scale'      ,       jax.nn.initializers.ones      ,       []	)






			def __call__(   self  :							Any      ,       SCREAMING_SNAKE_CASE  :							int=None      ,       SCREAMING_SNAKE_CASE  :							int=None      ,       SCREAMING_SNAKE_CASE  :							Any=None      ,       SCREAMING_SNAKE_CASE  :							Tuple=None      ,       SCREAMING_SNAKE_CASE  :							Tuple=None      ,       SCREAMING_SNAKE_CASE  :							str = True      ,       SCREAMING_SNAKE_CASE  :							int=None      ,       SCREAMING_SNAKE_CASE  :							str=None      ,       SCREAMING_SNAKE_CASE  :							int=None      ,       ):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:str										=      return_dict if return_dict is not None else self.config.return_dict

					SCREAMING_SNAKE_CASE_						:Dict										=      self.vision_model(
					    pixel_values=SCREAMING_SNAKE_CASE__      ,       deterministic=SCREAMING_SNAKE_CASE__      ,       output_attentions=SCREAMING_SNAKE_CASE__      ,       output_hidden_states=SCREAMING_SNAKE_CASE__      ,       return_dict=SCREAMING_SNAKE_CASE__      ,       )

					SCREAMING_SNAKE_CASE_						:str										=      self.text_model(
					    input_ids=SCREAMING_SNAKE_CASE__      ,       attention_mask=SCREAMING_SNAKE_CASE__      ,       token_type_ids=SCREAMING_SNAKE_CASE__      ,       position_ids=SCREAMING_SNAKE_CASE__      ,       deterministic=SCREAMING_SNAKE_CASE__      ,       output_attentions=SCREAMING_SNAKE_CASE__      ,       output_hidden_states=SCREAMING_SNAKE_CASE__      ,       return_dict=SCREAMING_SNAKE_CASE__      ,       )

					SCREAMING_SNAKE_CASE_						:Dict										=      vision_outputs[1]
					SCREAMING_SNAKE_CASE_						:Dict										=      self.visual_projection(SCREAMING_SNAKE_CASE__	)

					SCREAMING_SNAKE_CASE_						:int										=      text_outputs[1]
					SCREAMING_SNAKE_CASE_						:List[str]										=      self.text_projection(SCREAMING_SNAKE_CASE__	)

					# normalized features
					SCREAMING_SNAKE_CASE_						:List[Any]										=      image_embeds / jnp.linalg.norm(SCREAMING_SNAKE_CASE__      ,       axis=-1      ,       keepdims=SCREAMING_SNAKE_CASE__	)
					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      text_embeds / jnp.linalg.norm(SCREAMING_SNAKE_CASE__      ,       axis=-1      ,       keepdims=SCREAMING_SNAKE_CASE__	)

					# cosine similarity as logits
					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      jnp.exp(self.logit_scale	)
					SCREAMING_SNAKE_CASE_						:int										=      jnp.matmul(SCREAMING_SNAKE_CASE__      ,       image_embeds.T	) * logit_scale
					SCREAMING_SNAKE_CASE_						:Any										=      logits_per_text.T

					if not return_dict:
							return (logits_per_image, logits_per_text, text_embeds, image_embeds, text_outputs, vision_outputs)

					return FlaxCLIPOutput(
					    logits_per_image=SCREAMING_SNAKE_CASE__      ,       logits_per_text=SCREAMING_SNAKE_CASE__      ,       text_embeds=SCREAMING_SNAKE_CASE__      ,       image_embeds=SCREAMING_SNAKE_CASE__      ,       text_model_output=SCREAMING_SNAKE_CASE__      ,       vision_model_output=SCREAMING_SNAKE_CASE__      ,       )




class 				__lowerCAmelCase(							__a      ):
			__snake_case  :		Tuple		=      HybridCLIPConfig
			__snake_case  :		Tuple		=      FlaxHybridCLIPModule






			def __init__(   self  :							Dict      ,       SCREAMING_SNAKE_CASE  :							Union[str, Any]      ,       SCREAMING_SNAKE_CASE  :							Optional[Any] = None      ,       SCREAMING_SNAKE_CASE  :							Any = 0      ,       SCREAMING_SNAKE_CASE  :							List[Any] = jnp.floataa      ,       **SCREAMING_SNAKE_CASE  :							int      ,       ):




					"""simple docstring"""







					if input_shape is None:
							SCREAMING_SNAKE_CASE_						:str										=      ((1, 1), (1, config.vision_config.image_size, config.vision_config.image_size, 3))

					SCREAMING_SNAKE_CASE_						:Any										=      self.module_class(config=SCREAMING_SNAKE_CASE__      ,       dtype=SCREAMING_SNAKE_CASE__      ,       **SCREAMING_SNAKE_CASE__	)
					super().__init__(SCREAMING_SNAKE_CASE__      ,       SCREAMING_SNAKE_CASE__      ,       input_shape=SCREAMING_SNAKE_CASE__      ,       seed=SCREAMING_SNAKE_CASE__      ,       dtype=SCREAMING_SNAKE_CASE__	)






			def 				_lowercase	(   self  :							Any      ,       SCREAMING_SNAKE_CASE  :							Union[str, Any]      ,       SCREAMING_SNAKE_CASE  :							List[Any]      ,       SCREAMING_SNAKE_CASE  :							Union[str, Any] = None	):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      jnp.zeros(input_shape[0]      ,       dtype='i4'	)
					SCREAMING_SNAKE_CASE_						:List[Any]										=      jnp.broadcast_to(jnp.arange(jnp.atleast_ad(SCREAMING_SNAKE_CASE__	).shape[-1]	)      ,       input_shape[0]	)
					SCREAMING_SNAKE_CASE_						:Dict										=      jnp.ones_like(SCREAMING_SNAKE_CASE__	)
					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      jnp.ones_like(SCREAMING_SNAKE_CASE__	)

					SCREAMING_SNAKE_CASE_						:List[Any]										=      jax.random.normal(SCREAMING_SNAKE_CASE__      ,       input_shape[1]	)

					SCREAMING_SNAKE_CASE_						,		SCREAMING_SNAKE_CASE_						:str										=      jax.random.split(SCREAMING_SNAKE_CASE__	)
					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      {'params': params_rng, 'dropout': dropout_rng}

					return self.module.init(SCREAMING_SNAKE_CASE__      ,       SCREAMING_SNAKE_CASE__      ,       SCREAMING_SNAKE_CASE__      ,       SCREAMING_SNAKE_CASE__      ,       SCREAMING_SNAKE_CASE__      ,       SCREAMING_SNAKE_CASE__	)["params"]






			def __call__(   self  :							Optional[Any]      ,       SCREAMING_SNAKE_CASE  :							List[str]      ,       SCREAMING_SNAKE_CASE  :							List[Any]      ,       SCREAMING_SNAKE_CASE  :							Optional[Any]=None      ,       SCREAMING_SNAKE_CASE  :							Tuple=None      ,       SCREAMING_SNAKE_CASE  :							List[Any]=None      ,       SCREAMING_SNAKE_CASE  :							Dict = None      ,       SCREAMING_SNAKE_CASE  :							Any = None      ,       SCREAMING_SNAKE_CASE  :							List[Any] = False      ,       SCREAMING_SNAKE_CASE  :							int = None      ,       SCREAMING_SNAKE_CASE  :							str = None      ,       SCREAMING_SNAKE_CASE  :							List[Any] = None      ,       ):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:int										=      output_attentions if output_attentions is not None else self.config.output_attentions
					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      (
					    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
					)
					SCREAMING_SNAKE_CASE_						:List[Any]										=      return_dict if return_dict is not None else self.config.return_dict

					if position_ids is None:
							SCREAMING_SNAKE_CASE_						:int										=      jnp.broadcast_to(jnp.arange(jnp.atleast_ad(SCREAMING_SNAKE_CASE__	).shape[-1]	)      ,       input_ids.shape	)

					if token_type_ids is None:
							SCREAMING_SNAKE_CASE_						:Optional[int]										=      jnp.zeros_like(SCREAMING_SNAKE_CASE__	)

					if attention_mask is None:
							SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      jnp.ones_like(SCREAMING_SNAKE_CASE__	)

					# Handle any PRNG if needed
					SCREAMING_SNAKE_CASE_						:List[Any]										=      {}
					if dropout_rng is not None:
							SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      dropout_rng

					return self.module.apply(
					    {'params': params or self.params}      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype='i4'	)      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype=jnp.floataa	)      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype='i4'	)      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype='i4'	)      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype='i4'	)      ,       not train      ,       SCREAMING_SNAKE_CASE__      ,       SCREAMING_SNAKE_CASE__      ,       SCREAMING_SNAKE_CASE__      ,       rngs=SCREAMING_SNAKE_CASE__      ,       )






			def 				_lowercase	(   self  :							str      ,       SCREAMING_SNAKE_CASE  :							Union[str, Any]      ,       SCREAMING_SNAKE_CASE  :							List[str]=None      ,       SCREAMING_SNAKE_CASE  :							List[str]=None      ,       SCREAMING_SNAKE_CASE  :							int=None      ,       SCREAMING_SNAKE_CASE  :							Union[str, Any] = None      ,       SCREAMING_SNAKE_CASE  :							Dict = None      ,       SCREAMING_SNAKE_CASE  :							Union[str, Any]=False      ,       ):




					"""simple docstring"""







					if position_ids is None:
							SCREAMING_SNAKE_CASE_						:Tuple										=      jnp.broadcast_to(jnp.arange(jnp.atleast_ad(SCREAMING_SNAKE_CASE__	).shape[-1]	)      ,       input_ids.shape	)

					if token_type_ids is None:
							SCREAMING_SNAKE_CASE_						:List[Any]										=      jnp.zeros_like(SCREAMING_SNAKE_CASE__	)

					if attention_mask is None:
							SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      jnp.ones_like(SCREAMING_SNAKE_CASE__	)

					# Handle any PRNG if needed
					SCREAMING_SNAKE_CASE_						:str										=      {}
					if dropout_rng is not None:
							SCREAMING_SNAKE_CASE_						:List[str]										=      dropout_rng

					def _get_features(SCREAMING_SNAKE_CASE  :							int      ,       SCREAMING_SNAKE_CASE  :							Optional[Any]      ,       SCREAMING_SNAKE_CASE  :							Any      ,       SCREAMING_SNAKE_CASE  :							Optional[int]      ,       SCREAMING_SNAKE_CASE  :							List[str]      ,       SCREAMING_SNAKE_CASE  :							Optional[Any]	):
							SCREAMING_SNAKE_CASE_						:Dict										=      module.text_model(
							    input_ids=SCREAMING_SNAKE_CASE__      ,       attention_mask=SCREAMING_SNAKE_CASE__      ,       position_ids=SCREAMING_SNAKE_CASE__      ,       token_type_ids=SCREAMING_SNAKE_CASE__      ,       deterministic=SCREAMING_SNAKE_CASE__      ,       )
							SCREAMING_SNAKE_CASE_						:int										=      text_outputs[1]
							SCREAMING_SNAKE_CASE_						:Tuple										=      module.text_projection(SCREAMING_SNAKE_CASE__	)
							return text_features

					return self.module.apply(
					    {'params': params or self.params}      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype='i4'	)      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype='i4'	)      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype='i4'	)      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype='i4'	)      ,       not train      ,       method=_get_features      ,       rngs=SCREAMING_SNAKE_CASE__      ,       )






			def 				_lowercase	(   self  :							Union[str, Any]      ,       SCREAMING_SNAKE_CASE  :							Any      ,       SCREAMING_SNAKE_CASE  :							Optional[int] = None      ,       SCREAMING_SNAKE_CASE  :							str = None      ,       SCREAMING_SNAKE_CASE  :							List[str]=False	):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:int										=      {}
					if dropout_rng is not None:
							SCREAMING_SNAKE_CASE_						:List[Any]										=      dropout_rng

					def _get_features(SCREAMING_SNAKE_CASE  :							List[str]      ,       SCREAMING_SNAKE_CASE  :							Union[str, Any]      ,       SCREAMING_SNAKE_CASE  :							Tuple	):
							SCREAMING_SNAKE_CASE_						:Tuple										=      module.vision_model(pixel_values=SCREAMING_SNAKE_CASE__      ,       deterministic=SCREAMING_SNAKE_CASE__	)
							SCREAMING_SNAKE_CASE_						:Dict										=      vision_outputs[1]  # pooled_output
							SCREAMING_SNAKE_CASE_						:Optional[Any]										=      module.visual_projection(SCREAMING_SNAKE_CASE__	)
							return image_features

					return self.module.apply(
					    {'params': params or self.params}      ,       jnp.array(SCREAMING_SNAKE_CASE__      ,       dtype=jnp.floataa	)      ,       not train      ,       method=_get_features      ,       rngs=SCREAMING_SNAKE_CASE__      ,       )






			@classmethod
			def 				_lowercase	(   cls  :							Dict      ,       SCREAMING_SNAKE_CASE  :							List[Any] = None      ,       SCREAMING_SNAKE_CASE  :							int = None      ,       *SCREAMING_SNAKE_CASE  :							Dict      ,       **SCREAMING_SNAKE_CASE  :							Dict      ,       ):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:Dict										=      {
					    argument[len('text_'	) :]: value for argument, value in kwargs.items() if argument.startswith('text_'	)
					}

					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      {
					    argument[len('vision_'	) :]: value for argument, value in kwargs.items() if argument.startswith('vision_'	)
					}

					# remove text, vision kwargs from kwargs
					for key in kwargs_text.keys():
							del kwargs["text_" + key]
					for key in kwargs_vision.keys():
							del kwargs["vision_" + key]

					# Load and initialize the text and vision model
					SCREAMING_SNAKE_CASE_						:List[Any]										=      kwargs_text.pop('model'      ,       SCREAMING_SNAKE_CASE__	)
					if text_model is None:
							assert (
							    text_model_name_or_path is not None
							), "If `model` is not defined as an argument, a `text_model_name_or_path` has to be defined"
							from transformers import FlaxAutoModel

							if "config" not in kwargs_text:
									from transformers import AutoConfig

									SCREAMING_SNAKE_CASE_						:str										=      AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__	)
									SCREAMING_SNAKE_CASE_						:str										=      text_config

							SCREAMING_SNAKE_CASE_						:Any										=      FlaxAutoModel.from_pretrained(SCREAMING_SNAKE_CASE__      ,       *SCREAMING_SNAKE_CASE__      ,       **SCREAMING_SNAKE_CASE__	)

					SCREAMING_SNAKE_CASE_						:Any										=      kwargs_vision.pop('model'      ,       SCREAMING_SNAKE_CASE__	)
					if vision_model is None:
							assert (
							    vision_model_name_or_path is not None
							), "If `model` is not defined as an argument, a `vision_model_name_or_path` has to be defined"
							from transformers import FlaxAutoModel

							if "config" not in kwargs_vision:
									from transformers import AutoConfig

									SCREAMING_SNAKE_CASE_						:str										=      AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__	)
									SCREAMING_SNAKE_CASE_						:str										=      vision_config

							SCREAMING_SNAKE_CASE_						:Optional[Any]										=      FlaxAutoModel.from_pretrained(SCREAMING_SNAKE_CASE__      ,       *SCREAMING_SNAKE_CASE__      ,       **SCREAMING_SNAKE_CASE__	)

					# instantiate config with corresponding kwargs
					SCREAMING_SNAKE_CASE_						:int										=      kwargs.pop('dtype'      ,       jnp.floataa	)
					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      HybridCLIPConfig.from_text_vision_configs(text_model.config      ,       vision_model.config      ,       **SCREAMING_SNAKE_CASE__	)

					# init model
					SCREAMING_SNAKE_CASE_						:Dict										=      cls(SCREAMING_SNAKE_CASE__      ,       *SCREAMING_SNAKE_CASE__      ,       dtype=SCREAMING_SNAKE_CASE__      ,       **SCREAMING_SNAKE_CASE__	)

					if vision_config.model_type == "clip":
							SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      vision_model.params['vision_model']
							SCREAMING_SNAKE_CASE_						:Optional[Any]										=      vision_model.params['visual_projection']['kernel']
					else:
							SCREAMING_SNAKE_CASE_						:Tuple										=      vision_model.params

					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      text_model.params

					return model



"""simple docstring"""




import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_splinter import SplinterTokenizer


SCREAMING_SNAKE_CASE_  :      str							=      logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_  :      List[Any]							=      {'''vocab_file''': '''vocab.txt'''}

SCREAMING_SNAKE_CASE_  :      int							=      {
    '''vocab_file''': {
        '''tau/splinter-base''': '''https://huggingface.co/tau/splinter-base/resolve/main/vocab.txt''',
        '''tau/splinter-base-qass''': '''https://huggingface.co/tau/splinter-base-qass/resolve/main/vocab.txt''',
        '''tau/splinter-large''': '''https://huggingface.co/tau/splinter-large/resolve/main/vocab.txt''',
        '''tau/splinter-large-qass''': '''https://huggingface.co/tau/splinter-large-qass/resolve/main/vocab.txt''',
    }
}

SCREAMING_SNAKE_CASE_  :      Union[str, Any]							=      {
    '''tau/splinter-base''': 512,
    '''tau/splinter-base-qass''': 512,
    '''tau/splinter-large''': 512,
    '''tau/splinter-large-qass''': 512,
}

SCREAMING_SNAKE_CASE_  :      List[Any]							=      {
    '''tau/splinter-base''': {'''do_lower_case''': False},
    '''tau/splinter-base-qass''': {'''do_lower_case''': False},
    '''tau/splinter-large''': {'''do_lower_case''': False},
    '''tau/splinter-large-qass''': {'''do_lower_case''': False},
}


class 		_A							(      __a       ):
      __a             =						VOCAB_FILES_NAMES
      __a             =						PRETRAINED_VOCAB_FILES_MAP
      __a             =						PRETRAINED_INIT_CONFIGURATION
      __a             =						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      __a             =						SplinterTokenizer





      def __init__(	self     ,    SCREAMING_SNAKE_CASE__=None     ,    SCREAMING_SNAKE_CASE__=None     ,    SCREAMING_SNAKE_CASE__=True     ,    SCREAMING_SNAKE_CASE__="[UNK]"     ,    SCREAMING_SNAKE_CASE__="[SEP]"     ,    SCREAMING_SNAKE_CASE__="[PAD]"     ,    SCREAMING_SNAKE_CASE__="[CLS]"     ,    SCREAMING_SNAKE_CASE__="[MASK]"     ,    SCREAMING_SNAKE_CASE__="[QUESTION]"     ,    SCREAMING_SNAKE_CASE__=True     ,    SCREAMING_SNAKE_CASE__=None     ,    **SCREAMING_SNAKE_CASE__     ,    ) ->       Optional[Any]:
         super().__init__(
             SCREAMING_SNAKE_CASE__     ,    tokenizer_file=SCREAMING_SNAKE_CASE__     ,    do_lower_case=SCREAMING_SNAKE_CASE__     ,    unk_token=SCREAMING_SNAKE_CASE__     ,    sep_token=SCREAMING_SNAKE_CASE__     ,    pad_token=SCREAMING_SNAKE_CASE__     ,    cls_token=SCREAMING_SNAKE_CASE__     ,    mask_token=SCREAMING_SNAKE_CASE__     ,    tokenize_chinese_chars=SCREAMING_SNAKE_CASE__     ,    strip_accents=SCREAMING_SNAKE_CASE__     ,    additional_special_tokens=(question_token,)     ,    **SCREAMING_SNAKE_CASE__     ,    )

         lowerCamelCase__						       =      json.loads(self.backend_tokenizer.normalizer.__getstate__()		)
         if (
             pre_tok_state.get("lowercase"     ,    SCREAMING_SNAKE_CASE__		) != do_lower_case
             or pre_tok_state.get("strip_accents"     ,    SCREAMING_SNAKE_CASE__		) != strip_accents
         ):
            lowerCamelCase__						       =      getattr(SCREAMING_SNAKE_CASE__     ,    pre_tok_state.pop("type"		)		)
            lowerCamelCase__						       =      do_lower_case
            lowerCamelCase__						       =      strip_accents
            lowerCamelCase__						       =      pre_tok_class(**SCREAMING_SNAKE_CASE__		)

         lowerCamelCase__						       =      do_lower_case





      @property
      def        _lowerCamelCase	(	self		) ->       Optional[Any]:
         return self.convert_tokens_to_ids(self.question_token		)





      def        _lowerCamelCase	(	self     ,    SCREAMING_SNAKE_CASE__     ,    SCREAMING_SNAKE_CASE__ = None		) ->       List[int]:
         if token_ids_a is None:
            return [self.cls_token_id] + token_ids_a + [self.sep_token_id]

         lowerCamelCase__						       =      [self.cls_token_id]
         lowerCamelCase__						       =      [self.sep_token_id]
         lowerCamelCase__						       =      [self.question_token_id] + [self.convert_tokens_to_ids("."		)]
         if self.padding_side == "right":
            # Input is question-then-context
            return cls + token_ids_a + question_suffix + sep + token_ids_a + sep
         else:
            # Input is context-then-question
            return cls + token_ids_a + sep + token_ids_a + question_suffix + sep





      def        _lowerCamelCase	(	self     ,    SCREAMING_SNAKE_CASE__     ,    SCREAMING_SNAKE_CASE__ = None		) ->       List[int]:
         lowerCamelCase__						       =      [self.sep_token_id]
         lowerCamelCase__						       =      [self.cls_token_id]
         lowerCamelCase__						       =      [self.question_token_id] + [self.convert_tokens_to_ids("."		)]
         if token_ids_a is None:
            return len(cls + token_ids_a + sep		) * [0]

         if self.padding_side == "right":
            # Input is question-then-context
            return len(cls + token_ids_a + question_suffix + sep		) * [0] + len(token_ids_a + sep		) * [1]
         else:
            # Input is context-then-question
            return len(cls + token_ids_a + sep		) * [0] + len(token_ids_a + question_suffix + sep		) * [1]





      def        _lowerCamelCase	(	self     ,    SCREAMING_SNAKE_CASE__     ,    SCREAMING_SNAKE_CASE__ = None		) ->       Tuple[str]:
         lowerCamelCase__						       =      self._tokenizer.model.save(SCREAMING_SNAKE_CASE__     ,    name=SCREAMING_SNAKE_CASE__		)
         return tuple(SCREAMING_SNAKE_CASE__		)




