feat:(vc.info): add similarity in vc

This commit is contained in:
源文雨 2024-06-04 22:03:05 +09:00
parent 84d9d9a2bc
commit 7866e776c2
2 changed files with 7 additions and 11 deletions

View File

@ -136,7 +136,7 @@ def model_hash_ckpt(cpt):
with TorchSeedContext(114514): with TorchSeedContext(114514):
tgt_sr = cpt["config"][-1] tgt_sr = cpt["config"][-1]
if_f0 = 0 if_f0 = cpt.get("f0", 1)
version = cpt.get("version", "v1") version = cpt.get("version", "v1")
synthesizer_class = { synthesizer_class = {
("v1", 1): SynthesizerTrnMs256NSFsid, ("v1", 1): SynthesizerTrnMs256NSFsid,

View File

@ -3,7 +3,7 @@ from i18n.i18n import I18nAuto
from datetime import datetime from datetime import datetime
import torch import torch
from .hash import model_hash_ckpt, hash_id from .hash import model_hash_ckpt, hash_id, hash_similarity
i18n = I18nAuto() i18n = I18nAuto()
@ -24,18 +24,14 @@ def show_model_info(cpt, show_long_id=False):
+ i18n("从模型中读取") + i18n("从模型中读取")
+ ")" + ")"
) )
sim = hash_similarity(h, hread)
if sim is float: sim = "%.2f%" % (sim*100)
if not show_long_id: if not show_long_id:
h = i18n("不显示") h = i18n("不显示")
if h != hread:
h = i18n("相似度") + " " + sim + " -> " + h
elif h != hread: elif h != hread:
h += ( h = i18n("相似度") + " " + sim + " -> " + h + "(" + i18n("实际计算") + "), " + hread + "(" + i18n("从模型中读取") + ")"
"("
+ i18n("实际计算")
+ "), "
+ hread
+ "("
+ i18n("从模型中读取")
+ ")"
)
txt = f"""{i18n("模型名")}: %s txt = f"""{i18n("模型名")}: %s
{i18n("封装时间")}: %s {i18n("封装时间")}: %s
{i18n("模型作者")}: %s {i18n("模型作者")}: %s