1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-05 01:10:22 +08:00

fix(config): dml load & av codec ctx has no base_rate attr

This commit is contained in:
源文雨
2025-11-21 15:48:03 +08:00
parent 71cc31a96c
commit 7fa122045f
2 changed files with 6 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ class Config(metaclass=Singleton):
self.nocheck, self.nocheck,
self.update, self.update,
) = self.arg_parse() ) = self.arg_parse()
self.dml = False
self.instead = "" self.instead = ""
self.preprocess_per = 3.7 self.preprocess_per = 3.7
self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config() self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()
@@ -239,6 +240,7 @@ class Config(metaclass=Singleton):
self.device = torch_directml.device(torch_directml.default_device()) self.device = torch_directml.device(torch_directml.default_device())
self.is_half = False self.is_half = False
self.dml = True
else: else:
if self.instead: if self.instead:
logger.info(f"Use {self.instead} instead") logger.info(f"Use {self.instead} instead")

View File

@@ -195,7 +195,10 @@ def get_audio_properties(input_path: str) -> Tuple[int, int]:
container = av.open(input_path) container = av.open(input_path)
audio_stream = next(s for s in container.streams if s.type == "audio") audio_stream = next(s for s in container.streams if s.type == "audio")
channels = 1 if audio_stream.layout == "mono" else 2 channels = 1 if audio_stream.layout == "mono" else 2
rate = audio_stream.base_rate try:
rate = audio_stream.base_rate
except:
rate = audio_stream.sample_rate
container.close() container.close()
return channels, rate return channels, rate