pharaouk Joocjun commited on
Commit
4523f52
·
verified ·
0 Parent(s):

Duplicate from kaist-ai/CoT-Collection

Browse files

Co-authored-by: Se June Joo <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
+ *.model filter=lfs diff=lfs merge=lfs -text
14
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
15
+ *.npy filter=lfs diff=lfs merge=lfs -text
16
+ *.npz filter=lfs diff=lfs merge=lfs -text
17
+ *.onnx filter=lfs diff=lfs merge=lfs -text
18
+ *.ot filter=lfs diff=lfs merge=lfs -text
19
+ *.parquet filter=lfs diff=lfs merge=lfs -text
20
+ *.pb filter=lfs diff=lfs merge=lfs -text
21
+ *.pickle filter=lfs diff=lfs merge=lfs -text
22
+ *.pkl filter=lfs diff=lfs merge=lfs -text
23
+ *.pt filter=lfs diff=lfs merge=lfs -text
24
+ *.pth filter=lfs diff=lfs merge=lfs -text
25
+ *.rar filter=lfs diff=lfs merge=lfs -text
26
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
27
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ # Audio files - uncompressed
37
+ *.pcm filter=lfs diff=lfs merge=lfs -text
38
+ *.sam filter=lfs diff=lfs merge=lfs -text
39
+ *.raw filter=lfs diff=lfs merge=lfs -text
40
+ # Audio files - compressed
41
+ *.aac filter=lfs diff=lfs merge=lfs -text
42
+ *.flac filter=lfs diff=lfs merge=lfs -text
43
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
44
+ *.ogg filter=lfs diff=lfs merge=lfs -text
45
+ *.wav filter=lfs diff=lfs merge=lfs -text
46
+ # Image files - uncompressed
47
+ *.bmp filter=lfs diff=lfs merge=lfs -text
48
+ *.gif filter=lfs diff=lfs merge=lfs -text
49
+ *.png filter=lfs diff=lfs merge=lfs -text
50
+ *.tiff filter=lfs diff=lfs merge=lfs -text
51
+ # Image files - compressed
52
+ *.jpg filter=lfs diff=lfs merge=lfs -text
53
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
54
+ *.webp filter=lfs diff=lfs merge=lfs -text
55
+ data/CoT_collection_en.json filter=lfs diff=lfs merge=lfs -text
CoT-Collection.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ import json
17
+ import os
18
+
19
+ import datasets
20
+
21
+
22
+
23
+ _CITATION = """\
24
+ @article{kim2023cot,
25
+ title={The CoT Collection: Improving Zero-shot and Few-shot Learning of Language Models via Chain-of-Thought Fine-Tuning},
26
+ author={Kim, Seungone and Joo, Se June and Kim, Doyoung and Jang, Joel and Ye, Seonghyeon and Shin, Jamin and Seo, Minjoon},
27
+ journal={arXiv preprint arXiv:2305.14045},
28
+ year={2023}
29
+ }
30
+ """
31
+
32
+ _DESCRIPTION = """"""
33
+
34
+ _LICENSE = "CC BY 4.0"
35
+
36
+ _HOMEPAGE = "https://github.com/kaistAI/CoT-Collection"
37
+
38
+ _LANGUAGES = {
39
+ "en": "English",
40
+ }
41
+ # _ALL_LANGUAGES = "all_languages"
42
+
43
+
44
+
45
+ class CoTCollectionMultiConfig(datasets.BuilderConfig):
46
+ """BuilderConfig for CoTCollectionMultiConfig."""
47
+
48
+ def __init__(self, languages=None, **kwargs):
49
+ super(CoTCollectionMultiConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs),
50
+ self.languages = languages
51
+
52
+
53
+ class CoTCollection(datasets.GeneratorBasedBuilder):
54
+
55
+ BUILDER_CONFIGS = [
56
+ CoTCollectionMultiConfig(
57
+ name=lang,
58
+ languages=[lang],
59
+ description=f"{_LANGUAGES[lang]} CoT-Collection data used in the paper 'The CoT Collection: Improving Zero-shot and Few-shot Learning of Language Models via Chain-of-Thought Fine-Tuning'",
60
+ )
61
+ for lang in _LANGUAGES
62
+ ]
63
+ BUILDER_CONFIG_CLASS = CoTCollectionMultiConfig
64
+ DEFAULT_CONFIG_NAME = "en"
65
+
66
+
67
+ def _info(self):
68
+ features = datasets.Features(
69
+ {
70
+ "source": datasets.Value("string"),
71
+ "target": datasets.Value("string"),
72
+ "rationale": datasets.Value("string"),
73
+ "task": datasets.Value("string"),
74
+ "type": datasets.Value("string"),
75
+ }
76
+ )
77
+
78
+ return datasets.DatasetInfo(
79
+ description=_DESCRIPTION,
80
+ features=features,
81
+ homepage=_HOMEPAGE,
82
+ citation=_CITATION,
83
+ license=_LICENSE,
84
+ )
85
+
86
+
87
+ def _split_generators(self, dl_manager):
88
+ train_PATHS = [f"./data/CoT_collection_{lang}.json" for lang in self.config.languages]
89
+
90
+ train_paths = dl_manager.download_and_extract(train_PATHS)
91
+
92
+ return [
93
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_paths})
94
+ ]
95
+
96
+ def _generate_examples(self, filepath):
97
+ for _file in filepath:
98
+ with open(_file, "r", encoding="utf-8") as fi:
99
+ data = json.load(fi)
100
+ buffer = []
101
+ for idx, value in data.items():
102
+ if 'rationale' in value.keys():
103
+ buffer.append({
104
+ 'source': value['source'],
105
+ 'target': value['target'],
106
+ 'rationale': value['rationale'],
107
+ 'task': value['task'],
108
+ 'type': 'CoT'
109
+ })
110
+ else:
111
+ value['rationale'] = ''
112
+ buffer.append({
113
+ 'source': value['source'],
114
+ 'target': value['target'],
115
+ 'rationale': value['rationale'],
116
+ 'task': value['task'],
117
+ 'type': 'Direct',
118
+ })
119
+
120
+
121
+ for idx,dat in enumerate(buffer):
122
+ yield idx, dat
123
+
README.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ task_categories:
4
+ - text-generation
5
+ - text-classification
6
+ language:
7
+ - en
8
+ size_categories:
9
+ - 1M<n<10M
10
+ ---
11
+
12
+ # Dataset Card for Dataset Name
13
+
14
+ ## Dataset Description
15
+
16
+ - **Homepage:https://github.com/kaistAI/CoT-Collection**
17
+ - **Repository:https://github.com/kaistAI/CoT-Collection**
18
+ - **Paper:https://arxiv.org/abs/2305.14045**
19
+ - **Point of Contact:[email protected]**
20
+
21
+ ### Dataset Summary
22
+
23
+ ![plot](./cot_collection.JPG)
24
+
25
+ The CoT Collection is a dataset designed to induce Chain-of-Thought (CoT) capabilities into language models.
26
+ While proprietary LLMs excel at generating Chain-of-Thoughts based on prompting, smaller LMs do not have this capability. Thus, by fine-tuning to generate Chain-of-Thoughts, it could acquire such abilities.
27
+
28
+ The CoT Collection provides 1.84 million Chain-of-Thoughts augmented across 1060 tasks from the Flan Collection.\\
29
+ Experimental results show that fine-tuning on the CoT Collection results in (1) better zero-shot performance and (2) a better base model for few-shot learning.
30
+
31
+ We also provide a multilingual version of CoT Collection at this [link](https://huggingface.co/datasets/kaist-ai/Multilingual-CoT-Collection).
32
+
33
+ ### Supported Tasks and Leaderboards
34
+
35
+ 1060 tasks chosen from the Flan Collection.
36
+
37
+
38
+ The list of categories within the CoT Collection are:
39
+ * Natural Language Inference
40
+ * Extractive Question Answering
41
+ * Closed Book Question Answering
42
+ * Science
43
+ * Toxic Classification
44
+ * Arithmetic
45
+ * Program Execution
46
+ * Dialogue
47
+ * Ethics
48
+ * Commonsense Reasoning
49
+ * Multiple Choice Question Answering
50
+
51
+ ### Languages
52
+
53
+ English
54
+
55
+ ## Dataset Structure
56
+ * source: The input that is given to the language model (LM).
57
+ * target: The ground truth answer to the source.
58
+ * rationale: The Chain of Thought (CoT) that explains how the target could be derived from the source.
59
+ * task: A category that shows which dataset the source and target was extracted from.
60
+
61
+ In our paper, we trained the underlying language model to generate in the following format:
62
+ ```
63
+ \{rationale\}
64
+ [RESULT]
65
+ \{target\}
66
+ ```
67
+ Then during evaluation, we parsed the prediction after the phrase ```[RESULT]```.
68
+
69
+ ### Data Splits
70
+
71
+ | name | train |
72
+ |-------------------|------:|
73
+ |CoT-Collection|1837928|
74
+
75
+
76
+
77
+ ### Citation Information
78
+ If you find the following model helpful, please considering citing our paper!
79
+
80
+ ```
81
+ @article{kim2023cot,
82
+ title={The CoT Collection: Improving Zero-shot and Few-shot Learning of Language Models via Chain-of-Thought Fine-Tuning},
83
+ author={Kim, Seungone and Joo, Se June and Kim, Doyoung and Jang, Joel and Ye, Seonghyeon and Shin, Jamin and Seo, Minjoon},
84
+ journal={arXiv preprint arXiv:2305.14045},
85
+ year={2023}
86
+ }
87
+ ```
cot_collection.JPG ADDED

Git LFS Details

  • SHA256: 9963f7b4adc9b05b68085cb620d81d3a1aa06d356d9101014bb73da612c6f124
  • Pointer size: 131 Bytes
  • Size of remote file: 137 kB
data/CoT_collection_en.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88d15e99d2da0ff1e3d6b10179dbc72ee5f756ca0cc58a5dc3c345f202a98b7c
3
+ size 2362433950