
'''simple docstring'''
import unittest
import warnings
from dataclasses import dataclass

from transformers.convert_slow_tokenizer import SpmConverter
from transformers.testing_utils import get_tests_dir


@dataclass
class     _lowerCAmelCase					:







							'''simple docstring'''

							lowerCAmelCase_      		=		42


class     _lowerCAmelCase					(					unittest.TestCase   ):







							'''simple docstring'''

							def  lowercase							(self						)  ->     Tuple:
														_snake_case     =						get_tests_dir("""fixtures/test_sentencepiece.model"""						)
														_snake_case     =						get_tests_dir("""fixtures/test_sentencepiece_with_bytefallback.model"""						)

														_snake_case     =						FakeOriginalTokenizer(vocab_file=UpperCAmelCase						)

														with warnings.catch_warnings(record=UpperCAmelCase						) as w:
																					_snake_case     =						SpmConverter(UpperCAmelCase						)
														self.assertEqual(len(UpperCAmelCase						)						,						0						)

														_snake_case     =						FakeOriginalTokenizer(vocab_file=UpperCAmelCase						)

														with warnings.catch_warnings(record=UpperCAmelCase						) as w:
																					_snake_case     =						SpmConverter(UpperCAmelCase						)
														self.assertEqual(len(UpperCAmelCase						)						,						1						)

														self.assertIn(
														    """The sentencepiece tokenizer that you are converting to a fast tokenizer uses the byte fallback option"""
														    """ which is not implemented in the fast tokenizers."""						,						str(w[0].message						)						,						)

'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


__lowerCAmelCase  							= {
    'configuration_deta': ['DETA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DetaConfig'],
}

try:
				if not is_vision_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__lowerCAmelCase  							= ['DetaImageProcessor']

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__lowerCAmelCase  							= [
				    'DETA_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'DetaForObjectDetection',
				    'DetaModel',
				    'DetaPreTrainedModel',
				]


if TYPE_CHECKING:
				from .configuration_deta import DETA_PRETRAINED_CONFIG_ARCHIVE_MAP, DetaConfig

				try:
								if not is_vision_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .image_processing_deta import DetaImageProcessor

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_deta import (
								    DETA_PRETRAINED_MODEL_ARCHIVE_LIST,
								    DetaForObjectDetection,
								    DetaModel,
								    DetaPreTrainedModel,
								)

else:
				import sys

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