vladsaveliev commited on
Commit
749f8c8
·
1 Parent(s): f281154

Remove gdown dependency and add requirements.txt

Browse files
Files changed (2) hide show
  1. murakami.py +1 -17
  2. requirements.txt +2 -0
murakami.py CHANGED
@@ -6,13 +6,10 @@ Parse all paragraphs from all *.fb2 files in the input directory, create a Huggi
6
  import os
7
  from pathlib import Path
8
  from lxml import etree
9
- import gdown
10
  import datasets
11
  from datasets import Dataset
12
  from huggingface_hub import create_repo
13
- import coloredlogs
14
 
15
- coloredlogs.install(level="info")
16
  datasets.logging.set_verbosity_info()
17
 
18
 
@@ -20,8 +17,6 @@ _DESCRIPTION = """\
20
  Russian translations of Murakami novels, to fine-tune a generative language model. Source is FB2 files from http://flibusta.is/a/8570.
21
  """
22
 
23
- _URL = "https://drive.google.com/open?id=14Uw_efwj70iip1xJD2H2qHSVMuoUDm4z"
24
-
25
 
26
  class Builder(datasets.GeneratorBasedBuilder):
27
  """Murakami novels, translated to Russian."""
@@ -97,19 +92,8 @@ class Builder(datasets.GeneratorBasedBuilder):
97
  def _split_generators(self, dl_manager):
98
  # This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
99
  # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
100
-
101
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
102
- # 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.
103
- # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
104
- data_dir = dl_manager.extract(
105
- dl_manager.download_custom(
106
- _URL,
107
- custom_download=lambda src, dst: gdown.download(src, dst, fuzzy=True),
108
- )
109
- )
110
-
111
  text_by_name = {}
112
-
113
  fb2s = list(Path(data_dir).glob("*.fb2"))
114
  if len(fb2s) > 0:
115
  print(f"Found {len(fb2s)} fb2 files in {data_dir}")
 
6
  import os
7
  from pathlib import Path
8
  from lxml import etree
 
9
  import datasets
10
  from datasets import Dataset
11
  from huggingface_hub import create_repo
 
12
 
 
13
  datasets.logging.set_verbosity_info()
14
 
15
 
 
17
  Russian translations of Murakami novels, to fine-tune a generative language model. Source is FB2 files from http://flibusta.is/a/8570.
18
  """
19
 
 
 
20
 
21
  class Builder(datasets.GeneratorBasedBuilder):
22
  """Murakami novels, translated to Russian."""
 
92
  def _split_generators(self, dl_manager):
93
  # This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
94
  # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
95
+ data_dir = "data"
 
 
 
 
 
 
 
 
 
 
96
  text_by_name = {}
 
97
  fb2s = list(Path(data_dir).glob("*.fb2"))
98
  if len(fb2s) > 0:
99
  print(f"Found {len(fb2s)} fb2 files in {data_dir}")
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ datasets
2
+ lxml