MCPcopy Create free account
hub / github.com/modelscope/FunASR / report_val

Method report_val

funasr/models/eend/utils/report.py:104–132  ·  view source on GitHub ↗

Report val. Args: model: Model instance or model name. eidx: TODO. device: Target device ("cuda:0", "cpu", etc.).

(self, model, eidx, device)

Source from the content-addressed store, hash-verified

102 self.report_val(model, eidx, device)
103
104 def report_val(self, model, eidx, device):
105 """Report val.
106
107 Args:
108 model: Model instance or model name.
109 eidx: TODO.
110 device: Target device ("cuda:0", "cpu", etc.).
111 """
112 model.eval()
113 ud_valid_start = time.time()
114 valid_res, valid_loss, stats_keys, vad_valid_accuracy = self.report_core(
115 model, self.valid_data_loader, device
116 )
117
118 # Epoch Display
119 valid_der = valid_res["diarization_error"] / valid_res["speaker_scored"]
120 valid_accuracy = valid_res["correct"].to(torch.float32) / valid_res["frames"] * 100
121 vad_valid_accuracy = vad_valid_accuracy * 100
122 print(
123 "Epoch ",
124 eidx + 1,
125 "Valid Loss ",
126 valid_loss,
127 "Valid_DER %.5f" % valid_der,
128 "Valid_Accuracy %.5f%% " % valid_accuracy,
129 "VAD_Valid_Accuracy %.5f%% " % vad_valid_accuracy,
130 )
131 ud_valid = (time.time() - ud_valid_start) / 60.0
132 print("Valid cost time ... ", ud_valid)
133
134 def inv_mapping_func(self, label, mapping_dict):
135 """Inv mapping func.

Callers 1

reportMethod · 0.95

Calls 2

report_coreMethod · 0.95
evalMethod · 0.45

Tested by

no test coverage detected