diff --git a/infer/modules/vc/hash.py b/infer/modules/vc/hash.py index b1a5fd9..eec8bd4 100644 --- a/infer/modules/vc/hash.py +++ b/infer/modules/vc/hash.py @@ -136,7 +136,7 @@ def model_hash_ckpt(cpt): with TorchSeedContext(114514): tgt_sr = cpt["config"][-1] - if_f0 = 0 + if_f0 = cpt.get("f0", 1) version = cpt.get("version", "v1") synthesizer_class = { ("v1", 1): SynthesizerTrnMs256NSFsid, diff --git a/infer/modules/vc/info.py b/infer/modules/vc/info.py index ed5daf5..d3ff8b4 100644 --- a/infer/modules/vc/info.py +++ b/infer/modules/vc/info.py @@ -3,7 +3,7 @@ from i18n.i18n import I18nAuto from datetime import datetime import torch -from .hash import model_hash_ckpt, hash_id +from .hash import model_hash_ckpt, hash_id, hash_similarity i18n = I18nAuto() @@ -24,18 +24,14 @@ def show_model_info(cpt, show_long_id=False): + i18n("从模型中读取") + ")" ) + sim = hash_similarity(h, hread) + if sim is float: sim = "%.2f%" % (sim*100) if not show_long_id: h = i18n("不显示") + if h != hread: + h = i18n("相似度") + " " + sim + " -> " + h elif h != hread: - h += ( - "(" - + i18n("实际计算") - + "), " - + hread - + "(" - + i18n("从模型中读取") - + ")" - ) + h = i18n("相似度") + " " + sim + " -> " + h + "(" + i18n("实际计算") + "), " + hread + "(" + i18n("从模型中读取") + ")" txt = f"""{i18n("模型名")}: %s {i18n("封装时间")}: %s {i18n("模型作者")}: %s