mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-09 01:52:41 +00:00
parent
e538232485
commit
a4dd273776
@ -447,6 +447,17 @@ def compute_loss(
|
|||||||
|
|
||||||
info["loss"] = loss.detach().cpu().item()
|
info["loss"] = loss.detach().cpu().item()
|
||||||
|
|
||||||
|
# `utt_duration` and `utt_pad_proportion` would be normalized by `utterances` # noqa
|
||||||
|
info["utterances"] = feature.size(0)
|
||||||
|
# averaged input duration in frames over utterances
|
||||||
|
info["utt_duration"] = supervisions["num_frames"].sum().item()
|
||||||
|
# averaged padding proportion over utterances
|
||||||
|
info["utt_pad_proportion"] = (
|
||||||
|
((feature.size(1) - supervisions["num_frames"]) / feature.size(1))
|
||||||
|
.sum()
|
||||||
|
.item()
|
||||||
|
)
|
||||||
|
|
||||||
return loss, info
|
return loss, info
|
||||||
|
|
||||||
|
|
||||||
|
@ -605,6 +605,15 @@ def compute_loss(
|
|||||||
# Note: We use reduction=sum while computing the loss.
|
# Note: We use reduction=sum while computing the loss.
|
||||||
info["loss"] = loss.detach().cpu().item()
|
info["loss"] = loss.detach().cpu().item()
|
||||||
|
|
||||||
|
# `utt_duration` and `utt_pad_proportion` would be normalized by `utterances` # noqa
|
||||||
|
info["utterances"] = feature.size(0)
|
||||||
|
# averaged input duration in frames over utterances
|
||||||
|
info["utt_duration"] = feature_lens.sum().item()
|
||||||
|
# averaged padding proportion over utterances
|
||||||
|
info["utt_pad_proportion"] = (
|
||||||
|
((feature.size(1) - feature_lens) / feature.size(1)).sum().item()
|
||||||
|
)
|
||||||
|
|
||||||
return loss, info
|
return loss, info
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,6 +430,17 @@ def compute_loss(
|
|||||||
|
|
||||||
info["loss"] = loss.detach().cpu().item()
|
info["loss"] = loss.detach().cpu().item()
|
||||||
|
|
||||||
|
# `utt_duration` and `utt_pad_proportion` would be normalized by `utterances` # noqa
|
||||||
|
info["utterances"] = feature.size(0)
|
||||||
|
# averaged input duration in frames over utterances
|
||||||
|
info["utt_duration"] = supervisions["num_frames"].sum().item()
|
||||||
|
# averaged padding proportion over utterances
|
||||||
|
info["utt_pad_proportion"] = (
|
||||||
|
((feature.size(1) - supervisions["num_frames"]) / feature.size(1))
|
||||||
|
.sum()
|
||||||
|
.item()
|
||||||
|
)
|
||||||
|
|
||||||
return loss, info
|
return loss, info
|
||||||
|
|
||||||
|
|
||||||
|
@ -349,6 +349,17 @@ def compute_loss(
|
|||||||
info["frames"] = supervision_segments[:, 2].sum().item()
|
info["frames"] = supervision_segments[:, 2].sum().item()
|
||||||
info["loss"] = loss.detach().cpu().item()
|
info["loss"] = loss.detach().cpu().item()
|
||||||
|
|
||||||
|
# `utt_duration` and `utt_pad_proportion` would be normalized by `utterances` # noqa
|
||||||
|
info["utterances"] = feature.size(0)
|
||||||
|
# averaged input duration in frames over utterances
|
||||||
|
info["utt_duration"] = supervisions["num_frames"].sum().item()
|
||||||
|
# averaged padding proportion over utterances
|
||||||
|
info["utt_pad_proportion"] = (
|
||||||
|
((feature.size(2) - supervisions["num_frames"]) / feature.size(2))
|
||||||
|
.sum()
|
||||||
|
.item()
|
||||||
|
)
|
||||||
|
|
||||||
return loss, info
|
return loss, info
|
||||||
|
|
||||||
|
|
||||||
|
@ -403,6 +403,15 @@ def compute_loss(
|
|||||||
# Note: We use reduction=sum while computing the loss.
|
# Note: We use reduction=sum while computing the loss.
|
||||||
info["loss"] = loss.detach().cpu().item()
|
info["loss"] = loss.detach().cpu().item()
|
||||||
|
|
||||||
|
# `utt_duration` and `utt_pad_proportion` would be normalized by `utterances` # noqa
|
||||||
|
info["utterances"] = feature.size(0)
|
||||||
|
# averaged input duration in frames over utterances
|
||||||
|
info["utt_duration"] = feature_lens.sum().item()
|
||||||
|
# averaged padding proportion over utterances
|
||||||
|
info["utt_pad_proportion"] = (
|
||||||
|
((feature.size(1) - feature_lens) / feature.size(1)).sum().item()
|
||||||
|
)
|
||||||
|
|
||||||
return loss, info
|
return loss, info
|
||||||
|
|
||||||
|
|
||||||
|
@ -407,6 +407,15 @@ def compute_loss(
|
|||||||
# Note: We use reduction=sum while computing the loss.
|
# Note: We use reduction=sum while computing the loss.
|
||||||
info["loss"] = loss.detach().cpu().item()
|
info["loss"] = loss.detach().cpu().item()
|
||||||
|
|
||||||
|
# `utt_duration` and `utt_pad_proportion` would be normalized by `utterances` # noqa
|
||||||
|
info["utterances"] = feature.size(0)
|
||||||
|
# averaged input duration in frames over utterances
|
||||||
|
info["utt_duration"] = feature_lens.sum().item()
|
||||||
|
# averaged padding proportion over utterances
|
||||||
|
info["utt_pad_proportion"] = (
|
||||||
|
((feature.size(1) - feature_lens) / feature.size(1)).sum().item()
|
||||||
|
)
|
||||||
|
|
||||||
return loss, info
|
return loss, info
|
||||||
|
|
||||||
|
|
||||||
|
@ -429,6 +429,15 @@ def compute_loss(
|
|||||||
# Note: We use reduction=sum while computing the loss.
|
# Note: We use reduction=sum while computing the loss.
|
||||||
info["loss"] = loss.detach().cpu().item()
|
info["loss"] = loss.detach().cpu().item()
|
||||||
|
|
||||||
|
# `utt_duration` and `utt_pad_proportion` would be normalized by `utterances` # noqa
|
||||||
|
info["utterances"] = feature.size(0)
|
||||||
|
# averaged input duration in frames over utterances
|
||||||
|
info["utt_duration"] = feature_lens.sum().item()
|
||||||
|
# averaged padding proportion over utterances
|
||||||
|
info["utt_pad_proportion"] = (
|
||||||
|
((feature.size(1) - feature_lens) / feature.size(1)).sum().item()
|
||||||
|
)
|
||||||
|
|
||||||
return loss, info
|
return loss, info
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,6 +417,15 @@ def compute_loss(
|
|||||||
# Note: We use reduction=sum while computing the loss.
|
# Note: We use reduction=sum while computing the loss.
|
||||||
info["loss"] = loss.detach().cpu().item()
|
info["loss"] = loss.detach().cpu().item()
|
||||||
|
|
||||||
|
# `utt_duration` and `utt_pad_proportion` would be normalized by `utterances` # noqa
|
||||||
|
info["utterances"] = feature.size(0)
|
||||||
|
# averaged input duration in frames over utterances
|
||||||
|
info["utt_duration"] = feature_lens.sum().item()
|
||||||
|
# averaged padding proportion over utterances
|
||||||
|
info["utt_pad_proportion"] = (
|
||||||
|
((feature.size(1) - feature_lens) / feature.size(1)).sum().item()
|
||||||
|
)
|
||||||
|
|
||||||
return loss, info
|
return loss, info
|
||||||
|
|
||||||
|
|
||||||
|
@ -476,6 +476,15 @@ def compute_loss(
|
|||||||
# Note: We use reduction=sum while computing the loss.
|
# Note: We use reduction=sum while computing the loss.
|
||||||
info["loss"] = loss.detach().cpu().item()
|
info["loss"] = loss.detach().cpu().item()
|
||||||
|
|
||||||
|
# `utt_duration` and `utt_pad_proportion` would be normalized by `utterances` # noqa
|
||||||
|
info["utterances"] = feature.size(0)
|
||||||
|
# averaged input duration in frames over utterances
|
||||||
|
info["utt_duration"] = feature_lens.sum().item()
|
||||||
|
# averaged padding proportion over utterances
|
||||||
|
info["utt_pad_proportion"] = (
|
||||||
|
((feature.size(1) - feature_lens) / feature.size(1)).sum().item()
|
||||||
|
)
|
||||||
|
|
||||||
return loss, info
|
return loss, info
|
||||||
|
|
||||||
|
|
||||||
|
@ -544,9 +544,10 @@ class MetricsTracker(collections.defaultdict):
|
|||||||
else:
|
else:
|
||||||
raise ValueError(f"Unexpected key: {k}")
|
raise ValueError(f"Unexpected key: {k}")
|
||||||
frames = "%.2f" % self["frames"]
|
frames = "%.2f" % self["frames"]
|
||||||
ans_frames += "over " + str(frames) + " frames; "
|
ans_frames += "over " + str(frames) + " frames. "
|
||||||
utterances = "%.2f" % self["utterances"]
|
if ans_utterances != "":
|
||||||
ans_utterances += "over " + str(utterances) + " utterances."
|
utterances = "%.2f" % self["utterances"]
|
||||||
|
ans_utterances += "over " + str(utterances) + " utterances."
|
||||||
|
|
||||||
return ans_frames + ans_utterances
|
return ans_frames + ans_utterances
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user