


from typing import TYPE_CHECKING

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


__snake_case   							=						{
    '''configuration_ernie''': ['''ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ErnieConfig''', '''ErnieOnnxConfig'''],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __snake_case   							=						[
        '''ERNIE_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''ErnieForCausalLM''',
        '''ErnieForMaskedLM''',
        '''ErnieForMultipleChoice''',
        '''ErnieForNextSentencePrediction''',
        '''ErnieForPreTraining''',
        '''ErnieForQuestionAnswering''',
        '''ErnieForSequenceClassification''',
        '''ErnieForTokenClassification''',
        '''ErnieModel''',
        '''ErniePreTrainedModel''',
    ]

if TYPE_CHECKING:
    from .configuration_ernie import ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP, ErnieConfig, ErnieOnnxConfig

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_ernie import (
            ERNIE_PRETRAINED_MODEL_ARCHIVE_LIST,
            ErnieForCausalLM,
            ErnieForMaskedLM,
            ErnieForMultipleChoice,
            ErnieForNextSentencePrediction,
            ErnieForPreTraining,
            ErnieForQuestionAnswering,
            ErnieForSequenceClassification,
            ErnieForTokenClassification,
            ErnieModel,
            ErniePreTrainedModel,
        )

else:
    import sys

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









import pytest

import datasets


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


def       UpperCamelCase__(			UpperCamelCase__     :			List[Any]					,	UpperCamelCase__     :			Tuple    )->List[str]:
       # 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__(			UpperCamelCase__     :			Dict    )->List[Any]:
       config.addinivalue_line('''markers'''					,	'''torchaudio_latest: mark test to run with torchaudio>=0.12'''    )


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


@pytest.fixture(autouse=UpperCamelCase__					,	scope='''session'''    )
def       UpperCamelCase__(			)->int:
       datasets.disable_progress_bar()


@pytest.fixture(autouse=UpperCamelCase__    )
def       UpperCamelCase__(			UpperCamelCase__     :			str    )->Tuple:
       # don't take tests into account when counting downloads
       monkeypatch.setattr('''datasets.config.HF_UPDATE_DOWNLOAD_COUNTS'''					,	UpperCamelCase__    )


@pytest.fixture
def       UpperCamelCase__(			UpperCamelCase__     :			List[Any]    )->Optional[Any]:
       # 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'''					,	UpperCamelCase__    )





