From 7fa122045f6af3ed913e12bea83c6393dfb00ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Fri, 21 Nov 2025 15:48:03 +0800 Subject: [PATCH] fix(config): dml load & av codec ctx has no base_rate attr --- configs/config.py | 2 ++ infer/lib/audio.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/configs/config.py b/configs/config.py index ef26272..2476efb 100644 --- a/configs/config.py +++ b/configs/config.py @@ -50,6 +50,7 @@ class Config(metaclass=Singleton): self.nocheck, self.update, ) = self.arg_parse() + self.dml = False self.instead = "" self.preprocess_per = 3.7 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.is_half = False + self.dml = True else: if self.instead: logger.info(f"Use {self.instead} instead") diff --git a/infer/lib/audio.py b/infer/lib/audio.py index 8c4c092..ca03c78 100644 --- a/infer/lib/audio.py +++ b/infer/lib/audio.py @@ -195,7 +195,10 @@ def get_audio_properties(input_path: str) -> Tuple[int, int]: container = av.open(input_path) audio_stream = next(s for s in container.streams if s.type == "audio") 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() return channels, rate