Convert dataset to Parquet

#3
by albertvillanova HF staff - opened
README.md CHANGED
@@ -19,6 +19,7 @@ task_ids:
19
  - sentiment-classification
20
  pretty_name: Amazon Review Polarity
21
  dataset_info:
 
22
  features:
23
  - name: label
24
  dtype:
@@ -30,7 +31,6 @@ dataset_info:
30
  dtype: string
31
  - name: content
32
  dtype: string
33
- config_name: amazon_polarity
34
  splits:
35
  - name: train
36
  num_bytes: 1604364432
@@ -38,8 +38,16 @@ dataset_info:
38
  - name: test
39
  num_bytes: 178176193
40
  num_examples: 400000
41
- download_size: 688339454
42
  dataset_size: 1782540625
 
 
 
 
 
 
 
 
43
  train-eval-index:
44
  - config: amazon_polarity
45
  task: text-classification
 
19
  - sentiment-classification
20
  pretty_name: Amazon Review Polarity
21
  dataset_info:
22
+ config_name: amazon_polarity
23
  features:
24
  - name: label
25
  dtype:
 
31
  dtype: string
32
  - name: content
33
  dtype: string
 
34
  splits:
35
  - name: train
36
  num_bytes: 1604364432
 
38
  - name: test
39
  num_bytes: 178176193
40
  num_examples: 400000
41
+ download_size: 1145430497
42
  dataset_size: 1782540625
43
+ configs:
44
+ - config_name: amazon_polarity
45
+ data_files:
46
+ - split: train
47
+ path: amazon_polarity/train-*
48
+ - split: test
49
+ path: amazon_polarity/test-*
50
+ default: true
51
  train-eval-index:
52
  - config: amazon_polarity
53
  task: text-classification
amazon_polarity.py DELETED
@@ -1,126 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- """The amazon polarity dataset for text classification."""
16
-
17
-
18
- import csv
19
-
20
- import datasets
21
-
22
-
23
- _CITATION = """\
24
- @inproceedings{mcauley2013hidden,
25
- title={Hidden factors and hidden topics: understanding rating dimensions with review text},
26
- author={McAuley, Julian and Leskovec, Jure},
27
- booktitle={Proceedings of the 7th ACM conference on Recommender systems},
28
- pages={165--172},
29
- year={2013}
30
- }
31
- """
32
-
33
- _DESCRIPTION = """\
34
- The Amazon reviews dataset consists of reviews from amazon.
35
- The data span a period of 18 years, including ~35 million reviews up to March 2013.
36
- Reviews include product and user information, ratings, and a plaintext review.
37
- """
38
-
39
- _HOMEPAGE = "https://registry.opendata.aws/"
40
-
41
- _LICENSE = "Apache License 2.0"
42
-
43
- _URLs = {
44
- "amazon_polarity": "https://s3.amazonaws.com/fast-ai-nlp/amazon_review_polarity_csv.tgz",
45
- }
46
-
47
-
48
- class AmazonPolarityConfig(datasets.BuilderConfig):
49
- """BuilderConfig for AmazonPolarity."""
50
-
51
- def __init__(self, **kwargs):
52
- """BuilderConfig for AmazonPolarity.
53
-
54
- Args:
55
- **kwargs: keyword arguments forwarded to super.
56
- """
57
- super(AmazonPolarityConfig, self).__init__(**kwargs)
58
-
59
-
60
- class AmazonPolarity(datasets.GeneratorBasedBuilder):
61
- """Amazon Polarity Classification Dataset."""
62
-
63
- VERSION = datasets.Version("3.0.0")
64
-
65
- BUILDER_CONFIGS = [
66
- AmazonPolarityConfig(
67
- name="amazon_polarity", version=VERSION, description="Amazon Polarity Classification Dataset."
68
- ),
69
- ]
70
-
71
- def _info(self):
72
- features = datasets.Features(
73
- {
74
- "label": datasets.features.ClassLabel(
75
- names=[
76
- "negative",
77
- "positive",
78
- ]
79
- ),
80
- "title": datasets.Value("string"),
81
- "content": datasets.Value("string"),
82
- }
83
- )
84
- return datasets.DatasetInfo(
85
- description=_DESCRIPTION,
86
- features=features,
87
- supervised_keys=None,
88
- homepage=_HOMEPAGE,
89
- license=_LICENSE,
90
- citation=_CITATION,
91
- )
92
-
93
- def _split_generators(self, dl_manager):
94
- """Returns SplitGenerators."""
95
- my_urls = _URLs[self.config.name]
96
- archive = dl_manager.download(my_urls)
97
- return [
98
- datasets.SplitGenerator(
99
- name=datasets.Split.TRAIN,
100
- gen_kwargs={
101
- "filepath": "/".join(["amazon_review_polarity_csv", "train.csv"]),
102
- "files": dl_manager.iter_archive(archive),
103
- },
104
- ),
105
- datasets.SplitGenerator(
106
- name=datasets.Split.TEST,
107
- gen_kwargs={
108
- "filepath": "/".join(["amazon_review_polarity_csv", "test.csv"]),
109
- "files": dl_manager.iter_archive(archive),
110
- },
111
- ),
112
- ]
113
-
114
- def _generate_examples(self, filepath, files):
115
- """Yields examples."""
116
- for path, f in files:
117
- if path == filepath:
118
- lines = (line.decode("utf-8") for line in f)
119
- data = csv.reader(lines, delimiter=",", quoting=csv.QUOTE_ALL)
120
- for id_, row in enumerate(data):
121
- yield id_, {
122
- "title": row[1],
123
- "content": row[2],
124
- "label": int(row[0]) - 1,
125
- }
126
- break
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
amazon_polarity/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65613cc6ec1ab30e19c4dcb8d8fa5612159d77bfa493704b4a9a9c167424992e
3
+ size 117422360
amazon_polarity/train-00000-of-00004.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57c367f8c74210dde3742b17d103af33820df3af39d029f2a5051a6f87810661
3
+ size 259761770
amazon_polarity/train-00001-of-00004.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14c7fee8f066fffc29eb906f80581836cca10218509a8ccf9898ff2a0c48f310
3
+ size 258363554
amazon_polarity/train-00002-of-00004.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5af7b024d3c4b759c1538b1987ece5bac47ef49ee98f6731fd2336caac283dc9
3
+ size 255471883
amazon_polarity/train-00003-of-00004.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:04dcdf40f04b70dd213b910468049196c73e405decced4d292e10412bf248875
3
+ size 254410930
dataset_infos.json DELETED
@@ -1 +0,0 @@
1
- {"amazon_polarity": {"description": "The Amazon reviews dataset consists of reviews from amazon.\nThe data span a period of 18 years, including ~35 million reviews up to March 2013.\nReviews include product and user information, ratings, and a plaintext review.\n", "citation": "@inproceedings{mcauley2013hidden,\n title={Hidden factors and hidden topics: understanding rating dimensions with review text},\n author={McAuley, Julian and Leskovec, Jure},\n booktitle={Proceedings of the 7th ACM conference on Recommender systems},\n pages={165--172},\n year={2013}\n}\n", "homepage": "https://registry.opendata.aws/", "license": "Apache License 2.0", "features": {"label": {"num_classes": 2, "names": ["negative", "positive"], "id": null, "_type": "ClassLabel"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "content": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "amazon_polarity", "config_name": "amazon_polarity", "version": {"version_str": "3.0.0", "description": null, "major": 3, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1604364432, "num_examples": 3600000, "dataset_name": "amazon_polarity"}, "test": {"name": "test", "num_bytes": 178176193, "num_examples": 400000, "dataset_name": "amazon_polarity"}}, "download_checksums": {"https://s3.amazonaws.com/fast-ai-nlp/amazon_review_polarity_csv.tgz": {"num_bytes": 688339454, "checksum": "d2a3ee7a214497a5d1b8eaed7c8d7ba2737de00ada3b0ec46243983efa100361"}}, "download_size": 688339454, "post_processing_size": null, "dataset_size": 1782540625, "size_in_bytes": 2470880079}}