mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-26 18:24:18 +00:00
fix style
This commit is contained in:
parent
9c4db1b3fb
commit
4bce81bab1
@ -1,30 +1,29 @@
|
||||
import argparse
|
||||
import csv
|
||||
import glob
|
||||
import logging
|
||||
|
||||
import torch
|
||||
import torchaudio
|
||||
import logging
|
||||
import glob
|
||||
from lhotse import load_manifest, CutSet, Fbank, FbankConfig, LilcomChunkyWriter
|
||||
from lhotse.cut import MonoCut
|
||||
from lhotse import CutSet, Fbank, FbankConfig, LilcomChunkyWriter
|
||||
from lhotse.audio import Recording
|
||||
from lhotse.cut import MonoCut
|
||||
from lhotse.supervision import SupervisionSegment
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from icefall.utils import get_executor, str2bool
|
||||
from icefall.utils import get_executor
|
||||
|
||||
torch.set_num_threads(1)
|
||||
torch.set_num_interop_threads(1)
|
||||
|
||||
|
||||
def parse_csv(csv_file="downloads/audioset/full_train_asedata_with_duration.csv"):
|
||||
|
||||
mapping = {}
|
||||
with open(csv_file, 'r') as fin:
|
||||
with open(csv_file, "r") as fin:
|
||||
reader = csv.reader(fin, delimiter="\t")
|
||||
for i, row in enumerate(reader):
|
||||
if i == 0:
|
||||
continue
|
||||
key = "/".join(row[0].split('/')[-2:])
|
||||
key = "/".join(row[0].split("/")[-2:])
|
||||
mapping[key] = row[1]
|
||||
return mapping
|
||||
|
||||
@ -34,17 +33,13 @@ def get_parser():
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--dataset-dir",
|
||||
type=str,
|
||||
default="downloads/audioset"
|
||||
)
|
||||
parser.add_argument("--dataset-dir", type=str, default="downloads/audioset")
|
||||
|
||||
parser.add_argument(
|
||||
"--split",
|
||||
type=str,
|
||||
default="balanced",
|
||||
choices=["balanced", "unbalanced", "eval", "eval_all"]
|
||||
choices=["balanced", "unbalanced", "eval", "eval_all"],
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@ -55,6 +50,7 @@ def get_parser():
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
def main():
|
||||
parser = get_parser()
|
||||
args = parser.parse_args()
|
||||
@ -66,7 +62,9 @@ def main():
|
||||
num_jobs = 15
|
||||
num_mel_bins = 80
|
||||
|
||||
import pdb; pdb.set_trace()
|
||||
import pdb
|
||||
|
||||
pdb.set_trace()
|
||||
if split in ["balanced", "unbalanced"]:
|
||||
csv_file = "downloads/audioset/full_train_asedata_with_duration.csv"
|
||||
elif split == "eval":
|
||||
@ -82,7 +80,7 @@ def main():
|
||||
|
||||
new_cuts = []
|
||||
for i, audio in enumerate(audio_files):
|
||||
cut_id = "/".join(audio.split('/')[-2:])
|
||||
cut_id = "/".join(audio.split("/")[-2:])
|
||||
recording = Recording.from_file(audio, cut_id)
|
||||
cut = MonoCut(
|
||||
id=cut_id,
|
||||
@ -128,7 +126,8 @@ def main():
|
||||
logging.info(f"Storing the manifest to {manifest_output_dir}")
|
||||
cuts.to_jsonl(manifest_output_dir)
|
||||
|
||||
if __name__=="__main__":
|
||||
|
||||
if __name__ == "__main__":
|
||||
formatter = "%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s"
|
||||
|
||||
logging.basicConfig(format=formatter, level=logging.INFO)
|
||||
|
Loading…
x
Reference in New Issue
Block a user