



import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


__A   			={"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

__A   			={
    "vocab_file": {
        "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt",
    },
    "tokenizer_file": {
        "unc-nlp/lxmert-base-uncased": (
            "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json"
        ),
    },
}

__A   			={
    "unc-nlp/lxmert-base-uncased": 5_1_2,
}

__A   			={
    "unc-nlp/lxmert-base-uncased": {"do_lower_case": True},
}

class 		UpperCAmelCase__			(			__UpperCamelCase   ):




			'''simple docstring'''






			UpperCamelCase									=       VOCAB_FILES_NAMES
			UpperCamelCase									=       PRETRAINED_VOCAB_FILES_MAP
			UpperCamelCase									=       PRETRAINED_INIT_CONFIGURATION
			UpperCamelCase									=       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
			UpperCamelCase									=       LxmertTokenizer




			def __init__(   self							: List[Any]       ,       a_							: Optional[Any]=None       ,       a_							: Optional[Any]=None       ,       a_							: Any=True       ,       a_							: Tuple="[UNK]"       ,       a_							: str="[SEP]"       ,       a_							: Optional[Any]="[PAD]"       ,       a_							: List[str]="[CLS]"       ,       a_							: Tuple="[MASK]"       ,       a_							: Optional[Any]=True       ,       a_							: Any=None       ,       **a_							: Optional[int]       ,       ):
					'''simple docstring'''





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

					__UpperCAmelCase    :     Union[str, Any]													=	json.loads(self.backend_tokenizer.normalizer.__getstate__() )
					if (
					    normalizer_state.get('''lowercase'''       ,       a_ ) != do_lower_case
					    or normalizer_state.get('''strip_accents'''       ,       a_ ) != strip_accents
					    or normalizer_state.get('''handle_chinese_chars'''       ,       a_ ) != tokenize_chinese_chars
					):
							__UpperCAmelCase    :     Optional[int]													=	getattr(a_       ,       normalizer_state.pop('''type''' ) )
							__UpperCAmelCase    :     Union[str, Any]													=	do_lower_case
							__UpperCAmelCase    :     Tuple													=	strip_accents
							__UpperCAmelCase    :     Any													=	tokenize_chinese_chars
							__UpperCAmelCase    :     List[str]													=	normalizer_class(**a_ )

					__UpperCAmelCase    :     str													=	do_lower_case




			def  snake_case__     (   self							: Dict       ,       a_							: List[Any]       ,       a_							: Union[str, Any]=None ):
					'''simple docstring'''





					__UpperCAmelCase    :     Optional[Any]													=	[self.cls_token_id] + token_ids_a + [self.sep_token_id]

					if token_ids_a:
							output += token_ids_a + [self.sep_token_id]

					return output




			def  snake_case__     (   self							: Any       ,       a_							: List[int]       ,       a_							: Optional[List[int]] = None ):
					'''simple docstring'''





					__UpperCAmelCase    :     Optional[Any]													=	[self.sep_token_id]
					__UpperCAmelCase    :     Any													=	[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 ) * [0] + len(token_ids_a + sep ) * [1]




			def  snake_case__     (   self							: Union[str, Any]       ,       a_							: str       ,       a_							: Optional[str] = None ):
					'''simple docstring'''





					__UpperCAmelCase    :     Any													=	self._tokenizer.model.save(a_       ,       name=a_ )
					return tuple(a_ )










from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
				if not (is_transformers_available() and is_torch_available()):
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				from ...utils.dummy_torch_and_transformers_objects import KandinskyPipeline, KandinskyPriorPipeline
else:
				from .pipeline_kandinsky import KandinskyPipeline
				from .pipeline_kandinsky_imgaimg import KandinskyImgaImgPipeline
				from .pipeline_kandinsky_inpaint import KandinskyInpaintPipeline
				from .pipeline_kandinsky_prior import KandinskyPriorPipeline, KandinskyPriorPipelineOutput
				from .text_encoder import MultilingualCLIP





