Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
10K - 100K
Tags:
long context
parquet-converter
commited on
Commit
•
30a2b0d
1
Parent(s):
f9bd921
Update parquet files
Browse files- README.md +0 -55
- arxiv-classification.py +0 -112
- val_data.txt → default/arxiv-classification-test.parquet +2 -2
- test_data.txt → default/arxiv-classification-train-00000-of-00004.parquet +2 -2
- train_data.txt → default/arxiv-classification-train-00001-of-00004.parquet +2 -2
- default/arxiv-classification-train-00002-of-00004.parquet +3 -0
- default/arxiv-classification-train-00003-of-00004.parquet +3 -0
- default/arxiv-classification-validation.parquet +3 -0
- no_ref/arxiv-classification-test.parquet +3 -0
- no_ref/arxiv-classification-train-00000-of-00004.parquet +3 -0
- no_ref/arxiv-classification-train-00001-of-00004.parquet +3 -0
- no_ref/arxiv-classification-train-00002-of-00004.parquet +3 -0
- no_ref/arxiv-classification-train-00003-of-00004.parquet +3 -0
- no_ref/arxiv-classification-validation.parquet +3 -0
README.md
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
---
|
2 |
-
language: en
|
3 |
-
task_categories:
|
4 |
-
- text-classification
|
5 |
-
tags:
|
6 |
-
- long context
|
7 |
-
task_ids:
|
8 |
-
- multi-class-classification
|
9 |
-
- topic-classification
|
10 |
-
size_categories: 10K<n<100K
|
11 |
-
---
|
12 |
-
|
13 |
-
**Arxiv Classification: a classification of Arxiv Papers (11 classes).**
|
14 |
-
|
15 |
-
This dataset is intended for long context classification (documents have all > 4k tokens). \
|
16 |
-
Copied from "Long Document Classification From Local Word Glimpses via Recurrent Attention Learning"
|
17 |
-
```
|
18 |
-
@ARTICLE{8675939,
|
19 |
-
author={He, Jun and Wang, Liqun and Liu, Liu and Feng, Jiao and Wu, Hao},
|
20 |
-
journal={IEEE Access},
|
21 |
-
title={Long Document Classification From Local Word Glimpses via Recurrent Attention Learning},
|
22 |
-
year={2019},
|
23 |
-
volume={7},
|
24 |
-
number={},
|
25 |
-
pages={40707-40718},
|
26 |
-
doi={10.1109/ACCESS.2019.2907992}
|
27 |
-
}
|
28 |
-
```
|
29 |
-
* See: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8675939
|
30 |
-
* See: https://github.com/LiqunW/Long-document-dataset
|
31 |
-
|
32 |
-
It contains 11 slightly unbalanced classes, 33k Arxiv Papers divided into 3 splits: train (28k), val (2.5k) and test (2.5k).
|
33 |
-
|
34 |
-
2 configs:
|
35 |
-
* default
|
36 |
-
* no_ref, removes references to the class inside the document (eg: [cs.LG] -> [])
|
37 |
-
|
38 |
-
Compatible with [run_glue.py](https://github.com/huggingface/transformers/tree/master/examples/pytorch/text-classification) script:
|
39 |
-
```
|
40 |
-
export MODEL_NAME=roberta-base
|
41 |
-
export MAX_SEQ_LENGTH=512
|
42 |
-
|
43 |
-
python run_glue.py \
|
44 |
-
--model_name_or_path $MODEL_NAME \
|
45 |
-
--dataset_name ccdv/arxiv-classification \
|
46 |
-
--do_train \
|
47 |
-
--do_eval \
|
48 |
-
--max_seq_length $MAX_SEQ_LENGTH \
|
49 |
-
--per_device_train_batch_size 8 \
|
50 |
-
--gradient_accumulation_steps 4 \
|
51 |
-
--learning_rate 2e-5 \
|
52 |
-
--num_train_epochs 1 \
|
53 |
-
--max_eval_samples 500 \
|
54 |
-
--output_dir tmp/arxiv
|
55 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arxiv-classification.py
DELETED
@@ -1,112 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
import os
|
3 |
-
|
4 |
-
import datasets
|
5 |
-
from datasets.tasks import TextClassification
|
6 |
-
|
7 |
-
_CITATION = None
|
8 |
-
|
9 |
-
|
10 |
-
_DESCRIPTION = """
|
11 |
-
Arxiv Classification Dataset: a classification of Arxiv Papers (11 classes).
|
12 |
-
It contains 11 slightly unbalanced classes, 33k Arxiv Papers divided into 3 splits: train (23k), val (5k) and test (5k).
|
13 |
-
Copied from "Long Document Classification From Local Word Glimpses via Recurrent Attention Learning" by JUN HE LIQUN WANG LIU LIU, JIAO FENG AND HAO WU
|
14 |
-
See: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8675939
|
15 |
-
See: https://github.com/LiqunW/Long-document-dataset
|
16 |
-
"""
|
17 |
-
|
18 |
-
_LABELS = [
|
19 |
-
"math.AC",
|
20 |
-
"cs.CV",
|
21 |
-
"cs.AI",
|
22 |
-
"cs.SY",
|
23 |
-
"math.GR",
|
24 |
-
"cs.CE",
|
25 |
-
"cs.PL",
|
26 |
-
"cs.IT",
|
27 |
-
"cs.DS",
|
28 |
-
"cs.NE",
|
29 |
-
"math.ST"
|
30 |
-
]
|
31 |
-
|
32 |
-
|
33 |
-
class ArxivClassificationConfig(datasets.BuilderConfig):
|
34 |
-
"""BuilderConfig for ArxivClassification."""
|
35 |
-
|
36 |
-
def __init__(self, **kwargs):
|
37 |
-
"""BuilderConfig for ArxivClassification.
|
38 |
-
Args:
|
39 |
-
**kwargs: keyword arguments forwarded to super.
|
40 |
-
"""
|
41 |
-
super(ArxivClassificationConfig, self).__init__(**kwargs)
|
42 |
-
|
43 |
-
|
44 |
-
class ArxivClassificationDataset(datasets.GeneratorBasedBuilder):
|
45 |
-
"""ArxivClassification Dataset: classification of Arxiv Papers (11 classes)."""
|
46 |
-
|
47 |
-
_DOWNLOAD_URL = "https://huggingface.co/datasets/ccdv/arxiv-classification/resolve/main/"
|
48 |
-
_TRAIN_FILE = "train_data.txt"
|
49 |
-
_VAL_FILE = "val_data.txt"
|
50 |
-
_TEST_FILE = "test_data.txt"
|
51 |
-
_LABELS_DICT = {label: i for i, label in enumerate(_LABELS)}
|
52 |
-
|
53 |
-
BUILDER_CONFIGS = [
|
54 |
-
ArxivClassificationConfig(
|
55 |
-
name="default",
|
56 |
-
version=datasets.Version("1.0.0"),
|
57 |
-
description="Arxiv Classification Dataset: A classification task of Arxiv Papers (11 classes)",
|
58 |
-
),
|
59 |
-
ArxivClassificationConfig(
|
60 |
-
name="no_ref",
|
61 |
-
version=datasets.Version("1.0.0"),
|
62 |
-
description="Arxiv Classification Dataset: A classification task of Arxiv Papers (11 classes)",
|
63 |
-
),
|
64 |
-
]
|
65 |
-
|
66 |
-
DEFAULT_CONFIG_NAME = "default"
|
67 |
-
|
68 |
-
def _info(self):
|
69 |
-
return datasets.DatasetInfo(
|
70 |
-
description=_DESCRIPTION,
|
71 |
-
features=datasets.Features(
|
72 |
-
{
|
73 |
-
"text": datasets.Value("string"),
|
74 |
-
"label": datasets.features.ClassLabel(names=_LABELS),
|
75 |
-
}
|
76 |
-
),
|
77 |
-
supervised_keys=None,
|
78 |
-
citation=_CITATION,
|
79 |
-
task_templates=[TextClassification(
|
80 |
-
text_column="text", label_column="label")],
|
81 |
-
)
|
82 |
-
|
83 |
-
def _split_generators(self, dl_manager):
|
84 |
-
train_path = dl_manager.download_and_extract(self._TRAIN_FILE)
|
85 |
-
val_path = dl_manager.download_and_extract(self._VAL_FILE)
|
86 |
-
test_path = dl_manager.download_and_extract(self._TEST_FILE)
|
87 |
-
|
88 |
-
return [
|
89 |
-
datasets.SplitGenerator(
|
90 |
-
name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}
|
91 |
-
),
|
92 |
-
datasets.SplitGenerator(
|
93 |
-
name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path}
|
94 |
-
),
|
95 |
-
datasets.SplitGenerator(
|
96 |
-
name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}
|
97 |
-
),
|
98 |
-
]
|
99 |
-
|
100 |
-
def _generate_examples(self, filepath):
|
101 |
-
"""Generate ArxivClassification examples."""
|
102 |
-
with open(filepath, encoding="utf-8") as f:
|
103 |
-
for id_, row in enumerate(f):
|
104 |
-
data = json.loads(row)
|
105 |
-
label = self._LABELS_DICT[data["label"]]
|
106 |
-
text = data["text"]
|
107 |
-
|
108 |
-
if self.config.name == "no_ref":
|
109 |
-
for _ in _LABELS:
|
110 |
-
text = text.replace(_, "")
|
111 |
-
|
112 |
-
yield id_, {"text": text, "label": label}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val_data.txt → default/arxiv-classification-test.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:06d0b21c16ce2a804f053c7c90638d3c086825cffa20dc398e31313c9c5e0363
|
3 |
+
size 73951438
|
test_data.txt → default/arxiv-classification-train-00000-of-00004.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7d9d56ee5f00232c59d2de0ad0b3762e40ef72abc453c971846e51d8702c4bc2
|
3 |
+
size 274956545
|
train_data.txt → default/arxiv-classification-train-00001-of-00004.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c03c937abda9bae87d610bf2a1002b302fe6cfac0473bc9d1a205481949821de
|
3 |
+
size 271566831
|
default/arxiv-classification-train-00002-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2da1e54b870de155db4c3d99f00d4869cf1aa3351ed27867be32fe7a2dfb5557
|
3 |
+
size 271883923
|
default/arxiv-classification-train-00003-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8914f514bc067d45d27a6c8c58acb0afaa7f7a8357d3d6dcb606b35d56ec2478
|
3 |
+
size 42971126
|
default/arxiv-classification-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:48b721514098c5e104c68ab238db0d8cb57cc84ecc776f34bb3d7ceb406771e2
|
3 |
+
size 75403983
|
no_ref/arxiv-classification-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e323c6883de6c92cca4646b07bacd7b1064cc30fad9bceecbc317adf091197d
|
3 |
+
size 73953016
|
no_ref/arxiv-classification-train-00000-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6c3b1368c38cdacee724b6e8dba54a7664c8474e937f3e4a68448a0503c13d54
|
3 |
+
size 274907447
|
no_ref/arxiv-classification-train-00001-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b78c0afe5994519221820faf801547321e5c9a72d504b97bee1631245941743
|
3 |
+
size 271572172
|
no_ref/arxiv-classification-train-00002-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c55f17b9aa9228ee9da7cadb1f763ed96fe2bdca69011cb94abf47bcb0d36f99
|
3 |
+
size 271879985
|
no_ref/arxiv-classification-train-00003-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:19e0c3484bd16d8ce35b8449a86ae588280274349482904408f18f0b6900bc48
|
3 |
+
size 42959435
|
no_ref/arxiv-classification-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cb03e6afcce1d4009c7eb0de5235a515f0f163df333cf0446cabf9240ab330a3
|
3 |
+
size 75393985
|