'''simple docstring'''







import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast






@dataclass
class 			lowerCAmelCase__       (  datasets.BuilderConfig					):
					lowerCAmelCase_					       =					None







class 			lowerCAmelCase__       (  datasets.ArrowBasedBuilder					):
					lowerCAmelCase_					       =					PandasConfig






					def      _snake_case   (       self		):


											"""simple docstring"""





											return datasets.DatasetInfo(features=self.config.features		)






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											if not self.config.data_files:
																	raise ValueError(F'''At least one data file must be specified, but got data_files={self.config.data_files}'''		)
											lowercase_     :					str													=	dl_manager.download_and_extract(self.config.data_files		)
											if isinstance(a_    ,							(str, list, tuple)		):
																	lowercase_     :					Dict													=	data_files
																	if isinstance(a_    ,							a_		):
																							lowercase_     :					Tuple													=	[files]
																	# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
																	lowercase_     :					Dict													=	[dl_manager.iter_files(a_		) for file in files]
																	return [datasets.SplitGenerator(name=datasets.Split.TRAIN    ,							gen_kwargs={'''files''': files}		)]
											lowercase_     :					Dict													=	[]
											for split_name, files in data_files.items():
																	if isinstance(a_    ,							a_		):
																							lowercase_     :					Dict													=	[files]
																	# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
																	lowercase_     :					Any													=	[dl_manager.iter_files(a_		) for file in files]
																	splits.append(datasets.SplitGenerator(name=a_    ,							gen_kwargs={'''files''': files}		)		)
											return splits






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											if self.config.features is not None:
																	# more expensive cast to support nested features with keys in a different order
																	# allows str <-> int/float or str to Audio for example
																	lowercase_     :					Optional[int]													=	table_cast(a_    ,							self.config.features.arrow_schema		)
											return pa_table






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											for i, file in enumerate(itertools.chain.from_iterable(a_		)		):
																	with open(a_    ,							'''rb'''		) as f:
																							lowercase_     :					Optional[int]													=	pa.Table.from_pandas(pd.read_pickle(a_		)		)
																							yield i, self._cast_table(a_		)





'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_lowercase			:  List[Any]   							=	{
    "configuration_x_clip": [
        "XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "XCLIPConfig",
        "XCLIPTextConfig",
        "XCLIPVisionConfig",
    ],
    "processing_x_clip": ["XCLIPProcessor"],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowercase			:  int   							=	[
							    "XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "XCLIPModel",
							    "XCLIPPreTrainedModel",
							    "XCLIPTextModel",
							    "XCLIPVisionModel",
							]

if TYPE_CHECKING:
							from .configuration_x_clip import (
							    XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    XCLIPConfig,
							    XCLIPTextConfig,
							    XCLIPVisionConfig,
							)
							from .processing_x_clip import XCLIPProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_x_clip import (
														    XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
														    XCLIPModel,
														    XCLIPPreTrainedModel,
														    XCLIPTextModel,
														    XCLIPVisionModel,
														)

else:
							import sys

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



