mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-01-19 18:41:52 +00:00
fix: 卸载音色省显存
顺便将所有print换成了统一的logger
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
# This code references https://huggingface.co/JosephusCheung/ASimilarityCalculatior/blob/main/qwerty.py
|
||||
# Fill in the path of the model to be queried and the root directory of the reference models, and this script will return the similarity between the model to be queried and all reference models.
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
@@ -55,7 +56,7 @@ def main(path, root):
|
||||
torch.manual_seed(114514)
|
||||
model_a = torch.load(path, map_location="cpu")["weight"]
|
||||
|
||||
print("Query:\t\t%s\t%s" % (path, model_hash(path)))
|
||||
logger.info("Query:\t\t%s\t%s" % (path, model_hash(path)))
|
||||
|
||||
map_attn_a = {}
|
||||
map_rand_input = {}
|
||||
@@ -82,7 +83,7 @@ def main(path, root):
|
||||
sim = torch.mean(torch.cosine_similarity(attn_a, attn_b))
|
||||
sims.append(sim)
|
||||
|
||||
print(
|
||||
logger.info(
|
||||
"Reference:\t%s\t%s\t%s"
|
||||
% (path, model_hash(path), f"{torch.mean(torch.stack(sims)) * 1e2:.2f}%")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user