Vladislav Sokolovskii commited on
Commit
e472375
1 Parent(s): 8da16ae

Debug file creation was deleted

Browse files

Signed-off-by: Vladislav Sokolovskii <[email protected]>

Files changed (2) hide show
  1. voxceleb/voxceleb.py +30 -33
  2. voxpopuli/voxpopuli.py +30 -33
voxceleb/voxceleb.py CHANGED
@@ -158,37 +158,34 @@ class SLUEVoxceleb(datasets.GeneratorBasedBuilder):
158
  # read tsv file by rows
159
  with open(filepath, encoding="utf-8") as f:
160
  reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
161
- with open("debug.txt", "w") as f1:
162
- f1.write(str(split) + '\n')
163
- for row in reader:
164
- f1.write(str(row))
165
- speaker_id = row["speaker_id"]
166
- if not speaker_id.isdigit():
167
- speaker_id = -1
168
- else:
169
- speaker_id = int(speaker_id)
170
-
171
- audio_file = f"{row['id']}.flac"
172
- if split == "test-blind":
173
- yield row["id"], {
174
- "id": row["id"],
175
- "normalized_text": None,
176
- "speaker_id": speaker_id,
177
- "split": split,
178
- "sentiment": None,
179
- "start_second": float(row["start_second"]),
180
- "end_second": float(row["end_second"]),
181
- "audio_path": os.path.join(audio_dir, audio_file),
182
- }
183
- elif split == "fine-tune" or split == "dev":
184
- yield row["id"], {
185
- "id": row["id"],
186
- "normalized_text": row["normalized_text"],
187
- "speaker_id": speaker_id,
188
- "split": split,
189
- "sentiment": row["sentiment"],
190
- "start_second": float(row["start_second"]),
191
- "end_second": float(row["end_second"]),
192
- "audio_path": os.path.join(audio_dir, audio_file),
193
- }
194
 
 
158
  # read tsv file by rows
159
  with open(filepath, encoding="utf-8") as f:
160
  reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
161
+ for row in reader:
162
+ speaker_id = row["speaker_id"]
163
+ if not speaker_id.isdigit():
164
+ speaker_id = -1
165
+ else:
166
+ speaker_id = int(speaker_id)
167
+
168
+ audio_file = f"{row['id']}.flac"
169
+ if split == "test-blind":
170
+ yield row["id"], {
171
+ "id": row["id"],
172
+ "normalized_text": None,
173
+ "speaker_id": speaker_id,
174
+ "split": split,
175
+ "sentiment": None,
176
+ "start_second": float(row["start_second"]),
177
+ "end_second": float(row["end_second"]),
178
+ "audio_path": os.path.join(audio_dir, audio_file),
179
+ }
180
+ elif split == "fine-tune" or split == "dev":
181
+ yield row["id"], {
182
+ "id": row["id"],
183
+ "normalized_text": row["normalized_text"],
184
+ "speaker_id": speaker_id,
185
+ "split": split,
186
+ "sentiment": row["sentiment"],
187
+ "start_second": float(row["start_second"]),
188
+ "end_second": float(row["end_second"]),
189
+ "audio_path": os.path.join(audio_dir, audio_file),
190
+ }
 
 
 
191
 
voxpopuli/voxpopuli.py CHANGED
@@ -158,37 +158,34 @@ class SLUEVoxpopuli(datasets.GeneratorBasedBuilder):
158
  # read tsv file by rows
159
  with open(filepath, encoding="utf-8") as f:
160
  reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
161
- with open("debug.txt", "w") as f1:
162
- f1.write(str(split) + '\n')
163
- for row in reader:
164
- f1.write(str(row))
165
- speaker_id = row["speaker_id"]
166
- if not speaker_id.isdigit():
167
- speaker_id = -1
168
- else:
169
- speaker_id = int(speaker_id)
170
-
171
- audio_file = f"{row['id']}.ogg"
172
- if split == "test-blind":
173
- yield row["id"], {
174
- "id": row["id"],
175
- "raw_text": row["raw_text"],
176
- "normalized_text": row["normalized_text"],
177
- "speaker_id": speaker_id,
178
- "split": split,
179
- "audio_path": os.path.join(audio_dir, audio_file),
180
- "raw_ner": None,
181
- "normalized_ner": None
182
- }
183
- elif split == "fine-tune" or split == "dev":
184
- yield row["id"], {
185
- "id": row["id"],
186
- "raw_text": row["raw_text"],
187
- "normalized_text": row["normalized_text"],
188
- "speaker_id": speaker_id,
189
- "split": split,
190
- "raw_ner": row["raw_ner"],
191
- "normalized_ner": row["normalized_ner"],
192
- "audio_path": os.path.join(audio_dir, audio_file),
193
- }
194
 
 
158
  # read tsv file by rows
159
  with open(filepath, encoding="utf-8") as f:
160
  reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
161
+ for row in reader:
162
+ speaker_id = row["speaker_id"]
163
+ if not speaker_id.isdigit():
164
+ speaker_id = -1
165
+ else:
166
+ speaker_id = int(speaker_id)
167
+
168
+ audio_file = f"{row['id']}.ogg"
169
+ if split == "test-blind":
170
+ yield row["id"], {
171
+ "id": row["id"],
172
+ "raw_text": row["raw_text"],
173
+ "normalized_text": row["normalized_text"],
174
+ "speaker_id": speaker_id,
175
+ "split": split,
176
+ "audio_path": os.path.join(audio_dir, audio_file),
177
+ "raw_ner": None,
178
+ "normalized_ner": None
179
+ }
180
+ elif split == "fine-tune" or split == "dev":
181
+ yield row["id"], {
182
+ "id": row["id"],
183
+ "raw_text": row["raw_text"],
184
+ "normalized_text": row["normalized_text"],
185
+ "speaker_id": speaker_id,
186
+ "split": split,
187
+ "raw_ner": row["raw_ner"],
188
+ "normalized_ner": row["normalized_ner"],
189
+ "audio_path": os.path.join(audio_dir, audio_file),
190
+ }
 
 
 
191