


from argparse import ArgumentParser

from .env import EnvironmentCommand






def 							__lowercase   ( ):
							a__             =     ArgumentParser('Diffusers CLI tool'					,    usage='diffusers-cli <command> [<args>]'   )
							a__             =     parser.add_subparsers(help='diffusers-cli command helpers'   )

							# Register commands
							EnvironmentCommand.register_subcommand(__lowerCAmelCase   )

							# Let's go
							a__             =     parser.parse_args()

							if not hasattr(__lowerCAmelCase					,    'func'   ):
														parser.print_help()
														exit(1   )

							# Run
							a__             =     args.func(__lowerCAmelCase   )
							service.run()


if __name__ == "__main__":
						main()








import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_distilbert import DistilBertTokenizer


snake_case							:       Dict     			=      logging.get_logger(__name__)

snake_case							:       Dict     			=      {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

snake_case							:       List[Any]     			=      {
    '''vocab_file''': {
        '''distilbert-base-uncased''': '''https://huggingface.co/distilbert-base-uncased/resolve/main/vocab.txt''',
        '''distilbert-base-uncased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/vocab.txt'''
        ),
        '''distilbert-base-cased''': '''https://huggingface.co/distilbert-base-cased/resolve/main/vocab.txt''',
        '''distilbert-base-cased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/vocab.txt'''
        ),
        '''distilbert-base-german-cased''': '''https://huggingface.co/distilbert-base-german-cased/resolve/main/vocab.txt''',
        '''distilbert-base-multilingual-cased''': (
            '''https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/vocab.txt'''
        ),
    },
    '''tokenizer_file''': {
        '''distilbert-base-uncased''': '''https://huggingface.co/distilbert-base-uncased/resolve/main/tokenizer.json''',
        '''distilbert-base-uncased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/tokenizer.json'''
        ),
        '''distilbert-base-cased''': '''https://huggingface.co/distilbert-base-cased/resolve/main/tokenizer.json''',
        '''distilbert-base-cased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/tokenizer.json'''
        ),
        '''distilbert-base-german-cased''': (
            '''https://huggingface.co/distilbert-base-german-cased/resolve/main/tokenizer.json'''
        ),
        '''distilbert-base-multilingual-cased''': (
            '''https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/tokenizer.json'''
        ),
    },
}

snake_case							:       int     			=      {
    '''distilbert-base-uncased''': 5_12,
    '''distilbert-base-uncased-distilled-squad''': 5_12,
    '''distilbert-base-cased''': 5_12,
    '''distilbert-base-cased-distilled-squad''': 5_12,
    '''distilbert-base-german-cased''': 5_12,
    '''distilbert-base-multilingual-cased''': 5_12,
}


snake_case							:       Union[str, Any]     			=      {
    '''distilbert-base-uncased''': {'''do_lower_case''': True},
    '''distilbert-base-uncased-distilled-squad''': {'''do_lower_case''': True},
    '''distilbert-base-cased''': {'''do_lower_case''': False},
    '''distilbert-base-cased-distilled-squad''': {'''do_lower_case''': False},
    '''distilbert-base-german-cased''': {'''do_lower_case''': False},
    '''distilbert-base-multilingual-cased''': {'''do_lower_case''': False},
}







class        snake_case_   (lowerCamelCase_      ):
					UpperCAmelCase__					:    Any          =			VOCAB_FILES_NAMES
					UpperCAmelCase__					:    str          =			PRETRAINED_VOCAB_FILES_MAP
					UpperCAmelCase__					:    int          =			PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
					UpperCAmelCase__					:    Tuple          =			PRETRAINED_INIT_CONFIGURATION
					UpperCAmelCase__					:    Optional[Any]          =			['''input_ids''', '''attention_mask''']
					UpperCAmelCase__					:    Optional[int]          =			DistilBertTokenizer
					def __init__(      self   :Dict			,__snake_case   :Dict=None			,__snake_case   :Optional[Any]=None			,__snake_case   :Optional[Any]=True			,__snake_case   :List[Any]="[UNK]"			,__snake_case   :str="[SEP]"			,__snake_case   :List[Any]="[PAD]"			,__snake_case   :Tuple="[CLS]"			,__snake_case   :Optional[int]="[MASK]"			,__snake_case   :Dict=True			,__snake_case   :Dict=None			,**__snake_case   :List[Any]			,)					->    Optional[int]:
												super().__init__(
												    __snake_case			,tokenizer_file=__snake_case			,do_lower_case=__snake_case			,unk_token=__snake_case			,sep_token=__snake_case			,pad_token=__snake_case			,cls_token=__snake_case			,mask_token=__snake_case			,tokenize_chinese_chars=__snake_case			,strip_accents=__snake_case			,**__snake_case			,)

												a__             =     json.loads(self.backend_tokenizer.normalizer.__getstate__()      )
												if (
												    normalizer_state.get('lowercase'			,__snake_case      ) != do_lower_case
												    or normalizer_state.get('strip_accents'			,__snake_case      ) != strip_accents
												    or normalizer_state.get('handle_chinese_chars'			,__snake_case      ) != tokenize_chinese_chars
												):
																			a__             =     getattr(__snake_case			,normalizer_state.pop('type'      )      )
																			a__             =     do_lower_case
																			a__             =     strip_accents
																			a__             =     tokenize_chinese_chars
																			a__             =     normalizer_class(**__snake_case      )

												a__             =     do_lower_case
					def  lowerCamelCase__(      self   :Any			,__snake_case   :List[str]			,__snake_case   :int=None      )					->    Dict:
												a__             =     [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  lowerCamelCase__(      self   :List[str]			,__snake_case   :List[int]			,__snake_case   :Optional[List[int]] = None      )					->    List[int]:
												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      ) * [0] + len(token_ids_a + sep      ) * [1]



					def  lowerCamelCase__(      self   :Union[str, Any]			,__snake_case   :str			,__snake_case   :Optional[str] = None      )					->    Tuple[str]:
												a__             =     self._tokenizer.model.save(__snake_case			,name=__snake_case      )
												return tuple(__snake_case      )




