polinaeterna HF staff commited on
Commit
dd18e8f
1 Parent(s): 42c1798

raise error for 'book' config in script

Browse files
Files changed (1) hide show
  1. RedPajama-Data-1T.py +10 -5
RedPajama-Data-1T.py CHANGED
@@ -19,6 +19,7 @@
19
  import json
20
 
21
  import datasets
 
22
  import traceback
23
  import os
24
 
@@ -31,7 +32,6 @@ RedPajama is a clean-room, fully open-source implementation of the LLaMa dataset
31
 
32
  _URL_LISTS = {
33
  "arxiv": "urls/arxiv.txt",
34
- "book": "urls/book.txt",
35
  "c4": "urls/c4.txt",
36
  "common_crawl": "urls/common_crawl.txt",
37
  "github": "urls/github.txt",
@@ -60,7 +60,7 @@ class RedPajama1T(datasets.GeneratorBasedBuilder):
60
  BUILDER_CONFIGS = [
61
  RedPajama1TConfig(
62
  name = 'default',
63
- subsets = list(_URL_LISTS.keys()),
64
  version=datasets.Version("1.0.0", ""),
65
  description="RedPajama1T",
66
  ),
@@ -129,10 +129,15 @@ class RedPajama1T(datasets.GeneratorBasedBuilder):
129
  )
130
 
131
  def _split_generators(self, dl_manager):
 
 
 
 
 
 
132
  url_lists = dl_manager.download_and_extract({
133
- subset: _URL_LISTS[subset] for subset in self.config.subsets
134
  })
135
-
136
  urls = {}
137
 
138
  for subset, url_list in url_lists.items():
@@ -158,7 +163,7 @@ class RedPajama1T(datasets.GeneratorBasedBuilder):
158
  gen_kwargs = {
159
  "files": {
160
  subset: downloaded_files[subset]
161
- for subset in self.config.subsets
162
  }
163
  }
164
  )
 
19
  import json
20
 
21
  import datasets
22
+ from datasets.exceptions import DefunctDatasetError
23
  import traceback
24
  import os
25
 
 
32
 
33
  _URL_LISTS = {
34
  "arxiv": "urls/arxiv.txt",
 
35
  "c4": "urls/c4.txt",
36
  "common_crawl": "urls/common_crawl.txt",
37
  "github": "urls/github.txt",
 
60
  BUILDER_CONFIGS = [
61
  RedPajama1TConfig(
62
  name = 'default',
63
+ subsets = list(_URL_LISTS) + ["book"],
64
  version=datasets.Version("1.0.0", ""),
65
  description="RedPajama1T",
66
  ),
 
129
  )
130
 
131
  def _split_generators(self, dl_manager):
132
+ if self.config.name == "book":
133
+ raise DefunctDatasetError(
134
+ "The 'book' config is defunct and no longer accessible due to reported copyright infringement. "
135
+ )
136
+ subsets = [subset for subset in self.config.subsets if subset != "book"]
137
+
138
  url_lists = dl_manager.download_and_extract({
139
+ subset: _URL_LISTS[subset] for subset in subsets
140
  })
 
141
  urls = {}
142
 
143
  for subset, url_list in url_lists.items():
 
163
  gen_kwargs = {
164
  "files": {
165
  subset: downloaded_files[subset]
166
+ for subset in subsets
167
  }
168
  }
169
  )