mattbonnell commited on
Commit
ca1e14d
·
1 Parent(s): ecad711

fix labels downloading

Browse files
Files changed (1) hide show
  1. transcribed_calls.py +7 -4
transcribed_calls.py CHANGED
@@ -41,7 +41,8 @@ class TranscribedCalls(datasets.GeneratorBasedBuilder):
41
 
42
  def _split_generators(self, dl_manager):
43
  metadata_path = dl_manager.download("metadata.csv")
44
- archive = dl_manager.download("data/audio.tar.gz")
 
45
 
46
  return [
47
  datasets.SplitGenerator(
@@ -49,6 +50,7 @@ class TranscribedCalls(datasets.GeneratorBasedBuilder):
49
  # These kwargs will be passed to _generate_examples
50
  gen_kwargs={
51
  "metadata_path": metadata_path,
 
52
  "audio_files": dl_manager.iter_archive(archive),
53
  "split": "train",
54
  },
@@ -58,6 +60,7 @@ class TranscribedCalls(datasets.GeneratorBasedBuilder):
58
  # These kwargs will be passed to _generate_examples
59
  gen_kwargs={
60
  "metadata_path": metadata_path,
 
61
  "audio_files": dl_manager.iter_archive(archive),
62
  "split": "test"
63
  },
@@ -65,7 +68,7 @@ class TranscribedCalls(datasets.GeneratorBasedBuilder):
65
  ]
66
 
67
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
68
- def _generate_examples(self, metadata_path, audio_files, split):
69
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
70
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
71
  print(f"generating examples for split {split}")
@@ -77,12 +80,12 @@ class TranscribedCalls(datasets.GeneratorBasedBuilder):
77
  if split != split:
78
  continue
79
 
80
- words_path = os.path.join("data", "words", id_ + ".txt")
81
  words = ''
82
  with open(words_path, "r") as f:
83
  words = f.read()
84
 
85
- phonemes_path = os.path.join("data", "phonemes", id_ + ".txt")
86
  phonemes = ''
87
  with open(phonemes_path, "r") as f:
88
  phonemes = f.read()
 
41
 
42
  def _split_generators(self, dl_manager):
43
  metadata_path = dl_manager.download("metadata.csv")
44
+ data_dir = dl_manager.download("data/audio.tar.gz")
45
+ archive = os.path.join(data_dir, "audio.tar.gz")
46
 
47
  return [
48
  datasets.SplitGenerator(
 
50
  # These kwargs will be passed to _generate_examples
51
  gen_kwargs={
52
  "metadata_path": metadata_path,
53
+ "data_dir": data_dir,
54
  "audio_files": dl_manager.iter_archive(archive),
55
  "split": "train",
56
  },
 
60
  # These kwargs will be passed to _generate_examples
61
  gen_kwargs={
62
  "metadata_path": metadata_path,
63
+ "data_dir": data_dir,
64
  "audio_files": dl_manager.iter_archive(archive),
65
  "split": "test"
66
  },
 
68
  ]
69
 
70
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
71
+ def _generate_examples(self, metadata_path, data_dir, audio_files, split):
72
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
73
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
74
  print(f"generating examples for split {split}")
 
80
  if split != split:
81
  continue
82
 
83
+ words_path = os.path.join(data_dir, "words", id_ + ".txt")
84
  words = ''
85
  with open(words_path, "r") as f:
86
  words = f.read()
87
 
88
+ phonemes_path = os.path.join(data_dir, "phonemes", id_ + ".txt")
89
  phonemes = ''
90
  with open(phonemes_path, "r") as f:
91
  phonemes = f.read()