RodrigoLimaRFL commited on
Commit
7ffcd40
·
verified ·
1 Parent(s): 825a3b2

Update NURC-SP_ENTOA_TTS.py

Browse files
Files changed (1) hide show
  1. NURC-SP_ENTOA_TTS.py +49 -47
NURC-SP_ENTOA_TTS.py CHANGED
@@ -24,6 +24,54 @@ _PATH_TO_CLIPS = {
24
  "train_automatic": "automatic/audios/train",
25
  }
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  class EntoaConfig(BuilderConfig):
28
  def __init__(self, prompts_type="prosodic", **kwargs):
29
  super().__init__(**kwargs)
@@ -108,53 +156,7 @@ class EntoaDataset(GeneratorBasedBuilder):
108
  ),
109
  ]
110
 
111
- def debug_path_matching(csv_path, archive_files):
112
- """
113
- Debug utility to compare paths between CSV and archive files
114
- """
115
- import csv
116
- from collections import defaultdict
117
-
118
- # Store CSV paths
119
- csv_paths = set()
120
- with open(csv_path, "r") as f:
121
- reader = csv.DictReader(f)
122
- for row in reader:
123
- # Store both the full path and filename
124
- path = row.get("path") or row.get("file_path")
125
- csv_paths.add(path)
126
- csv_paths.add(path.split("/")[-1])
127
-
128
- # Compare with archive paths
129
- archive_paths = set()
130
- matches = defaultdict(list)
131
-
132
- for path, _ in archive_files:
133
- archive_paths.add(path)
134
- archive_paths.add(path.split("/")[-1])
135
-
136
- # Check for matches
137
- for csv_path in csv_paths:
138
- if path.endswith(csv_path) or csv_path.endswith(path):
139
- matches[path].append(csv_path)
140
-
141
- print("=== Debug Report ===")
142
- print(f"CSV Paths: {len(csv_paths)}")
143
- print(f"Archive Paths: {len(archive_paths)}")
144
- print(f"Matched Paths: {len(matches)}")
145
- print("\nSample CSV paths:")
146
- for path in list(csv_paths)[:5]:
147
- print(f" {path}")
148
- print("\nSample Archive paths:")
149
- for path in list(archive_paths)[:5]:
150
- print(f" {path}")
151
- print("\nSample Matches:")
152
- for archive_path, csv_paths in list(matches.items())[:5]:
153
- print(f" Archive: {archive_path}")
154
- print(f" CSV: {csv_paths}")
155
- print()
156
-
157
- return csv_paths, archive_paths, matches
158
 
159
 
160
  def _generate_examples(self, prompts_path, path_to_clips, audio_files):
 
24
  "train_automatic": "automatic/audios/train",
25
  }
26
 
27
+ def debug_path_matching(csv_path, archive_files):
28
+ """
29
+ Debug utility to compare paths between CSV and archive files
30
+ """
31
+ import csv
32
+ from collections import defaultdict
33
+
34
+ # Store CSV paths
35
+ csv_paths = set()
36
+ with open(csv_path, "r") as f:
37
+ reader = csv.DictReader(f)
38
+ for row in reader:
39
+ # Store both the full path and filename
40
+ path = row.get("path") or row.get("file_path")
41
+ csv_paths.add(path)
42
+ csv_paths.add(path.split("/")[-1])
43
+
44
+ # Compare with archive paths
45
+ archive_paths = set()
46
+ matches = defaultdict(list)
47
+
48
+ for path, _ in archive_files:
49
+ archive_paths.add(path)
50
+ archive_paths.add(path.split("/")[-1])
51
+
52
+ # Check for matches
53
+ for csv_path in csv_paths:
54
+ if path.endswith(csv_path) or csv_path.endswith(path):
55
+ matches[path].append(csv_path)
56
+
57
+ print("=== Debug Report ===")
58
+ print(f"CSV Paths: {len(csv_paths)}")
59
+ print(f"Archive Paths: {len(archive_paths)}")
60
+ print(f"Matched Paths: {len(matches)}")
61
+ print("\nSample CSV paths:")
62
+ for path in list(csv_paths)[:5]:
63
+ print(f" {path}")
64
+ print("\nSample Archive paths:")
65
+ for path in list(archive_paths)[:5]:
66
+ print(f" {path}")
67
+ print("\nSample Matches:")
68
+ for archive_path, csv_paths in list(matches.items())[:5]:
69
+ print(f" Archive: {archive_path}")
70
+ print(f" CSV: {csv_paths}")
71
+ print()
72
+
73
+ return csv_paths, archive_paths, matches
74
+
75
  class EntoaConfig(BuilderConfig):
76
  def __init__(self, prompts_type="prosodic", **kwargs):
77
  super().__init__(**kwargs)
 
156
  ),
157
  ]
158
 
159
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
 
162
  def _generate_examples(self, prompts_path, path_to_clips, audio_files):