Streaming transcriber with whisper
Find a file
dependabot[bot] 50f9f02398 Bump websockets from 10.3 to 10.4
Bumps [websockets](https://github.com/aaugustin/websockets) from 10.3 to 10.4.
- [Release notes](https://github.com/aaugustin/websockets/releases)
- [Commits](https://github.com/aaugustin/websockets/compare/10.3...10.4)

---
updated-dependencies:
- dependency-name: websockets
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-31 19:34:45 +09:00
.github Bump crate-ci/typos from 1.12.10 to 1.12.11 2022-10-24 18:41:57 +09:00
scripts Fix for Windows 2022-10-10 00:42:06 +09:00
tests Fix bugs 2022-10-17 21:29:12 +09:00
whispering Updated protocol version 2022-10-17 22:10:34 +09:00
.gitignore chore: edit .gitignore 2022-10-17 21:37:42 +09:00
.markdownlint.json Initial commit 2022-09-23 19:20:29 +09:00
LICENSE Initial commit 2022-09-23 19:20:29 +09:00
LICENSE.whisper Initial commit 2022-09-23 19:20:29 +09:00
Makefile Add make style (Resolve #42) 2022-10-21 22:08:43 +09:00
package-lock.json Bump pyright from 1.1.275 to 1.1.276 2022-10-24 18:41:49 +09:00
package.json Bump pyright from 1.1.275 to 1.1.276 2022-10-24 18:41:49 +09:00
poetry.lock Bump websockets from 10.3 to 10.4 2022-10-31 19:34:45 +09:00
pyproject.toml Bump websockets from 10.3 to 10.4 2022-10-31 19:34:45 +09:00
README.md Fix doc 2022-10-21 22:11:08 +09:00
setup.cfg Fix setting for isort 2022-09-23 20:05:33 +09:00

Whispering

MIT License Python Versions

CI CodeQL Typos

Streaming transcriber with whisper. Enough machine power is needed to transcribe in real time.

Setup

pip install -U git+https://github.com/shirayu/whispering.git@v0.6.3

# If you use GPU, install proper torch and torchaudio
# Check https://pytorch.org/get-started/locally/
# Example : torch for CUDA 11.6
pip install -U torch torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

If you get OSError: PortAudio library not found in Linux, install "PortAudio".

sudo apt -y install portaudio19-dev

Example of microphone

# Run in English
whispering --language en --model tiny
  • --help shows full options
  • --model sets the model name to use. Larger models will be more accurate, but may not be able to transcribe in real time.
  • --language sets the language to transcribe. The list of languages are shown with whispering -h
  • --no-progress disables the progress message
  • -t sets temperatures to decode. You can set several like -t 0.0 -t 0.1 -t 0.5, but too many temperatures exhaust decoding time
  • --debug outputs logs for debug
  • --vad sets VAD (Voice Activity Detection) threshold. The default is 0.5. 0 disables VAD and forces whisper to analyze non-voice activity sound period
  • --output sets output file (Default: Standard output)

Parse interval

By default, whispering performs VAD for every 3.75 second. This interval is determined by the value of -n and its default is 20. When an interval is predicted as "silence", it will not be passed to whisper. If you want to disable VAD, please make VAD threshold 0 by adding --vad 0.

By default, Whisper does not perform analysis until the total length of the segments determined by VAD to have speech exceeds 30 seconds. However, if silence segments appear 16 times (the default value of --max_nospeech_skip) after speech is detected, the analysis is performed.

Example of web socket

No security mechanism. Please make secure with your responsibility.

Run with --host and --port.

Host

whispering --language en --model tiny --host 0.0.0.0 --port 8000

Client

whispering --host ADDRESS_OF_HOST --port 8000 --mode client

You can set -n and other options.

For Developers

  1. Install Python and Node.js

  2. Install poetry to use poetry command

  3. Clone and install libraries

    # Clone
    git clone https://github.com/shirayu/whispering.git
    
    # With poetry
    poetry config virtualenvs.in-project true
    poetry install --all-extras
    poetry run pip install -U torch torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
    
    # With npm
    npm install
    
  4. Run test and check that no errors occur

    poetry run make -j4
    
  5. Make fancy updates

  6. Make style

    poetry run make style
    
  7. Run test again and check that no errors occur

    poetry run make -j4
    
  8. Check typos by using typos. Just run typos command in the root directory.

    typos
    
  9. Send Pull requests!

License