aadelucia commited on
Commit
00b849e
1 Parent(s): 0183b48
Files changed (1) hide show
  1. bernice-pretrain-data.py +17 -7
bernice-pretrain-data.py CHANGED
@@ -51,11 +51,21 @@ _LICENSE = ""
51
  # you can just pass the relative paths to the files instead of URLs.
52
  # Only train data, validation split not provided
53
  _BASE_DATA_URL = "https://huggingface.co/datasets/jhu-clsp/bernice-pretrain-data/resolve/main/data"
54
- # _URLS = {
55
- # "all": f"{_BASE_URL}",
56
- # "indic": ["data/indic_tweet_ids.txt.gz"]
57
- # }
58
-
 
 
 
 
 
 
 
 
 
 
59
 
60
  # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
61
  class BernicePretrainData(datasets.GeneratorBasedBuilder):
@@ -113,8 +123,8 @@ class BernicePretrainData(datasets.GeneratorBasedBuilder):
113
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
114
  # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
115
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
116
- data_url = f"{_BASE_DATA_URL}/{self.config.name}"
117
- downloaded_files = dl_manager.download_and_extract(data_url)
118
  return [
119
  datasets.SplitGenerator(
120
  name=datasets.Split.TRAIN,
 
51
  # you can just pass the relative paths to the files instead of URLs.
52
  # Only train data, validation split not provided
53
  _BASE_DATA_URL = "https://huggingface.co/datasets/jhu-clsp/bernice-pretrain-data/resolve/main/data"
54
+ _URLS = {
55
+ "all": ['2016_01.txt.gz', '2016_02.txt.gz', '2016_03.txt.gz', '2016_04.txt.gz', '2016_05.txt.gz', '2016_06.txt.gz',
56
+ '2016_07.txt.gz', '2016_08.txt.gz', '2016_09.txt.gz', '2016_10.txt.gz', '2016_11.txt.gz', '2016_12.txt.gz',
57
+ '2017_01.txt.gz', '2017_02.txt.gz', '2017_03.txt.gz', '2017_04.txt.gz', '2017_05.txt.gz', '2017_06.txt.gz',
58
+ '2017_07.txt.gz', '2017_09.txt.gz', '2017_10.txt.gz', '2017_11.txt.gz', '2017_12.txt.gz', '2018_01.txt.gz',
59
+ '2018_02.txt.gz', '2018_03.txt.gz', '2018_04.txt.gz', '2018_05.txt.gz', '2018_06.txt.gz', '2018_07.txt.gz',
60
+ '2018_08.txt.gz', '2018_09.txt.gz', '2018_10.txt.gz', '2018_11.txt.gz', '2018_12.txt.gz', '2019_01.txt.gz',
61
+ '2019_02.txt.gz', '2019_03.txt.gz', '2019_04.txt.gz', '2019_05.txt.gz', '2019_06.txt.gz', '2019_07.txt.gz',
62
+ '2019_08.txt.gz', '2019_09.txt.gz', '2019_10.txt.gz', '2019_11.txt.gz', '2019_12.txt.gz', '2020_01.txt.gz',
63
+ '2020_02.txt.gz', '2020_03.txt.gz', '2020_04.txt.gz', '2020_05.txt.gz', '2020_06.txt.gz', '2020_07.txt.gz',
64
+ '2020_08.txt.gz', '2020_09.txt.gz', '2020_10.txt.gz', '2020_11.txt.gz', '2020_12.txt.gz', '2021_01.txt.gz',
65
+ '2021_02.txt.gz', '2021_03.txt.gz', '2021_04.txt.gz', '2021_05.txt.gz', '2021_06.txt.gz', '2021_07.txt.gz',
66
+ '2021_08.txt.gz', '2021_09.txt.gz', '2021_10.txt.gz', '2021_11.txt.gz', '2021_12.txt.gz'],
67
+ "indic": ["indic_tweet_ids.txt.gz"]
68
+ }
69
 
70
  # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
71
  class BernicePretrainData(datasets.GeneratorBasedBuilder):
 
123
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
124
  # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
125
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
126
+ urls_to_download = [f"{_BASE_DATA_URL}/{self.config.name}/{f}" for f in _URLS[self.config.name]]
127
+ downloaded_files = dl_manager.download_and_extract(urls_to_download)
128
  return [
129
  datasets.SplitGenerator(
130
  name=datasets.Split.TRAIN,