From 452060ad651e934f503a3b918b808970a41ae8c1 Mon Sep 17 00:00:00 2001 From: adamnsandle Date: Fri, 28 Oct 2022 10:13:00 +0000 Subject: [PATCH 1/3] fx --- hubconf.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hubconf.py b/hubconf.py index bca8829..145be41 100644 --- a/hubconf.py +++ b/hubconf.py @@ -25,11 +25,11 @@ def silero_vad(onnx=False, force_onnx_cpu=False): Please see https://github.com/snakers4/silero-vad for usage examples """ - installed_version = torch.__version__ - supported_version = '1.12.0' - - if versiontuple(installed_version) < versiontuple(supported_version): - raise Exception(f'Please install torch {supported_version} or greater ({installed_version} installed)') + if not onnx: + installed_version = torch.__version__ + supported_version = '1.12.0' + if versiontuple(installed_version) < versiontuple(supported_version): + raise Exception(f'Please install torch {supported_version} or greater ({installed_version} installed)') hub_dir = torch.hub.get_dir() if onnx: From 1b212c6e95433c6317dda9d59f45bf52a287aee3 Mon Sep 17 00:00:00 2001 From: adamnsandle Date: Fri, 28 Oct 2022 10:26:07 +0000 Subject: [PATCH 2/3] change exception to warning --- hubconf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hubconf.py b/hubconf.py index 145be41..7fd0574 100644 --- a/hubconf.py +++ b/hubconf.py @@ -1,6 +1,7 @@ dependencies = ['torch', 'torchaudio'] import torch import json +import warnings from utils_vad import (init_jit_model, get_speech_timestamps, get_number_ts, @@ -28,8 +29,8 @@ def silero_vad(onnx=False, force_onnx_cpu=False): if not onnx: installed_version = torch.__version__ supported_version = '1.12.0' - if versiontuple(installed_version) < versiontuple(supported_version): - raise Exception(f'Please install torch {supported_version} or greater ({installed_version} installed)') + if not versiontuple(installed_version) >= versiontuple(supported_version): + warnings.warn(f'Please install torch {supported_version} or greater ({installed_version} installed)') hub_dir = torch.hub.get_dir() if onnx: From cb6d308335a2c7797fe6b4d14941e57ea0dc0126 Mon Sep 17 00:00:00 2001 From: adamnsandle Date: Fri, 28 Oct 2022 10:31:55 +0000 Subject: [PATCH 3/3] fx --- hubconf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hubconf.py b/hubconf.py index 7fd0574..b04be1a 100644 --- a/hubconf.py +++ b/hubconf.py @@ -17,7 +17,7 @@ from utils_vad import (init_jit_model, def versiontuple(v): - return tuple(map(int, (v.split(".")))) + return tuple(map(int, (v.split('+')[0].split(".")))) def silero_vad(onnx=False, force_onnx_cpu=False): @@ -29,7 +29,7 @@ def silero_vad(onnx=False, force_onnx_cpu=False): if not onnx: installed_version = torch.__version__ supported_version = '1.12.0' - if not versiontuple(installed_version) >= versiontuple(supported_version): + if versiontuple(installed_version) < versiontuple(supported_version): warnings.warn(f'Please install torch {supported_version} or greater ({installed_version} installed)') hub_dir = torch.hub.get_dir()