Commit de9ef921 by xuchen

fix the bugs

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