





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_UpperCAmelCase							:			str        =							{
    """configuration_whisper""": ["""WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """WhisperConfig""", """WhisperOnnxConfig"""],
    """feature_extraction_whisper""": ["""WhisperFeatureExtractor"""],
    """processing_whisper""": ["""WhisperProcessor"""],
    """tokenization_whisper""": ["""WhisperTokenizer"""],
}

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase							:			int        =							["""WhisperTokenizerFast"""]

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase							:			Any        =							[
        """WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """WhisperForConditionalGeneration""",
        """WhisperModel""",
        """WhisperPreTrainedModel""",
        """WhisperForAudioClassification""",
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase							:			Any        =							[
        """TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """TFWhisperForConditionalGeneration""",
        """TFWhisperModel""",
        """TFWhisperPreTrainedModel""",
    ]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase							:			int        =							[
        """FlaxWhisperForConditionalGeneration""",
        """FlaxWhisperModel""",
        """FlaxWhisperPreTrainedModel""",
        """FlaxWhisperForAudioClassification""",
    ]


if TYPE_CHECKING:
    from .configuration_whisper import WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP, WhisperConfig, WhisperOnnxConfig
    from .feature_extraction_whisper import WhisperFeatureExtractor
    from .processing_whisper import WhisperProcessor
    from .tokenization_whisper import WhisperTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_whisper_fast import WhisperTokenizerFast

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_whisper import (
            WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
            WhisperForAudioClassification,
            WhisperForConditionalGeneration,
            WhisperModel,
            WhisperPreTrainedModel,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_whisper import (
            TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFWhisperForConditionalGeneration,
            TFWhisperModel,
            TFWhisperPreTrainedModel,
        )

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_whisper import (
            FlaxWhisperForAudioClassification,
            FlaxWhisperForConditionalGeneration,
            FlaxWhisperModel,
            FlaxWhisperPreTrainedModel,
        )

else:
    import sys

    _UpperCAmelCase							:			str        =							_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)












import pytest


_UpperCAmelCase							:			Optional[int]        =							"""__dummy_dataset1__"""

_UpperCAmelCase							:			Dict        =							"""
import json
import os

import datasets


REPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"
URLS = {\"train\": REPO_URL + \"wikiann-bn-train.jsonl\", \"validation\": REPO_URL + \"wikiann-bn-validation.jsonl\"}


class __DummyDataset1__(datasets.GeneratorBasedBuilder):

    def _info(self):
        features = datasets.Features(
            {
                \"tokens\": datasets.Sequence(datasets.Value(\"string\")),
                \"ner_tags\": datasets.Sequence(
                    datasets.features.ClassLabel(
                        names=[
                            \"O\",
                            \"B-PER\",
                            \"I-PER\",
                            \"B-ORG\",
                            \"I-ORG\",
                            \"B-LOC\",
                            \"I-LOC\",
                        ]
                    )
                ),
                \"langs\": datasets.Sequence(datasets.Value(\"string\")),
                \"spans\": datasets.Sequence(datasets.Value(\"string\")),
            }
        )
        return datasets.DatasetInfo(features=features)

    def _split_generators(self, dl_manager):
        dl_path = dl_manager.download(URLS)
        return [
            datasets.SplitGenerator(datasets.Split.TRAIN, gen_kwargs={\"filepath\": dl_path[\"train\"]}),
            datasets.SplitGenerator(datasets.Split.VALIDATION, gen_kwargs={\"filepath\": dl_path[\"validation\"]}),
        ]

    def _generate_examples(self, filepath):
        with open(filepath, \"r\", encoding=\"utf-8\") as f:
            for i, line in enumerate(f):
                yield i, json.loads(line)
"""


@pytest.fixture
def 			SCREAMING_SNAKE_CASE (			)     ->	Dict:
    return DATASET_LOADING_SCRIPT_NAME


@pytest.fixture
def 			SCREAMING_SNAKE_CASE (			)     ->	List[Any]:
    return DATASET_LOADING_SCRIPT_CODE


@pytest.fixture
def 			SCREAMING_SNAKE_CASE (			_UpperCAmelCase		,      _UpperCAmelCase		,      _UpperCAmelCase					)     ->	List[Any]:
    lowerCamelCase__       : int   					=						dataset_loading_script_name
    lowerCamelCase__       : Any   					=						tmp_path / 'datasets' / script_name
    script_dir.mkdir(parents=_UpperCAmelCase					)
    lowerCamelCase__       : str   					=						script_dir / F"""{script_name}.py"""
    with open(_UpperCAmelCase		,      'w'					) as f:
        f.write(_UpperCAmelCase					)
    return str(_UpperCAmelCase					)





