Commit de9ef921 by xuchen

fix the bugs

parent b2031168
......@@ -185,7 +185,7 @@ class AudioDataset(Dataset):
if need_waveform:
offset = item.get('offset', False)
if offset is not False:
if offset:
waveform, sample_rate = torchaudio.load(audio,
frame_offset=offset,
num_frames=item["n_frames"])
......@@ -331,7 +331,7 @@ def process(args):
audio_path = item["audio"]
# add offset and frames info
if item.get("offset", False) is not False:
if item.get("offset", False):
audio_path = f"{audio_path}:{item['offset']}:{n_frames}"
manifest["audio"].append(audio_path)
else:
......
......@@ -37,13 +37,13 @@ class LabelSmoothedCrossEntropyCriterionWithCTC(
"""Add criterion-specific arguments to the parser."""
LabelSmoothedCrossEntropyCriterion.add_args(parser)
CtcCriterion.add_args(parser)
parser.add_argument(
"--ctc-weight",
default=0.0,
type=float,
metavar="D",
help="weight of CTC loss",
)
# parser.add_argument(
# "--ctc-weight",
# default=0.0,
# type=float,
# metavar="D",
# help="weight of CTC loss",
# )
def forward(self, model, sample, reduce=True):
"""Compute the loss for the given sample.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论