

"""simple docstring"""



import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_mpnet import MPNetTokenizer


SCREAMING_SNAKE_CASE_       :						Dict					=    logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_       :						List[Any]					=    {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'}

SCREAMING_SNAKE_CASE_       :						Any					=    {
    'vocab_file': {
        'microsoft/mpnet-base': 'https://huggingface.co/microsoft/mpnet-base/resolve/main/vocab.txt',
    },
    'tokenizer_file': {
        'microsoft/mpnet-base': 'https://huggingface.co/microsoft/mpnet-base/resolve/main/tokenizer.json',
    },
}

SCREAMING_SNAKE_CASE_       :						List[str]					=    {
    'microsoft/mpnet-base': 5_1_2,
}

SCREAMING_SNAKE_CASE_       :						str					=    {
    'microsoft/mpnet-base': {'do_lower_case': True},
}



class        a    (							_lowerCamelCase					):



    """simple docstring"""



    UpperCAmelCase    			=       VOCAB_FILES_NAMES
    UpperCAmelCase    			=       PRETRAINED_VOCAB_FILES_MAP
    UpperCAmelCase    			=       PRETRAINED_INIT_CONFIGURATION
    UpperCAmelCase    			=       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    UpperCAmelCase    			=       MPNetTokenizer
    UpperCAmelCase    			=       ["input_ids", "attention_mask"]

    def __init__(  self:			List[Any]     ,    UpperCamelCase:			Dict=None     ,    UpperCamelCase:			Optional[int]=None     ,    UpperCamelCase:			Dict=True     ,    UpperCamelCase:			Union[str, Any]="<s>"     ,    UpperCamelCase:			Dict="</s>"     ,    UpperCamelCase:			Union[str, Any]="</s>"     ,    UpperCamelCase:			Tuple="<s>"     ,    UpperCamelCase:			Union[str, Any]="[UNK]"     ,    UpperCamelCase:			List[Any]="<pad>"     ,    UpperCamelCase:			Tuple="<mask>"     ,    UpperCamelCase:			int=True     ,    UpperCamelCase:			Optional[Any]=None     ,    **UpperCamelCase:			Optional[int]     ,    ):






         """simple docstring"""


         super().__init__(
             __lowercase     ,    tokenizer_file=__lowercase     ,    do_lower_case=__lowercase     ,    bos_token=__lowercase     ,    eos_token=__lowercase     ,    sep_token=__lowercase     ,    cls_token=__lowercase     ,    unk_token=__lowercase     ,    pad_token=__lowercase     ,    mask_token=__lowercase     ,    tokenize_chinese_chars=__lowercase     ,    strip_accents=__lowercase     ,    **__lowercase     ,    )

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

         A__				      =	do_lower_case

    @property
    def 					UpperCamelCase						(  self:			List[Any]							):






         """simple docstring"""


         if self._mask_token is None:
              if self.verbose:
                   logger.error("""Using mask_token, but it is not set yet."""							)
              return None
         return str(self._mask_token							)

    @mask_token.setter
    def 					UpperCamelCase						(  self:			Optional[int]     ,    UpperCamelCase:			Tuple							):






         """simple docstring"""


         A__				      =	AddedToken(__lowercase     ,    lstrip=__lowercase     ,    rstrip=__lowercase							) if isinstance(__lowercase     ,    __lowercase							) else value
         A__				      =	value

    def 					UpperCamelCase						(  self:			List[Any]     ,    UpperCamelCase:			List[str]     ,    UpperCamelCase:			str=None							):






         """simple docstring"""


         A__				      =	[self.bos_token_id] + token_ids_a + [self.eos_token_id]
         if token_ids_a is None:
              return output

         return output + [self.eos_token_id] + token_ids_a + [self.eos_token_id]

    def 					UpperCamelCase						(  self:			Optional[int]     ,    UpperCamelCase:			Optional[int]     ,    UpperCamelCase:			Optional[Any] = None							):






         """simple docstring"""


         A__				      =	[self.sep_token_id]
         A__				      =	[self.cls_token_id]

         if token_ids_a is None:
              return len(cls + token_ids_a + sep							) * [0]
         return len(cls + token_ids_a + sep + sep + token_ids_a + sep							) * [0]





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






         """simple docstring"""


         A__				      =	self._tokenizer.model.save(__lowercase     ,    name=__lowercase							)
         return tuple(__lowercase							)












from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


UpperCamelCase__						=		{
    'configuration_sam': [
        'SAM_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'SamConfig',
        'SamMaskDecoderConfig',
        'SamPromptEncoderConfig',
        'SamVisionConfig',
    ],
    'processing_sam': ['SamProcessor'],
}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase__						=		[
							    'SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'SamModel',
							    'SamPreTrainedModel',
							]
try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase__						=		[
							    'TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'TFSamModel',
							    'TFSamPreTrainedModel',
							]
try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase__						=		['SamImageProcessor']


if TYPE_CHECKING:
							from .configuration_sam import (
							    SAM_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    SamConfig,
							    SamMaskDecoderConfig,
							    SamPromptEncoderConfig,
							    SamVisionConfig,
							)
							from .processing_sam import SamProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_sam import SAM_PRETRAINED_MODEL_ARCHIVE_LIST, SamModel, SamPreTrainedModel

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_sam import TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST, TFSamModel, TFSamPreTrainedModel

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .image_processing_sam import SamImageProcessor

else:
							import sys

							UpperCamelCase__						=		_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
