/usr/local/lib/python3.6/site-packages/datasets/__pycache__
NameSizeModeActions
arrow_dataset.cpython-36.pyc1898500644editdlrm
arrow_reader.cpython-36.pyc224830644editdlrm
arrow_writer.cpython-36.pyc221100644editdlrm
builder.cpython-36.pyc527790644editdlrm
combine.cpython-36.pyc55080644editdlrm
config.cpython-36.pyc51810644editdlrm
dataset_dict.cpython-36.pyc833190644editdlrm
data_files.cpython-36.pyc301530644editdlrm
fingerprint.cpython-36.pyc189790644editdlrm
info.cpython-36.pyc173590644editdlrm
inspect.cpython-36.pyc185830644editdlrm
iterable_dataset.cpython-36.pyc629320644editdlrm
keyhash.cpython-36.pyc33410644editdlrm
load.cpython-36.pyc629220644editdlrm
metric.cpython-36.pyc232170644editdlrm
naming.cpython-36.pyc25710644editdlrm
search.cpython-36.pyc313390644editdlrm
splits.cpython-36.pyc225220644editdlrm
streaming.cpython-36.pyc41190644editdlrm
table.cpython-36.pyc796120644editdlrm
__init__.cpython-36.pyc22820644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/datasets/__pycache__/inspect.cpython-36.pyc (18583B)
3 <%EgP @srdZddlZddlZddlZddlmZddlmZmZm Z m Z m Z m Z ddl Z ddlmZddlmZddlmZdd lmZdd lmZmZmZmZdd lmZdd lmZdd lm Z ee!Z"Gddde#Z$d'ddZ%d(ddZ&d)e'e'e edddZ(d*e'e'e edddZ)d+e'e e eee'fe ee ee e e'e fe e e*e'fdddZ+d,e'e e e'e fe ee ee e'e e eee'fddd Z,d-e'e e'e e e'e e'e e'e e'e e'fffe ee ee e e'e fe e e*e'fed!d"d#Z-d.e'e e'e e e'e e'e e'e e'e e'fffe ee ee e e'e fe e e*e'fd$d%d&Z.dS)/z' List and inspect datasets and metrics.N)PurePath)DictListMappingOptionalSequenceUnion)DownloadConfig) DownloadMode)StreamingDownloadManager) DatasetInfo)dataset_module_factoryimport_main_classload_dataset_buildermetric_module_factory)relative_to_absolute_path) get_logger)Versionc@s eZdZdS)SplitsNotFoundErrorN)__name__ __module__ __qualname__rr:/usr/local/lib/python3.6/site-packages/datasets/inspect.pyr'srTFcCs4tj|d}|sdd|D}|s0dd|D}|S)aGList all the datasets scripts available on the Hugging Face Hub. Args: with_community_datasets (:obj:`bool`, optional, default ``True``): Include the community provided datasets. with_details (:obj:`bool`, optional, default ``False``): Return the full details on the datasets instead of only the short name. Example: ```py >>> from datasets import list_datasets >>> list_datasets() ['acronym_identification', 'ade_corpus_v2', 'adversarial_qa', 'aeslc', 'afrikaans_ner_corpus', 'ag_news', ... ] ``` )fullcSsg|]}d|jkr|qS)/)id).0datasetrrr Csz!list_datasets..cSsg|] }|jqSr)r)rrrrrr Es)huggingface_hub list_datasets)Zwith_community_datasets with_detailsZdatasetsrrrr"+s  r"cCs0tj}|sdd|D}|s,dd|D}|S)aList all the metrics script available on the Hugging Face Hub. Args: with_community_metrics (:obj:`bool`, optional, default ``True``): Include the community provided metrics. with_details (:obj:`bool`, optional, default ``False``): Return the full details on the metrics instead of only the short name. Example: ```py >>> from datasets import list_metrics >>> list_metrics() ['accuracy', 'bertscore', 'bleu', 'bleurt', 'cer', 'chrf', ... ] ``` cSsg|]}d|jkr|qS)r)r)rmetricrrrr asz list_metrics..cSsg|] }|jqSr)r)rr$rrrr cs)r! list_metrics)Zwith_community_metricsr#Zmetricsrrrr%Is r%)path local_pathdownload_configc Kst|fd|i|}t|jdd}tj|}tjj|}xtj|D]\}} } tjj |tjj ||} tj | dddd| D| dd<x,| D]$} t j tjj || tjj | | qWt j|| qDWt|}td|d |d |d t|jd dS) a Allow inspection/modification of a dataset script by copying on local drive at local_path. Args: path (`str`): Path to the dataset processing script with the dataset builder. Can be either: - a local path to processing script or the directory containing the script (if the script has the same name as the directory), e.g. ``'./dataset/squad'`` or ``'./dataset/squad/squad.py'``. - a dataset identifier on the Hugging Face Hub (list all available datasets and ids with [`list_datasets`]) e.g. ``'squad'``, ``'glue'`` or ``'openai/webtext'``. local_path (`str`): Path to the local folder to copy the dataset script to. download_config ([`DownloadConfig`], *optional*): Specific download configuration parameters. **download_kwargs (additional keyword arguments): Optional arguments for [`DownloadConfig`] which will override the attributes of `download_config` if supplied. r(T)r)exist_okcSsg|]}|jds|qS).__)r*r+) startswith)rdirnamerrrr sz#inspect_dataset..Nz"The processing script for dataset z can be inspected at z. The main class is in zP. You can modify this processing script and use it with `datasets.load_dataset("z")`.)rr module_pathinspect getsourcefileosr&r-walkjoinrelpathmakedirsshutilcopy2copystatrprintras_posix) r&r'r(download_kwargsdataset_module builder_clsmodule_source_pathmodule_source_dirpathdirpathdirnames filenames dst_dirpathfilenamerrrinspect_datasetgs   $rEc Kst|fd|i|}t|jdd}tj|}tjj|}xtj|D]\}} } tjj |tjj ||} tj | dddd| D| dd<x,| D]$} t j tjj || tjj | | qWt j|| qDWt|}td |d |d |d t|jd dS)a Allow inspection/modification of a metric script by copying it on local drive at local_path. Args: path (``str``): path to the dataset processing script with the dataset builder. Can be either: - a local path to processing script or the directory containing the script (if the script has the same name as the directory), e.g. ``'./dataset/squad'`` or ``'./dataset/squad/squad.py'`` - a dataset identifier on the Hugging Face Hub (list all available datasets and ids with ``datasets.list_datasets()``) e.g. ``'squad'``, ``'glue'`` or ``'openai/webtext'`` local_path (``str``): path to the local folder to copy the datset script to. download_config (Optional ``datasets.DownloadConfig``): specific download configuration parameters. **download_kwargs (additional keyword arguments): optional attributes for DownloadConfig() which will override the attributes in download_config if supplied. r(F)rT)r)cSsg|]}|jds|qS)r*r+)r*r+)r,)rr-rrrr sz"inspect_metric..Nz"The processing scripts for metric z can be inspected at z. The main class is in zP. You can modify this processing scripts and use it with `datasets.load_metric("z")`.)rrr.r/r0r1r&r-r2r3r4r5r6r7r8rr9rr:) r&r'r(r;Z metric_moduler=r>r?r@rArBrCrDrrrinspect_metrics   $rF)r& data_filesr( download_moderevisionuse_auth_tokenc s0td}fdd|DS)aIGet the meta information about a dataset, returned as a dict mapping config name to DatasetInfoDict. Args: path (``str``): path to the dataset processing script with the dataset builder. Can be either: - a local path to processing script or the directory containing the script (if the script has the same name as the directory), e.g. ``'./dataset/squad'`` or ``'./dataset/squad/squad.py'`` - a dataset identifier on the Hugging Face Hub (list all available datasets and ids with ``datasets.list_datasets()``) e.g. ``'squad'``, ``'glue'`` or ``'openai/webtext'`` revision (Optional ``Union[str, datasets.Version]``): If specified, the dataset module will be loaded from the datasets repository at this version. By default: - it is set to the local version of the lib. - it will also try to load it from the main branch if it's not available at the local version of the lib. Specifying a version that is different from your local version of the lib might cause compatibility issues. download_config (:class:`DownloadConfig`, optional): Specific download configuration parameters. download_mode (:class:`DownloadMode`, default ``REUSE_DATASET_IF_EXISTS``): Download/generate mode. data_files (:obj:`Union[Dict, List, str]`, optional): Defining the data_files of the dataset configuration. use_auth_token (``str`` or :obj:`bool`, optional): Optional string or boolean to use as Bearer token for remote files on the Datasets Hub. If True, will get token from `"~/.huggingface"`. **config_kwargs (additional keyword arguments): optional attributes for builder class which will override the attributes if supplied. Example: ```py >>> from datasets import get_dataset_infos >>> get_dataset_infos('rotten_tomatoes') {'default': DatasetInfo(description="Movie Review Dataset. This is a dataset of containing 5,331 positive and 5,331 negative processed sentences from Rotten Tomatoes movie reviews...), ...} ``` )r&rIr(rHrGc s,i|]$}tf|d|qS))r& config_namerGr(rHrIrJ)get_dataset_config_info)rrK) config_kwargsrGr(rHr&rIrJrr s z%get_dataset_infos..)get_dataset_config_names)r&rGr(rHrIrJrMZ config_namesr)rMrGr(rHr&rIrJrget_dataset_infoss' rP)r&rIr(rHdynamic_modules_pathrGc KsDt|f|||||d|}t|j}t|jjpB|jjddgS)a Get the list of available config names for a particular dataset. Args: path (``str``): path to the dataset processing script with the dataset builder. Can be either: - a local path to processing script or the directory containing the script (if the script has the same name as the directory), e.g. ``'./dataset/squad'`` or ``'./dataset/squad/squad.py'`` - a dataset identifier on the Hugging Face Hub (list all available datasets and ids with ``datasets.list_datasets()``) e.g. ``'squad'``, ``'glue'`` or ``'openai/webtext'`` revision (Optional ``Union[str, datasets.Version]``): If specified, the dataset module will be loaded from the datasets repository at this version. By default: - it is set to the local version of the lib. - it will also try to load it from the main branch if it's not available at the local version of the lib. Specifying a version that is different from your local version of the lib might cause compatibility issues. download_config (:class:`DownloadConfig`, optional): Specific download configuration parameters. download_mode (:class:`DownloadMode`, default ``REUSE_DATASET_IF_EXISTS``): Download/generate mode. dynamic_modules_path (Optional str, defaults to HF_MODULES_CACHE / "datasets_modules", i.e. ~/.cache/huggingface/modules/datasets_modules): Optional path to the directory in which the dynamic modules are saved. It must have been initialized with :obj:`init_dynamic_modules`. By default the datasets and metrics are stored inside the `datasets_modules` module. data_files (:obj:`Union[Dict, List, str]`, optional): Defining the data_files of the dataset configuration. **download_kwargs (additional keyword arguments): optional attributes for DownloadConfig() which will override the attributes in download_config if supplied, for example ``use_auth_token`` Example: ```py >>> from datasets import get_dataset_config_names >>> get_dataset_config_names("glue") ['cola', 'sst2', 'mrpc', 'qqp', 'stsb', 'mnli', 'mnli_mismatched', 'mnli_matched', 'qnli', 'rte', 'wnli', 'ax'] ``` )rIr(rHrQrGrKdefault)rrr.listZbuilder_configskeysZbuilder_kwargsget) r&rIr(rHrQrGr;r<r=rrrrOs4 rO)r&rKrGr(rHrIrJreturnc  stf||||||d|}|j} | jdkryH|r<|jnt}|dk rP||_fdd|jt|j|dD| _Wn,t k r} zt d| WYdd} ~ XnX| S)aFGet the meta information (DatasetInfo) about a dataset for a particular config Args: path (``str``): path to the dataset processing script with the dataset builder. Can be either: - a local path to processing script or the directory containing the script (if the script has the same name as the directory), e.g. ``'./dataset/squad'`` or ``'./dataset/squad/squad.py'`` - a dataset identifier on the Hugging Face Hub (list all available datasets and ids with ``datasets.list_datasets()``) e.g. ``'squad'``, ``'glue'`` or ``'openai/webtext'`` config_name (:obj:`str`, optional): Defining the name of the dataset configuration. data_files (:obj:`str` or :obj:`Sequence` or :obj:`Mapping`, optional): Path(s) to source data file(s). download_config (:class:`~download.DownloadConfig`, optional): Specific download configuration parameters. download_mode (:class:`DownloadMode`, default ``REUSE_DATASET_IF_EXISTS``): Download/generate mode. revision (:class:`~utils.Version` or :obj:`str`, optional): Version of the dataset script to load: - For datasets in the `huggingface/datasets` library on GitHub like "squad", the default version of the module is the local version of the lib. You can specify a different version from your local version of the lib (e.g. "main" or "1.2.0") but it might cause compatibility issues. - For community datasets like "lhoestq/squad" that have their own git repository on the Datasets Hub, the default version "main" corresponds to the "main" branch. You can specify a different version that the default "main" by using a commit sha or a git tag of the dataset repository. use_auth_token (``str`` or :obj:`bool`, optional): Optional string or boolean to use as Bearer token for remote files on the Datasets Hub. If True, will get token from `"~/.huggingface"`. **config_kwargs (additional keyword arguments): optional attributes for builder class which will override the attributes if supplied. )namerGr(rHrIrJNcsi|]}|jd|jqS))rWZ dataset_name)rW)rZsplit_generator)r&rrrN`sz+get_dataset_config_info..) base_pathr(z>> from datasets import get_dataset_split_names >>> get_dataset_split_names('rotten_tomatoes') ['train', 'validation', 'test'] ``` )rKrGr(rHrIrJ)rLrSrZrT) r&rKrGr(rHrIrJrMrYrrrget_dataset_split_namesks)r^)TF)TF)N)N)NNNNN)NNNNN)NNNNNN)NNNNNN)/__doc__r/r1r6pathlibrtypingrrrrrrr!Zdownload.download_configr Zdownload.download_managerr Z#download.streaming_download_managerr rYr loadrrrrZutils.file_utilsrZ utils.loggingrZ utils.versionrrlogger ValueErrorrr"r%strrErFboolrPrOrLr^rrrrsV           &%H9@=Z6