'''simple docstring'''




import os
import unittest

import pytest
from parameterized import parameterized

from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device


# skipping in unittest tests

__snake_case  : Dict		       =    [(1,)]





def 	_UpperCAmelCase       (				)      -> Dict:
    A_      =  bool(os.getenv('''RUN_SLOW''',  0  )  )
    if run_slow:
        assert True
    else:
        assert False, "should have been skipped"





def 	_UpperCAmelCase       (				)      -> str:
    A_      =  bool(os.getenv('''RUN_SLOW''',  0  )  )
    if run_slow and torch_device == "cuda":
        assert True
    else:
        assert False, "should have been skipped"




@require_torch
class       __UpperCAmelCase							(							unittest.TestCase	):





       '''simple docstring'''



       @slow
       @require_torch_gpu
       def    __A			( self					)						->	Optional[Any]:
           check_slow_torch_cuda()

       @require_torch_gpu
       @slow
       def    __A			( self					)						->	str:
           check_slow_torch_cuda()

       @parameterized.expand(_SCREAMING_SNAKE_CASE					)
       @slow
       def    __A			( self       ,	_SCREAMING_SNAKE_CASE=None					)						->	Any:
           check_slow()





@slow
@require_torch_gpu
def 	_UpperCAmelCase       (				)      -> str:
    check_slow_torch_cuda()





@require_torch_gpu
@slow
def 	_UpperCAmelCase       (				)      -> Optional[int]:
    check_slow_torch_cuda()





@slow
@pytest.mark.parametrize('''param''',  [1]  )
def 	_UpperCAmelCase       (				_UpperCamelCase       :      str  )      -> Tuple:
    check_slow()





@pytest.mark.parametrize('''param''',  [1]  )
@slow
def 	_UpperCAmelCase       (				_UpperCamelCase       :      Union[str, Any]  )      -> Optional[Any]:
    check_slow()







'''simple docstring'''




from typing import Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_openai import OpenAIGPTTokenizer


__snake_case  : Union[str, Any]		       =    logging.get_logger(__name__)

__snake_case  : Union[str, Any]		       =    {'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

__snake_case  : List[str]		       =    {
    'vocab_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/vocab.json'},
    'merges_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/merges.txt'},
    'tokenizer_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/tokenizer.json'},
}

__snake_case  : Optional[int]		       =    {
    'openai-gpt': 512,
}




class       __UpperCAmelCase							(							_UpperCamelCase	):





       '''simple docstring'''



       __lowercase   :   int  					=							VOCAB_FILES_NAMES
       __lowercase   :   int  					=							PRETRAINED_VOCAB_FILES_MAP
       __lowercase   :   str  					=							PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
       __lowercase   :   Optional[Any]  					=							['input_ids', 'attention_mask']
       __lowercase   :   List[Any]  					=							OpenAIGPTTokenizer

       def __init__( self       ,	_SCREAMING_SNAKE_CASE=None       ,	_SCREAMING_SNAKE_CASE=None       ,	_SCREAMING_SNAKE_CASE=None       ,	_SCREAMING_SNAKE_CASE="<unk>"       ,	**_SCREAMING_SNAKE_CASE					)						->	Optional[Any]:
           super().__init__(_SCREAMING_SNAKE_CASE       ,	_SCREAMING_SNAKE_CASE       ,	tokenizer_file=_SCREAMING_SNAKE_CASE       ,	unk_token=_SCREAMING_SNAKE_CASE       ,	**_SCREAMING_SNAKE_CASE					)

       @property
       def    __A			( self					)						->	Optional[Any]:
           return True

       def    __A			( self       ,	_SCREAMING_SNAKE_CASE       ,	_SCREAMING_SNAKE_CASE = None					)						->	Tuple[str]:
           A_      =  self._tokenizer.model.save(_SCREAMING_SNAKE_CASE       ,	name=_SCREAMING_SNAKE_CASE					)
           return tuple(_SCREAMING_SNAKE_CASE					)






