1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-07 02:00:25 +08:00

feat(web): add hash_similarity calculating

This commit is contained in:
源文雨
2024-06-03 00:20:47 +09:00
parent e4fff618bf
commit 2140875115
3 changed files with 29 additions and 7 deletions

View File

@@ -2,4 +2,4 @@ from .pipeline import Pipeline
from .modules import VC
from .utils import get_index_path_from_model, load_hubert
from .info import show_info
from .hash import model_hash_ckpt, hash_id
from .hash import model_hash_ckpt, hash_id, hash_similarity

View File

@@ -189,7 +189,7 @@ def _extend_difference(n, a, b):
return n
def hash_similarity(h1: str, h2: str) -> int:
def hash_similarity(h1: str, h2: str) -> float:
h1b, h2b = decode_from_string(h1), decode_from_string(h2)
if len(h1b) != half_hash_len * 2 or len(h2b) != half_hash_len * 2:
raise Exception("invalid hash length")