slplab commited on
Commit
4093f5a
1 Parent(s): 71288b0

Upload folder using huggingface_hub

Browse files
data/asd_syl_240115.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bash/bin/python3
2
+
3
+ import datasets
4
+
5
+ data_name = "asd_syl_240115"
6
+
7
+ _DATA_URL = f"data/{data_name}.tar.gz"
8
+
9
+ _PROMPTS_URLS = {
10
+ "train": "data/prompts-train.txt.gz",
11
+ "valid": "data/prompts-valid.txt.gz",
12
+ "test": "data/prompts-test.txt.gz",
13
+ }
14
+
15
+ class KscgSmall25(datasets.GeneratorBasedBuilder):
16
+ """KSCG Small 20v50"""
17
+
18
+ def _info(self):
19
+ features = datasets.Features(
20
+ {
21
+ 'path': datasets.Value('string'),
22
+ 'audio': datasets.Audio(sampling_rate=16_000),
23
+ 'sentence': datasets.Value('string'),
24
+ }
25
+ )
26
+
27
+ return datasets.DatasetInfo(
28
+ features=features,
29
+ supervised_keys=None,
30
+ )
31
+
32
+ def _split_generators(self, dl_manager):
33
+ """Returns SplitGenerators."""
34
+
35
+ prompts_paths = dl_manager.download_and_extract(_PROMPTS_URLS)
36
+ archive = dl_manager.download(_DATA_URL)
37
+ train_dir = f"{data_name}/train"
38
+ valid_dir = f"{data_name}/valid"
39
+ test_dir = f"{data_name}/test"
40
+
41
+ return [
42
+ datasets.SplitGenerator(
43
+ name=datasets.Split.TRAIN,
44
+ gen_kwargs={
45
+ "prompts_path": prompts_paths["train"],
46
+ "path_to_clips": train_dir,
47
+ "audio_files": dl_manager.iter_archive(archive)
48
+ },
49
+ ),
50
+ datasets.SplitGenerator(
51
+ name=datasets.Split.VALIDATION,
52
+ gen_kwargs={
53
+ "prompts_path": prompts_paths["valid"],
54
+ "path_to_clips": valid_dir,
55
+ "audio_files": dl_manager.iter_archive(archive)
56
+ },
57
+ ),
58
+ datasets.SplitGenerator(
59
+ name=datasets.Split.TEST,
60
+ gen_kwargs={
61
+ "prompts_path": prompts_paths["test"],
62
+ "path_to_clips": test_dir,
63
+ "audio_files": dl_manager.iter_archive(archive)
64
+ },
65
+ ),
66
+ ]
67
+
68
+ def _generate_examples(self, prompts_path, path_to_clips, audio_files):
69
+ examples = {}
70
+ with open(prompts_path, encoding='utf-8') as f:
71
+ for row in f:
72
+ data = row.strip().split(",")
73
+ audio_path = data[0] + ".wav"
74
+ examples[audio_path] = {
75
+ 'path': audio_path,
76
+ 'sentence': data[1],
77
+ }
78
+ inside_clips_dir = False
79
+ id_ = 0
80
+ for path, f, in audio_files:
81
+ if path.startswith(path_to_clips):
82
+ inside_clips_dir = True
83
+ if path in examples:
84
+ audio = {"path": path, "bytes": f.read()}
85
+ yield id_, {**examples[path], "audio": audio}
86
+ id_ += 1
87
+ elif inside_clips_dir:
88
+ break
data/data/asd_syl_240115.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:892160963ab9f04c302d894d5a8959dec8b5a01dd583190c135f815f553e04f9
3
+ size 1657781
data/data/prompts-test.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:741983348681553f53404b40570a65f056e09a685ee4efc7d870fb78c202bf08
3
+ size 288
data/data/prompts-train.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4cbacb751c29cecdff0fe0c9083a3213a10fea64e30f1b9c17376f7004e3d70d
3
+ size 1234
data/data/prompts-valid.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba65ec67a81eb070c54e485bdd0b24506881475bed29328ff95aa88b8bf81f5b
3
+ size 304