| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | """This loads the fewshot-pretraining dataset.""" |
| |
|
| | import json |
| | import os |
| | import pandas as pd |
| |
|
| | import datasets |
| |
|
| |
|
| | |
| | |
| | _CITATION = """\ |
| | @InProceedings{huggingface:dataset, |
| | title = {A great new dataset}, |
| | author={huggingface, Inc. |
| | }, |
| | year={2020} |
| | } |
| | """ |
| |
|
| | |
| | _DESCRIPTION = """\ |
| | The Fewshot Table dataset consists of tables that naturally occur on the web, that are formatted as few-shot tasks for fine-tuning language models to improve their few-shot performance. The dataset consists of approximately 413K tables that are extracted from the WDC Web Table Corpora 2015, which is released under the Apache-2.0 license. The WDC Web Table Corpora "contains vast amounts of HTML tables. [...] The Web Data Commons project extracts relational Web tables from the Common Crawl, the largest and most up-to-date Web corpus that is currently available to the public." |
| | """ |
| |
|
| | |
| | _HOMEPAGE = "" |
| |
|
| | _LICENSE = "Apache 2.0" |
| |
|
| | |
| | |
| |
|
| | _URLS = { |
| | "data_0": ["https://huggingface.co/datasets/JeremyAlain/123_test/raw/main/data/files_0.jsonl"], |
| | "data_1": ["https://huggingface.co/datasets/JeremyAlain/123_test/raw/main/data/files_1.jsonl"], |
| | "data_2": ["https://huggingface.co/datasets/JeremyAlain/123_test/raw/main/data/files_2.jsonl"], |
| |
|
| | } |
| | logger = datasets.logging.get_logger(__name__) |
| |
|
| |
|
| | class FewshotPretraining(datasets.GeneratorBasedBuilder): |
| | """The Fewshot Table dataset consists of tables that naturally occur on the web, that are formatted as few-shot tasks for fine-tuning language models to improve their few-shot performance. The dataset consists of approximately 413K tables that are extracted from the WDC Web Table Corpora 2015, which is released under the Apache-2.0 license. The WDC Web Table Corpora "contains vast amounts of HTML tables. [...] The Web Data Commons project extracts relational Web tables from the Common Crawl, the largest and most up-to-date Web corpus that is currently available to the public." |
| | """ |
| |
|
| | VERSION = datasets.Version("1.1.0") |
| |
|
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| | BUILDER_CONFIGS = [ |
| | datasets.BuilderConfig(name="data_0", version=VERSION, description="This part of my dataset covers data_0"), |
| | datasets.BuilderConfig(name="data_1", version=VERSION, description="This part of my dataset covers data_1"), |
| | datasets.BuilderConfig(name="data_2", version=VERSION, description="This part of my dataset covers data_2"), |
| | ] |
| |
|
| | DEFAULT_CONFIG_NAME = "data_0" |
| |
|
| | def _info(self): |
| | features = datasets.Features( |
| | { |
| |
|
| | "task": datasets.Value("string"), |
| | "input": datasets.Value("string"), |
| | "output": datasets.Value("string"), |
| | "options": datasets.Sequence([datasets.Value("string")]), |
| | "pageTitle": datasets.Value("string"), |
| | "outputColName": datasets.Value("string"), |
| | "url": datasets.Value("string"), |
| | "wdcFile": datasets.Value("string") |
| | } |
| | ) |
| | return datasets.DatasetInfo( |
| | |
| | description=_DESCRIPTION, |
| | |
| | features=features, |
| | |
| | |
| | |
| | |
| | |
| | |
| | license=_LICENSE, |
| | |
| | citation=_CITATION, |
| | ) |
| |
|
| | def _split_generators(self, dl_manager): |
| | |
| | |
| |
|
| | |
| | |
| | |
| | urls = _URLS[self.config.name] |
| |
|
| | local_extracted_path = dl_manager.download_and_extract(urls)[0] |
| | all_file_names_for_dataset_pd = pd.read_json(local_extracted_path, lines=True, orient="records") |
| | all_file_names_for_dataset = all_file_names_for_dataset_pd.values.tolist() |
| | all_file_names_for_dataset = [file_name[0] for file_name in all_file_names_for_dataset] |
| |
|
| | all_local_extracted_paths = dl_manager.download_and_extract(all_file_names_for_dataset) |
| | return [ |
| | datasets.SplitGenerator( |
| | name=datasets.Split.TRAIN, |
| | |
| | gen_kwargs={ |
| | "file_paths": all_local_extracted_paths, |
| | }, |
| | ) |
| | ] |
| |
|
| |
|
| | |
| | def _generate_examples(self, file_paths): |
| | |
| | for file_idx, file_path in enumerate(file_paths): |
| | data = pd.read_json(file_path, orient="records", lines=True) |
| | for i in range(data.shape[0]): |
| | row = data.iloc[i] |
| | |
| | key = str(row["task"]) + "{}_{}".format(file_idx, i) |
| | yield key, { |
| | "task": data["task"], |
| | "input": data["input"], |
| | "output": data["output"], |
| | "options": data["options"], |
| | "pageTitle": data["pageTitle"], |
| | "outputColName": data["outputColName"], |
| | "url": data["url"], |
| | "wdcFile": data["wdcFile"], |
| | } |
| |
|