Fedir Zadniprovskyi commited on
Commit
d31974d
·
1 Parent(s): 9f88e57

fix: incorrect whisper model env references

Browse files
README.md CHANGED
@@ -3,7 +3,7 @@
3
  Features:
4
  - GPU and CPU support.
5
  - Easily deployable using Docker.
6
- - Configurable through environment variables (see [config.py](./faster_whisper_server/config.py)).
7
  - OpenAI API compatible.
8
 
9
  Please create an issue if you find a bug, have a question, or a feature suggestion.
 
3
  Features:
4
  - GPU and CPU support.
5
  - Easily deployable using Docker.
6
+ - **Configurable through environment variables (see [config.py](./faster_whisper_server/config.py))**.
7
  - OpenAI API compatible.
8
 
9
  Please create an issue if you find a bug, have a question, or a feature suggestion.
examples/live-audio/script.sh CHANGED
@@ -7,12 +7,12 @@ set -e
7
  # ffmpeg -y -hide_banner -loglevel quiet -i audio.mp3 -ac 1 -ar 16000 -f s16le -acodec pcm_s16le audio.pcm
8
  # rm -f audio.mp3
9
 
10
- export WHISPER_MODEL=Systran/faster-distil-whisper-large-v3 # or Systran/faster-whisper-tiny.en if you are running on a CPU for a faster inference.
11
 
12
  # Ensure you have `faster-whisper-server` running. If this is your first time running it expect to wait up-to a minute for the model to be downloaded and loaded into memory. You can run `curl localhost:8000/health` to check if the server is ready or watch the logs with `docker logs -f <container_id>`.
13
- docker run --detach --gpus=all --publish 8000:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER_MODEL=$WHISPER_MODEL fedirz/faster-whisper-server:latest-cuda
14
  # or you can run it on a CPU
15
- # docker run --detach --publish 8000:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER_MODEL=$WHISPER_MODEL fedirz/faster-whisper-server:latest-cpu
16
 
17
  # `pv` is used to limit the rate at which the audio is streamed to the server. Audio is being streamed at a rate of 32kb/s(16000 sample rate * 16-bit sample / 8 bits per byte = 32000 bytes per second). This emulutes live audio input from a microphone: `ffmpeg -loglevel quiet -f alsa -i default -ac 1 -ar 16000 -f s16le`
18
  # shellcheck disable=SC2002
 
7
  # ffmpeg -y -hide_banner -loglevel quiet -i audio.mp3 -ac 1 -ar 16000 -f s16le -acodec pcm_s16le audio.pcm
8
  # rm -f audio.mp3
9
 
10
+ export WHISPER__MODEL=Systran/faster-distil-whisper-large-v3 # or Systran/faster-whisper-tiny.en if you are running on a CPU for a faster inference.
11
 
12
  # Ensure you have `faster-whisper-server` running. If this is your first time running it expect to wait up-to a minute for the model to be downloaded and loaded into memory. You can run `curl localhost:8000/health` to check if the server is ready or watch the logs with `docker logs -f <container_id>`.
13
+ docker run --detach --gpus=all --publish 8000:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER__MODEL=$WHISPER__MODEL fedirz/faster-whisper-server:latest-cuda
14
  # or you can run it on a CPU
15
+ # docker run --detach --publish 8000:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER__MODEL=$WHISPER__MODEL fedirz/faster-whisper-server:latest-cpu
16
 
17
  # `pv` is used to limit the rate at which the audio is streamed to the server. Audio is being streamed at a rate of 32kb/s(16000 sample rate * 16-bit sample / 8 bits per byte = 32000 bytes per second). This emulutes live audio input from a microphone: `ffmpeg -loglevel quiet -f alsa -i default -ac 1 -ar 16000 -f s16le`
18
  # shellcheck disable=SC2002
examples/youtube/script.sh CHANGED
@@ -3,12 +3,12 @@
3
  set -e
4
 
5
  # NOTE: do not use any distil-* model other than the large ones as they don't work on long audio files for some reason.
6
- export WHISPER_MODEL=Systran/faster-distil-whisper-large-v3 # or Systran/faster-whisper-tiny.en if you are running on a CPU for a faster inference.
7
 
8
  # Ensure you have `faster-whisper-server` running. If this is your first time running it expect to wait up-to a minute for the model to be downloaded and loaded into memory. You can run `curl localhost:8000/health` to check if the server is ready or watch the logs with `docker logs -f <container_id>`.
9
- docker run --detach --gpus=all --publish 8000:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER_MODEL=$WHISPER_MODEL fedirz/faster-whisper-server:latest-cuda
10
  # or you can run it on a CPU
11
- # docker run --detach --publish 8000:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER_MODEL=$WHISPER_MODEL fedirz/faster-whisper-server:latest-cpu
12
 
13
  # Download the audio from a YouTube video. In this example I'm downloading "The Evolution of the Operating System" by Asionometry YouTube channel. I highly checking this channel out, the guy produces very high content. If you don't have `youtube-dl`, you'll have to install it. https://github.com/ytdl-org/youtube-dl
14
  youtube-dl --extract-audio --audio-format mp3 -o the-evolution-of-the-operating-system.mp3 'https://www.youtube.com/watch?v=1lG7lFLXBIs'
 
3
  set -e
4
 
5
  # NOTE: do not use any distil-* model other than the large ones as they don't work on long audio files for some reason.
6
+ export WHISPER__MODEL=Systran/faster-distil-whisper-large-v3 # or Systran/faster-whisper-tiny.en if you are running on a CPU for a faster inference.
7
 
8
  # Ensure you have `faster-whisper-server` running. If this is your first time running it expect to wait up-to a minute for the model to be downloaded and loaded into memory. You can run `curl localhost:8000/health` to check if the server is ready or watch the logs with `docker logs -f <container_id>`.
9
+ docker run --detach --gpus=all --publish 8000:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER__MODEL=$WHISPER__MODEL fedirz/faster-whisper-server:latest-cuda
10
  # or you can run it on a CPU
11
+ # docker run --detach --publish 8000:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER__MODEL=$WHISPER__MODEL fedirz/faster-whisper-server:latest-cpu
12
 
13
  # Download the audio from a YouTube video. In this example I'm downloading "The Evolution of the Operating System" by Asionometry YouTube channel. I highly checking this channel out, the guy produces very high content. If you don't have `youtube-dl`, you'll have to install it. https://github.com/ytdl-org/youtube-dl
14
  youtube-dl --extract-audio --audio-format mp3 -o the-evolution-of-the-operating-system.mp3 'https://www.youtube.com/watch?v=1lG7lFLXBIs'
faster_whisper_server/config.py CHANGED
@@ -162,8 +162,8 @@ class Config(BaseSettings):
162
 
163
  Pydantic will automatically handle mapping uppercased environment variables to the corresponding fields.
164
  To populate nested, the environment should be prefixed with the nested field name and an underscore. For example,
165
- the environment variable `LOG_LEVEL` will be mapped to `log_level`, `WHISPER_MODEL` to `whisper.model`, etc.
166
- """
167
 
168
  model_config = SettingsConfigDict(env_nested_delimiter="__")
169
 
 
162
 
163
  Pydantic will automatically handle mapping uppercased environment variables to the corresponding fields.
164
  To populate nested, the environment should be prefixed with the nested field name and an underscore. For example,
165
+ the environment variable `LOG_LEVEL` will be mapped to `log_level`, `WHISPER__MODEL`(note the double underscore) to `whisper.model`, etc.
166
+ """ # noqa: E501
167
 
168
  model_config = SettingsConfigDict(env_nested_delimiter="__")
169