Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster Whisper will not run offline #116

Closed
palladium123 opened this issue Apr 5, 2023 · 7 comments
Closed

Faster Whisper will not run offline #116

palladium123 opened this issue Apr 5, 2023 · 7 comments

Comments

@palladium123
Copy link
Contributor

palladium123 commented Apr 5, 2023

Hello

I tried running faster-whiper offline but I keep getting the following exception:

 Exception has occurred: ConnectionError

HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/guillaumekln/faster-whisper-large-v2/revision/main (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002974F20DC30>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000002974F20DC30>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/guillaumekln/faster-whisper-large-v2/revision/main (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002974F20DC30>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

  File "D:\python\fasterelivewhisper.py", line 47, in __init__
    self.model = WhisperModel(model)
  File "D:\python\fasterelivewhisper.py", line 160, in <module>
    x = StreamHandler()
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/guillaumekln/faster-whisper-large-v2/revision/main (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002974F20DC30>: Failed to establish a new connection: [Errno 11001] getaddrinfo `failed'))

I'm assuming its trying to download something from HF but have no idea what these files are. Does not happen if I am connected online.

Some assistance would be appreciated.

Thank you

@guillaumekln
Copy link
Contributor

guillaumekln commented Apr 5, 2023

Hi,

The Whisper models are automatically downloaded from the Hugging Face Hub.

To run the library offline, you should first download a model locally. For example the command below downloads the "tiny" model and saves it in the directory /tmp/tiny:

python3 -c 'import faster_whisper; faster_whisper.download_model("tiny", "/tmp/tiny")'

Then you can load the model from its path on disk:

model = WhisperModel("/path/to/tiny/model")

@palladium123
Copy link
Contributor Author

Thanks that solves the problem.

@lukeewin
Copy link

I use this command:

python3 -c 'import faster_whisper; faster_whisper.download_model("tiny", "/tmp/tiny")'

There will be the following error:

An error occured while synchronizing the model guillaumekln/faster-whisper-tiny from the Hugging Face Hub:
(ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')), '(Request ID: 84f30144-9f6a-4a1c-b472-69891ab07522)')
Trying to load the model directly from the local cache, if it exists.
Traceback (most recent call last):
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/urllib3/connectionpool.py", line 496, in _make_request
    conn.request(
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/urllib3/connection.py", line 395, in request
    self.endheaders()
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/http/client.py", line 1001, in send
    self.sock.sendall(data)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/ssl.py", line 1208, in sendall
    return super().sendall(data, flags)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/urllib3/connectionpool.py", line 844, in urlopen
    retries = retries.increment(
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/urllib3/util/retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/urllib3/connectionpool.py", line 496, in _make_request
    conn.request(
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/urllib3/connection.py", line 395, in request
    self.endheaders()
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/http/client.py", line 1001, in send
    self.sock.sendall(data)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/ssl.py", line 1208, in sendall
    return super().sendall(data, flags)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/faster_whisper/utils.py", line 94, in download_model
    return huggingface_hub.snapshot_download(repo_id, **kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/huggingface_hub/_snapshot_download.py", line 186, in snapshot_download
    repo_info = api.repo_info(repo_id=repo_id, repo_type=repo_type, revision=revision, token=token)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/huggingface_hub/hf_api.py", line 1868, in repo_info
    return method(
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/huggingface_hub/hf_api.py", line 1677, in model_info
    r = get_session().get(path, headers=headers, timeout=timeout, params=params)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/huggingface_hub/utils/_http.py", line 63, in send
    return super().send(request, *args, **kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')), '(Request ID: 84f30144-9f6a-4a1c-b472-69891ab07522)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/faster_whisper/utils.py", line 110, in download_model
    return huggingface_hub.snapshot_download(repo_id, **kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "/usr/local/src/anaconda3/envs/faster-whisper/lib/python3.9/site-packages/huggingface_hub/_snapshot_download.py", line 169, in snapshot_download
    with open(ref_path) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/root/.cache/huggingface/hub/models--guillaumekln--faster-whisper-tiny/refs/main'

@guillaumekln
Copy link
Contributor

The command should work. Can you try again?

@jblessedup
Copy link

Hi,

The Whisper models are automatically downloaded from the Hugging Face Hub.

To run the library offline, you should first download a model locally. For example the command below downloads the "tiny" model and saves it in the directory /tmp/tiny:

python3 -c 'import faster_whisper; faster_whisper.download_model("tiny", "/tmp/tiny")'

Then you can load the model from its path on disk:

model = WhisperModel("/path/to/tiny/model")

Hello guillaumekln, could you reply with the instructions to locally download the Large v-3 model for faster-whisper on Mac terminal?

@alexivaner
Copy link

alexivaner commented Apr 17, 2024

Hi

Hi,

The Whisper models are automatically downloaded from the Hugging Face Hub.

To run the library offline, you should first download a model locally. For example the command below downloads the "tiny" model and saves it in the directory /tmp/tiny:

python3 -c 'import faster_whisper; faster_whisper.download_model("tiny", "/tmp/tiny")'

Then you can load the model from its path on disk:

model = WhisperModel("/path/to/tiny/model")

Hi , I get this error:

huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/home/finetune/WebSocket-Server/asrModule/large-v3/model'. Use `repo_type` argument if needed.
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

What I did wrong?

@alexivaner
Copy link

Hi,
The Whisper models are automatically downloaded from the Hugging Face Hub.
To run the library offline, you should first download a model locally. For example the command below downloads the "tiny" model and saves it in the directory /tmp/tiny:

python3 -c 'import faster_whisper; faster_whisper.download_model("tiny", "/tmp/tiny")'

Then you can load the model from its path on disk:

model = WhisperModel("/path/to/tiny/model")

Hello guillaumekln, could you reply with the instructions to locally download the Large v-3 model for faster-whisper on Mac terminal?

I believe:

python -c 'import faster_whisper; faster_whisper.download_model("large-v3", "./asrModule/large-v3")'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants