pyannote / pyannote-audio

Neural building blocks for speaker diarization: speech activity detection, speaker change detection, overlapped speech detection, speaker embedding
http://pyannote.github.io
MIT License
6.38k stars 784 forks source link

OSError: automatic-speech-recognition is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models' #1671

Closed alvynabranches closed 8 months ago

alvynabranches commented 8 months ago

Tested versions

System information

macOS 14.1 (23B2073) - M3 Max

Issue description

Code

from transformers import pipeline
from pyannote.audio import Pipeline
from speechbox import ASRDiarizationPipeline
from pyannote.audio.pipelines.utils.hook import ProgressHook

pipe = ASRDiarizationPipeline.from_pretrained(
    asr_model="automatic-speech-recognition",
    diarizer_model="pyannote/speaker-diarization-3.1",
    use_auth_token="<token>",
)

with ProgressHook() as hook:
    output = pipe("audio.mp3", hook=hook)
HTTPError                                 Traceback (most recent call last)
File [/opt/homebrew/lib/python3.12/site-packages/huggingface_hub/utils/_errors.py:304](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/huggingface_hub/utils/_errors.py:304), in hf_raise_for_status(response, endpoint_name)
    [303](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/huggingface_hub/utils/_errors.py:303) try:
--> [304](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/huggingface_hub/utils/_errors.py:304)     response.raise_for_status()
    [305](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/huggingface_hub/utils/_errors.py:305) except HTTPError as e:

File [/opt/homebrew/lib/python3.12/site-packages/requests/models.py:1021](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/requests/models.py:1021), in Response.raise_for_status(self)
   [1020](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/requests/models.py:1020) if http_error_msg:
-> [1021](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/requests/models.py:1021)     raise HTTPError(http_error_msg, response=self)

HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/automatic-speech-recognition/resolve/main/config.json

The above exception was the direct cause of the following exception:

RepositoryNotFoundError                   Traceback (most recent call last)
File [/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:398](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:398), in cached_file(path_or_repo_id, filename, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, subfolder, repo_type, user_agent, _raise_exceptions_for_gated_repo, _raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors, _commit_hash, **deprecated_kwargs)
    [396](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:396) try:
    [397](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:397)     # Load from URL or cache if already cached
--> [398](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:398)     resolved_file = hf_hub_download(
    [399](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:399)         path_or_repo_id,
    [400](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:400)         filename,
    [401](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:401)         subfolder=None if len(subfolder) == 0 else subfolder,
    [402](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:402)         repo_type=repo_type,
    [403](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:403)         revision=revision,
...
    [431](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:431)         f"'https://huggingface.co/{path_or_repo_id}' for available revisions."
    [432](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/lib/python3.12/site-packages/transformers/utils/hub.py:432)     ) from e

OSError: automatic-speech-recognition is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'

How to solve this error

Instead of using asr model name you have used "automatic-speech-recognition" as constant by default which should come inside the pipeline as task_name. Changing that would make it working.

Minimal reproduction example (MRE)

automatic-speech-recognition is not a local folder and is not a valid model

hbredin commented 8 months ago

Closing as this is a problem with speechbox, not pyannote.