Skip to content

Commit 7fa1220

Browse files
committed
fix(config): dml load & av codec ctx has no base_rate attr
1 parent 71cc31a commit 7fa1220

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

configs/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def __init__(self):
5050
self.nocheck,
5151
self.update,
5252
) = self.arg_parse()
53+
self.dml = False
5354
self.instead = ""
5455
self.preprocess_per = 3.7
5556
self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()
@@ -239,6 +240,7 @@ def device_config(self):
239240

240241
self.device = torch_directml.device(torch_directml.default_device())
241242
self.is_half = False
243+
self.dml = True
242244
else:
243245
if self.instead:
244246
logger.info(f"Use {self.instead} instead")

infer/lib/audio.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ def get_audio_properties(input_path: str) -> Tuple[int, int]:
195195
container = av.open(input_path)
196196
audio_stream = next(s for s in container.streams if s.type == "audio")
197197
channels = 1 if audio_stream.layout == "mono" else 2
198-
rate = audio_stream.base_rate
198+
try:
199+
rate = audio_stream.base_rate
200+
except:
201+
rate = audio_stream.sample_rate
199202
container.close()
200203
return channels, rate
201204

0 commit comments

Comments
 (0)