repo_id stringlengths 15 89 | file_path stringlengths 27 180 | content stringlengths 1 2.23M | __index_level_0__ int64 0 0 |
|---|---|---|---|
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/use_with_jax.mdx | # Use with JAX
This document is a quick introduction to using `datasets` with JAX, with a particular focus on how to get
`jax.Array` objects out of our datasets, and how to use them to train JAX models.
<Tip>
`jax` and `jaxlib` are required to reproduce to code above, so please make sure you
install them as `pip ins... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/metrics.mdx | # Evaluate predictions
<Tip warning={true}>
Metrics is deprecated in π€ Datasets. To learn more about how to use metrics, take a look at the library π€ [Evaluate](https://huggingface.co/docs/evaluate/index)! In addition to metrics, you can find more tools for evaluating models and datasets.
</Tip>
π€ Datasets provi... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/about_cache.mdx | # The cache
The cache is one of the reasons why π€ Datasets is so efficient. It stores previously downloaded and processed datasets so when you need to use them again, they are reloaded directly from the cache. This avoids having to download a dataset all over again, or reapplying processing functions. Even after you ... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/quickstart.mdx | <!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/share.mdx | # Share a dataset using the CLI
At Hugging Face, we are on a mission to democratize good Machine Learning and we believe in the value of open source. That's why we designed π€ Datasets so that anyone can share a dataset with the greater ML community. There are currently thousands of datasets in over 100 languages in t... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/_config.py | # docstyle-ignore
INSTALL_CONTENT = """
# Datasets installation
! pip install datasets transformers
# To install from source instead of the last release, comment the command above and uncomment the following one.
# ! pip install git+https://github.com/huggingface/datasets.git
"""
notebook_first_cells = [{"type": "code... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/image_process.mdx | # Process image data
This guide shows specific methods for processing image datasets. Learn how to:
- Use [`~Dataset.map`] with image dataset.
- Apply data augmentations to a dataset with [`~Dataset.set_transform`].
For a guide on how to process any type of dataset, take a look at the <a class="underline decoration-... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/upload_dataset.mdx | # Share a dataset to the Hub
The [Hub](https://huggingface.co/datasets) is home to an extensive collection of community-curated and popular research datasets. We encourage you to share your dataset to the Hub to help grow the ML community and accelerate progress for everyone. All contributions are welcome; adding a da... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/installation.md | # Installation
Before you start, you'll need to setup your environment and install the appropriate packages. π€ Datasets is tested on **Python 3.7+**.
<Tip>
If you want to use π€ Datasets with TensorFlow or PyTorch, you'll need to install them separately. Refer to the [TensorFlow installation page](https://www.tenso... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/image_load.mdx | # Load image data
Image datasets have [`Image`] type columns, which contain PIL objects.
<Tip>
To work with image datasets, you need to have the `vision` dependency installed. Check out the [installation](./installation#vision) guide to learn how to install it.
</Tip>
When you load an image dataset and call the i... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/about_arrow.md | # Datasets π€ Arrow
## What is Arrow?
[Arrow](https://arrow.apache.org/) enables large amounts of data to be processed and moved quickly. It is a specific data format that stores data in a columnar memory layout. This provides several significant advantages:
* Arrow's standard format allows [zero-copy reads](https:/... | 0 |
hf_public_repos/datasets/docs | hf_public_repos/datasets/docs/source/repository_structure.mdx | # Structure your repository
To host and share your dataset, create a dataset repository on the Hugging Face Hub and upload your data files.
This guide will show you how to structure your dataset repository when you upload it.
A dataset with a supported structure and file format (`.txt`, `.csv`, `.parquet`, `.jsonl`, ... | 0 |
hf_public_repos/datasets/docs/source | hf_public_repos/datasets/docs/source/package_reference/main_classes.mdx | # Main classes
## DatasetInfo
[[autodoc]] datasets.DatasetInfo
## Dataset
The base class [`Dataset`] implements a Dataset backed by an Apache Arrow table.
[[autodoc]] datasets.Dataset
- add_column
- add_item
- from_file
- from_buffer
- from_pandas
- from_dict
- from_generator
- dat... | 0 |
hf_public_repos/datasets/docs/source | hf_public_repos/datasets/docs/source/package_reference/table_classes.mdx | # Table Classes
Each `Dataset` object is backed by a PyArrow Table.
A Table can be loaded from either the disk (memory mapped) or in memory.
Several Table types are available, and they all inherit from [`table.Table`].
## Table
[[autodoc]] datasets.table.Table
- validate
- equals
- to_batches
- to_py... | 0 |
hf_public_repos/datasets/docs/source | hf_public_repos/datasets/docs/source/package_reference/task_templates.mdx | # Task templates
<Tip warning={true}>
The Task API is deprecated in favor of [`train-eval-index`](https://github.com/huggingface/hub-docs/blob/9ab2555e1c146122056aba6f89af404a8bc9a6f1/datasetcard.md?plain=1#L90-L106) and will be removed in the next major release.
</Tip>
The tasks supported by [`Dataset.prepare_for_... | 0 |
hf_public_repos/datasets/docs/source | hf_public_repos/datasets/docs/source/package_reference/builder_classes.mdx | # Builder classes
## Builders
π€ Datasets relies on two main classes during the dataset building process: [`DatasetBuilder`] and [`BuilderConfig`].
[[autodoc]] datasets.DatasetBuilder
[[autodoc]] datasets.GeneratorBasedBuilder
[[autodoc]] datasets.BeamBasedBuilder
[[autodoc]] datasets.ArrowBasedBuilder
[[autodoc... | 0 |
hf_public_repos/datasets/docs/source | hf_public_repos/datasets/docs/source/package_reference/loading_methods.mdx | # Loading methods
Methods for listing and loading datasets and metrics:
## Datasets
[[autodoc]] datasets.list_datasets
[[autodoc]] datasets.load_dataset
[[autodoc]] datasets.load_from_disk
[[autodoc]] datasets.load_dataset_builder
[[autodoc]] datasets.get_dataset_config_names
[[autodoc]] datasets.get_dataset_in... | 0 |
hf_public_repos/datasets/docs/source | hf_public_repos/datasets/docs/source/package_reference/utilities.mdx | # Utilities
## Configure logging
π€ Datasets strives to be transparent and explicit about how it works, but this can be quite verbose at times. We have included a series of logging methods which allow you to easily adjust the level of verbosity of the entire library. Currently the default verbosity of the library is ... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/benchmarks/benchmark_indices_mapping.py | import json
import os
import tempfile
import datasets
from utils import generate_example_dataset, get_duration
SPEED_TEST_N_EXAMPLES = 500_000
RESULTS_BASEPATH, RESULTS_FILENAME = os.path.split(__file__)
RESULTS_FILE_PATH = os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))
@get_d... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/benchmarks/benchmark_iterating.py | import json
import os
import tempfile
import datasets
from utils import generate_example_dataset, get_duration
SPEED_TEST_N_EXAMPLES = 50_000
SMALL_TEST = 5_000
RESULTS_BASEPATH, RESULTS_FILENAME = os.path.split(__file__)
RESULTS_FILE_PATH = os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/benchmarks/format.py | import json
import sys
def format_json_to_md(input_json_file, output_md_file):
with open(input_json_file, encoding="utf-8") as f:
results = json.load(f)
output_md = ["<details>", "<summary>Show updated benchmarks!</summary>", " "]
for benchmark_name in sorted(results):
benchmark_res = re... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/benchmarks/benchmark_map_filter.py | import json
import os
import tempfile
import transformers
import datasets
from utils import generate_example_dataset, get_duration
SPEED_TEST_N_EXAMPLES = 500_000
RESULTS_BASEPATH, RESULTS_FILENAME = os.path.split(__file__)
RESULTS_FILE_PATH = os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/benchmarks/utils.py | import timeit
import numpy as np
import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features.features import _ArrayXD
def get_duration(func):
def wrapper(*args, **kwargs):
starttime = timeit.default_timer()
_ = func(*args, **kwargs)
delta = timeit.default_timer()... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/benchmarks/benchmark_getitem_100B.py | import json
import os
from dataclasses import dataclass
import numpy as np
import pyarrow as pa
import datasets
from utils import get_duration
SPEED_TEST_N_EXAMPLES = 100_000_000_000
SPEED_TEST_CHUNK_SIZE = 10_000
RESULTS_BASEPATH, RESULTS_FILENAME = os.path.split(__file__)
RESULTS_FILE_PATH = os.path.join(RESULTS... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/benchmarks/benchmark_array_xd.py | import json
import os
import tempfile
import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features import Array2D
from utils import generate_examples, get_duration
SHAPE_TEST_1 = (30, 487)
SHAPE_TEST_2 = (36, 1024)
SPEED_TEST_SHAPE = (100, 100)
SPEED_TEST_N_EXAMPLES = 100
DEFAULT_FEATURES = ... | 0 |
hf_public_repos/datasets/benchmarks | hf_public_repos/datasets/benchmarks/results/benchmark_map_filter.json | {"num examples": 500000, "map identity": 10.19139202599763, "map identity batched": 0.6804238399927272, "map no-op batched": 0.5342009569867514, "map no-op batched numpy": 0.5792830920108827, "map no-op batched pandas": 0.4343639040016569, "map no-op batched pytorch": 0.5403374370071106, "map no-op batched tensorflow":... | 0 |
hf_public_repos/datasets/benchmarks | hf_public_repos/datasets/benchmarks/results/benchmark_array_xd.json | {"write_array2d": 0.14168284999323077, "read_unformated after write_array2d": 0.04353281999647152, "read_formatted_as_numpy after write_array2d": 0.1285462469968479, "read_batch_unformated after write_array2d": 0.023109222995117307, "read_batch_formatted_as_numpy after write_array2d": 0.011352884990628809, "read_col_un... | 0 |
hf_public_repos/datasets/benchmarks | hf_public_repos/datasets/benchmarks/results/benchmark_iterating.json | {"num examples": 50000, "read 5000": 0.2152090710005723, "read 50000": 2.077654693988734, "read_batch 50000 10": 1.5041199039987987, "read_batch 50000 100": 1.5411947140091797, "read_batch 50000 1000": 1.4684901159926085, "read_formatted numpy 5000": 4.584776938994764, "read_formatted pandas 5000": 3.7457121399929747, ... | 0 |
hf_public_repos/datasets/benchmarks | hf_public_repos/datasets/benchmarks/results/benchmark_indices_mapping.json | {"num examples": 500000, "select": 0.03741131999413483, "sort": 0.7371353159978753, "shuffle": 0.17655655200360343, "train_test_split": 0.29633847798686475, "shard": 0.01452581599005498} | 0 |
hf_public_repos/datasets/benchmarks | hf_public_repos/datasets/benchmarks/results/benchmark_getitem_100B.json | {"num examples": 100000000000, "get_first_row": 0.00019991099999927542, "get_last_row": 5.4411000000698095e-05, "get_batch_of_1024_rows": 0.0004897069999998394, "get_batch_of_1024_random_rows": 0.01800621099999944} | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/templates/README.md | ---
TODO: Add YAML tags here. Copy-paste the tags obtained with the online tagging app: https://huggingface.co/spaces/huggingface/datasets-tagging
---
# Dataset Card for [Dataset Name]
## Table of Contents
- [Table of Contents](#table-of-contents)
- [Dataset Description](#dataset-description)
- [Dataset Summary](#d... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/templates/metric_card_template.md | # Metric Card for *Current Metric*
***Metric Card Instructions:*** *Copy this file into the relevant metric folder, then fill it out and save it as README.md. Feel free to take a look at existing metric cards if you'd like examples.*
## Metric Description
*Give a brief overview of this metric.*
## How to Use
*Give g... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/templates/new_dataset_script.py | # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/templates/README_guide.md | ---
YAML tags (full spec here: https://github.com/huggingface/hub-docs/blob/main/datasetcard.md?plain=1):
- copy-paste the tags obtained with the online tagging app: https://huggingface.co/spaces/huggingface/datasets-tagging
---
# Dataset Card Creation Guide
## Table of Contents
- [Dataset Card Creation Guide](#datas... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/notebooks/Overview.ipynb | # install datasets
!pip install datasets# Let's import the library. We typically only need at most two methods:
from datasets import list_datasets, load_dataset
from pprint import pprint# Currently available datasets
datasets = list_datasets()
print(f"π€© Currently {len(datasets)} datasets are available on the hub:")
... | 0 |
hf_public_repos/datasets | hf_public_repos/datasets/notebooks/README.md | <!---
Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/arrow_dataset.py | # Copyright 2020 The HuggingFace Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/data_files.py | import os
import re
from functools import partial
from glob import has_magic
from pathlib import Path, PurePath
from typing import Callable, Dict, List, Optional, Set, Tuple, Union
import huggingface_hub
from fsspec import get_fs_token_paths
from fsspec.implementations.http import HTTPFileSystem
from huggingface_hub i... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/iterable_dataset.py | import copy
import itertools
import sys
import warnings
from collections import Counter
from copy import deepcopy
from dataclasses import dataclass
from functools import partial
from itertools import cycle, islice
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Union
import numpy as ... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/config.py | import importlib
import importlib.metadata
import logging
import os
import platform
from pathlib import Path
from typing import Optional
from packaging import version
logger = logging.getLogger(__name__.split(".", 1)[0]) # to avoid circular import from .utils.logging
# Datasets
S3_DATASETS_BUCKET_PREFIX = "https:/... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/combine.py | from typing import List, Optional, TypeVar
from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .info import DatasetInfo
from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _interle... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/dataset_dict.py | import contextlib
import copy
import fnmatch
import json
import math
import posixpath
import re
import warnings
from io import BytesIO
from pathlib import Path
from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union
import fsspec
import numpy as np
from huggingface_hub import (
CommitOperationAdd... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/fingerprint.py | import inspect
import os
import random
import shutil
import tempfile
import weakref
from functools import wraps
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
import numpy as np
import xxhash
from . import config
from .naming import INVALID_WINDOWS_CHARACT... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/naming.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/arrow_writer.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# Unless required by applicable law or agreed to in wr... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/__init__.py | # flake8: noqa
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/arrow_reader.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/builder.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/metric.py | # Copyright 2020 The HuggingFace Datasets Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/inspect.py | # Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/distributed.py | from typing import TypeVar
from .arrow_dataset import Dataset, _split_by_node_map_style_dataset
from .iterable_dataset import IterableDataset, _split_by_node_iterable_dataset
DatasetType = TypeVar("DatasetType", Dataset, IterableDataset)
def split_dataset_by_node(dataset: DatasetType, rank: int, world_size: int) -... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/search.py | import importlib.util
import os
import tempfile
from pathlib import PurePath
from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Union
import fsspec
import numpy as np
from .utils import logging
from .utils import tqdm as hf_tqdm
if TYPE_CHECKING:
from .arrow_dataset import Dataset # noqa: F401... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/exceptions.py | # SPDX-License-Identifier: Apache-2.0
# Copyright 2023 The HuggingFace Authors.
class DatasetsError(Exception):
"""Base class for exceptions in this library."""
class DefunctDatasetError(DatasetsError):
"""The dataset has been defunct."""
class FileNotFoundDatasetsError(DatasetsError, FileNotFoundError):
... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/splits.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/table.py | import copy
import os
import warnings
from functools import partial
from itertools import groupby
from typing import TYPE_CHECKING, Callable, Iterator, List, Optional, Tuple, TypeVar, Union
import numpy as np
import pyarrow as pa
import pyarrow.compute as pc
from . import config
from .utils.logging import get_logger
... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/load.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/streaming.py | import importlib
import inspect
from functools import wraps
from typing import TYPE_CHECKING, Optional
from .download.download_config import DownloadConfig
from .download.streaming_download_manager import (
xbasename,
xdirname,
xet_parse,
xexists,
xgetsize,
xglob,
xgzip_open,
xisdir,
... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/info.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 0 |
hf_public_repos/datasets/src | hf_public_repos/datasets/src/datasets/keyhash.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/parallel/__init__.py | from .parallel import parallel_backend, parallel_map, ParallelBackendConfig # noqa F401
| 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/parallel/parallel.py | import contextlib
from multiprocessing import Pool, RLock
from tqdm.auto import tqdm
from ..utils import experimental, logging
logger = logging.get_logger(__name__)
class ParallelBackendConfig:
backend_name = None
@experimental
def parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, single... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/question_answering.py | from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Sequence, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class QuestionAnsweringExtractive(TaskTemplate):
# `task` is not a ClassVar since we want it to be part of the `asdict` output for JSO... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/image_classification.py | import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import ClassLabel, Features, Image
from .base import TaskTemplate
@dataclass(frozen=True)
class ImageClassification(TaskTemplate):
task: str = field(default="image-classification", metadata={"include_in_asdict_... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/language_modeling.py | from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class LanguageModeling(TaskTemplate):
task: str = field(default="language-modeling", metadata={"include_in_asdict_even_if_is_default": True})
... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/audio_classification.py | import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Audio, ClassLabel, Features
from .base import TaskTemplate
@dataclass(frozen=True)
class AudioClassification(TaskTemplate):
task: str = field(default="audio-classification", metadata={"include_in_asdict_... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/__init__.py | from typing import Optional
from ..utils.logging import get_logger
from .audio_classification import AudioClassification
from .automatic_speech_recognition import AutomaticSpeechRecognition
from .base import TaskTemplate
from .image_classification import ImageClassification
from .language_modeling import LanguageModel... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/text_classification.py | import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import ClassLabel, Features, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class TextClassification(TaskTemplate):
# `task` is not a ClassVar since we want it to be part of the `asdict` output fo... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/automatic_speech_recognition.py | import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Audio, Features, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class AutomaticSpeechRecognition(TaskTemplate):
task: str = field(default="automatic-speech-recognition", metadata={"include_... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/summarization.py | from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class Summarization(TaskTemplate):
# `task` is not a ClassVar since we want it to be part of the `asdict` output for JSON serialization
task... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/base.py | import abc
import copy
import dataclasses
from dataclasses import dataclass
from typing import ClassVar, Dict, Type, TypeVar
from ..features import Features
T = TypeVar("T", bound="TaskTemplate")
@dataclass(frozen=True)
class TaskTemplate(abc.ABC):
# `task` is not a ClassVar since we want it to be part of the ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/io/parquet.py | import os
from typing import BinaryIO, Optional, Union
import numpy as np
import pyarrow.parquet as pq
from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config
from ..features.features import FeatureType, _visit
from ..formatting import query_table
from ..packaged_modules import _PACKAGED_DATASETS_MO... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/io/generator.py | from typing import Callable, Optional
from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream
class GeneratorDatasetInputStream(AbstractDatasetInputStream):
def __init__(
self,
generator: Callable,
features: Optional... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/io/csv.py | import multiprocessing
import os
from typing import BinaryIO, Optional, Union
from .. import Dataset, Features, NamedSplit, config
from ..formatting import query_table
from ..packaged_modules.csv.csv import Csv
from ..utils import tqdm as hf_tqdm
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc i... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/io/text.py | from typing import Optional
from .. import Features, NamedSplit
from ..packaged_modules.text.text import Text
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc import AbstractDatasetReader
class TextDatasetReader(AbstractDatasetReader):
def __init__(
self,
path_or_paths: Nest... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/io/spark.py | from typing import Optional
import pyspark
from .. import Features, NamedSplit
from ..download import DownloadMode
from ..packaged_modules.spark.spark import Spark
from .abc import AbstractDatasetReader
class SparkDatasetReader(AbstractDatasetReader):
"""A dataset reader that reads from a Spark DataFrame.
... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/io/sql.py | import multiprocessing
from typing import TYPE_CHECKING, Optional, Union
from .. import Dataset, Features, config
from ..formatting import query_table
from ..packaged_modules.sql.sql import Sql
from ..utils import tqdm as hf_tqdm
from .abc import AbstractDatasetInputStream
if TYPE_CHECKING:
import sqlite3
i... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/io/json.py | import multiprocessing
import os
from typing import BinaryIO, Optional, Union
import fsspec
from .. import Dataset, Features, NamedSplit, config
from ..formatting import query_table
from ..packaged_modules.json.json import Json
from ..utils import tqdm as hf_tqdm
from ..utils.typing import NestedDataStructureLike, Pa... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/io/abc.py | from abc import ABC, abstractmethod
from typing import Optional, Union
from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit
from ..utils.typing import NestedDataStructureLike, PathLike
class AbstractDatasetReader(ABC):
def __init__(
self,
path_or_paths: ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/__init__.py | # flake8: noqa
__all__ = [
"Audio",
"Array2D",
"Array3D",
"Array4D",
"Array5D",
"ClassLabel",
"Features",
"Sequence",
"Value",
"Image",
"Translation",
"TranslationVariableLanguages",
]
from .audio import Audio
from .features import Array2D, Array3D, Array4D, Array5D, Cla... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/features.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/translation.py | from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union
import pyarrow as pa
if TYPE_CHECKING:
from .features import FeatureType
@dataclass
class Translation:
"""`FeatureConnector` for translations with fixed languages per example.
Here for ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/audio.py | import os
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union
import numpy as np
import pyarrow as pa
from .. import config
from ..download.download_config import DownloadConfig
from ..download.streaming_download_manager import xopen, ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/image.py | import os
import sys
import warnings
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union
import numpy as np
import pyarrow as pa
from .. import config
from ..download.download_config import DownloadConfig
from ..download.streamin... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/packaged_modules/__init__.py | import inspect
import re
from typing import Dict, List
from huggingface_hub.utils import insecure_hashlib
from .arrow import arrow
from .audiofolder import audiofolder
from .csv import csv
from .imagefolder import imagefolder
from .json import json
from .pandas import pandas
from .parquet import parquet
from .sql imp... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/webdataset/webdataset.py | import io
import json
from itertools import islice
from typing import Any, Callable, Dict, List
import numpy as np
import pyarrow as pa
import datasets
logger = datasets.utils.logging.get_logger(__name__)
class WebDataset(datasets.GeneratorBasedBuilder):
DEFAULT_WRITER_BATCH_SIZE = 100
IMAGE_EXTENSIONS: L... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/webdataset/_tenbin.py | #
# Copyright (c) 2017-2021 NVIDIA CORPORATION. All rights reserved.
# This file coems from the WebDataset library.
# See the LICENSE file for licensing terms (BSD-style).
#
"""
Binary tensor encodings for PyTorch and NumPy.
This defines efficient binary encodings for tensors. The format is 8 byte
aligned and can be ... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py | import collections
import itertools
import os
from dataclasses import dataclass
from typing import List, Optional, Tuple, Type
import pandas as pd
import pyarrow as pa
import pyarrow.json as paj
import datasets
from datasets.features.features import FeatureType
from datasets.tasks.base import TaskTemplate
logger = ... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/arrow/arrow.py | import itertools
from dataclasses import dataclass
from typing import Optional
import pyarrow as pa
import datasets
from datasets.table import table_cast
logger = datasets.utils.logging.get_logger(__name__)
@dataclass
class ArrowConfig(datasets.BuilderConfig):
"""BuilderConfig for Arrow."""
features: Opt... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/imagefolder/imagefolder.py | from typing import List
import datasets
from datasets.tasks import ImageClassification
from ..folder_based_builder import folder_based_builder
logger = datasets.utils.logging.get_logger(__name__)
class ImageFolderConfig(folder_based_builder.FolderBasedBuilderConfig):
"""BuilderConfig for ImageFolder."""
... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/generator/generator.py | from dataclasses import dataclass
from typing import Callable, Optional
import datasets
@dataclass
class GeneratorConfig(datasets.BuilderConfig):
generator: Optional[Callable] = None
gen_kwargs: Optional[dict] = None
features: Optional[datasets.Features] = None
def __post_init__(self):
asser... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/json/json.py | import io
import itertools
import json
from dataclasses import dataclass
from typing import Optional
import pyarrow as pa
import pyarrow.json as paj
import datasets
from datasets.table import table_cast
from datasets.utils.file_utils import readline
logger = datasets.utils.logging.get_logger(__name__)
@dataclass
... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/csv/csv.py | import itertools
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, Optional, Union
import pandas as pd
import pyarrow as pa
import datasets
import datasets.config
from datasets.features.features import require_storage_cast
from datasets.table import table_cast
from datasets.utils.py_util... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/text/text.py | import itertools
import warnings
from dataclasses import InitVar, dataclass
from io import StringIO
from typing import Optional
import pyarrow as pa
import datasets
from datasets.features.features import require_storage_cast
from datasets.table import table_cast
logger = datasets.utils.logging.get_logger(__name__)
... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/parquet/parquet.py | import itertools
from dataclasses import dataclass
from typing import List, Optional
import pyarrow as pa
import pyarrow.parquet as pq
import datasets
from datasets.table import table_cast
logger = datasets.utils.logging.get_logger(__name__)
@dataclass
class ParquetConfig(datasets.BuilderConfig):
"""BuilderCo... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/audiofolder/audiofolder.py | from typing import List
import datasets
from datasets.tasks import AudioClassification
from ..folder_based_builder import folder_based_builder
logger = datasets.utils.logging.get_logger(__name__)
class AudioFolderConfig(folder_based_builder.FolderBasedBuilderConfig):
"""Builder Config for AudioFolder."""
... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/spark/spark.py | import os
import posixpath
import uuid
from dataclasses import dataclass
from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union
import numpy as np
import pyarrow as pa
import datasets
from datasets.arrow_writer import ArrowWriter, ParquetWriter
from datasets.config import MAX_SHARD_SIZE
from dataset... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/pandas/pandas.py | 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 PandasConfig(datasets.BuilderConfig):
"""BuilderConfig for Pandas."""
features: Optional[datasets.Features] = None
... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/sql/sql.py | import sys
from dataclasses import dataclass
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
import pandas as pd
import pyarrow as pa
import datasets
import datasets.config
from datasets.features.features import require_storage_cast
from datasets.table import table_cast
if TYPE_CHECKING:
im... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/logging.py | # Copyright 2020 Optuna, Hugging Face
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/sharding.py | from typing import List
import numpy as np
def _number_of_shards_in_gen_kwargs(gen_kwargs: dict) -> int:
"""Return the number of possible shards according to the input gen_kwargs"""
# Having lists of different sizes makes sharding ambigious, raise an error in this case
# until we decide how to define sha... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.