Fix hugging face error

Model should be loaded with an id to avoid this error:
huggingface_hub.utils._validators.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: 'pyannote\segmentation'.
This commit is contained in:
Muhammad Shakir
2023-03-04 19:12:13 +01:00
committed by GitHub
parent d1d420e70c
commit cea42ca470

View File

@ -639,9 +639,10 @@ def cli():
if vad_filter:
if hf_token is None:
print("Warning, no huggingface token used, needs to be saved in environment variable, otherwise will throw error loading VAD model...")
from pyannote.audio import Inference
from pyannote.audio import Inference, Model
vad_pipeline = Inference(
"pyannote/segmentation",
Model.from_pretrained("pyannote/segmentation",
use_auth_token=hf_token),
pre_aggregation_hook=lambda segmentation: segmentation,
use_auth_token=hf_token,
device=torch.device(device),