





from typing import TYPE_CHECKING

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


_lowerCamelCase			       =      {
    'configuration_efficientformer': [
        'EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'EfficientFormerConfig',
    ]
}

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

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       _lowerCamelCase			       =      [
           'EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
           'EfficientFormerForImageClassification',
           'EfficientFormerForImageClassificationWithTeacher',
           'EfficientFormerModel',
           'EfficientFormerPreTrainedModel',
       ]

try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       _lowerCamelCase			       =      [
           'TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
           'TFEfficientFormerForImageClassification',
           'TFEfficientFormerForImageClassificationWithTeacher',
           'TFEfficientFormerModel',
           'TFEfficientFormerPreTrainedModel',
       ]

if TYPE_CHECKING:
       from .configuration_efficientformer import EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, EfficientFormerConfig

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .image_processing_efficientformer import EfficientFormerImageProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_efficientformer import (
                  EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
                  EfficientFormerForImageClassification,
                  EfficientFormerForImageClassificationWithTeacher,
                  EfficientFormerModel,
                  EfficientFormerPreTrainedModel,
              )
       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_efficientformer import (
                  TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TFEfficientFormerForImageClassification,
                  TFEfficientFormerForImageClassificationWithTeacher,
                  TFEfficientFormerModel,
                  TFEfficientFormerPreTrainedModel,
              )

else:
       import sys

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










import pytest

import datasets


# Import fixture modules as plugins
_lowerCamelCase			       =      ['tests.fixtures.files', 'tests.fixtures.hub', 'tests.fixtures.fsspec']




def    __UpperCAmelCase(      lowercase_ ,    lowercase_      ):
       # Mark tests as "unit" by default if not marked as "integration" (or already marked as "unit")
       for item in items:
              if any(marker in item.keywords for marker in ['''integration''', '''unit''']      ):
                     continue
              item.add_marker(pytest.mark.unit      )




def    __UpperCAmelCase(      lowercase_      ):
       config.addinivalue_line('''markers''' ,    '''torchaudio_latest: mark test to run with torchaudio>=0.12'''      )




@pytest.fixture(autouse=lowercase_      )
def    __UpperCAmelCase(      lowercase_ ,    lowercase_      ):
       # test_hf_cache_home = tmp_path_factory.mktemp("cache")  # TODO: why a cache dir per test function does not work?
       _lowerCamelCase							:     Optional[Any]	=		tmp_path_factory.getbasetemp() / '''cache'''
       _lowerCamelCase							:     Optional[Any]	=		test_hf_cache_home / '''datasets'''
       _lowerCamelCase							:     Union[str, Any]	=		test_hf_cache_home / '''metrics'''
       _lowerCamelCase							:     Dict	=		test_hf_cache_home / '''modules'''
       monkeypatch.setattr('''datasets.config.HF_DATASETS_CACHE''' ,    str(lowercase_      )      )
       monkeypatch.setattr('''datasets.config.HF_METRICS_CACHE''' ,    str(lowercase_      )      )
       monkeypatch.setattr('''datasets.config.HF_MODULES_CACHE''' ,    str(lowercase_      )      )
       _lowerCamelCase							:     str	=		test_hf_datasets_cache / '''downloads'''
       monkeypatch.setattr('''datasets.config.DOWNLOADED_DATASETS_PATH''' ,    str(lowercase_      )      )
       _lowerCamelCase							:     Optional[int]	=		test_hf_datasets_cache / '''downloads''' / '''extracted'''
       monkeypatch.setattr('''datasets.config.EXTRACTED_DATASETS_PATH''' ,    str(lowercase_      )      )




@pytest.fixture(autouse=lowercase_ ,    scope='''session'''      )
def    __UpperCAmelCase(      ):
       datasets.disable_progress_bar()




@pytest.fixture(autouse=lowercase_      )
def    __UpperCAmelCase(      lowercase_      ):
       # don't take tests into account when counting downloads
       monkeypatch.setattr('''datasets.config.HF_UPDATE_DOWNLOAD_COUNTS''' ,    lowercase_      )




@pytest.fixture
def    __UpperCAmelCase(      lowercase_      ):
       # Required to suppress RemovedIn20Warning when feature(s) are not compatible with SQLAlchemy 2.0
       # To be removed once SQLAlchemy 2.0 supported
       monkeypatch.setattr('''sqlalchemy.util.deprecations.SILENCE_UBER_WARNING''' ,    lowercase_      )

