whispering/README.md

77 lines
2.4 KiB
Markdown
Raw Normal View History

2022-09-23 10:20:11 +00:00
2022-09-24 05:34:03 +00:00
# whisper_streaming (beta version)
2022-09-23 10:20:11 +00:00
[![CI](https://github.com/shirayu/whisper_streaming/actions/workflows/ci.yml/badge.svg)](https://github.com/shirayu/whisper_streaming/actions/workflows/ci.yml)
[![CodeQL](https://github.com/shirayu/whisper_streaming/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/shirayu/whisper_streaming/actions/workflows/codeql-analysis.yml)
[![Typos](https://github.com/shirayu/whisper_streaming/actions/workflows/typos.yml/badge.svg)](https://github.com/shirayu/whisper_streaming/actions/workflows/typos.yml)
2022-09-24 00:38:40 +00:00
Streaming transcriber with [whisper](https://github.com/openai/whisper).
Transcribing in real time, enough machine power is needed.
2022-09-23 10:20:11 +00:00
2022-09-24 15:46:37 +00:00
## Setup
2022-09-23 10:20:11 +00:00
```bash
git clone https://github.com/shirayu/whisper_streaming.git
cd whisper_streaming
poetry install --only main
2022-09-23 13:19:53 +00:00
2022-09-24 03:51:07 +00:00
# If you use GPU, install proper torch and torchaudio with "poetry run pip install -U"
2022-09-24 03:38:37 +00:00
# Example : torch for CUDA 11.6
2022-09-24 03:44:14 +00:00
poetry run pip install -U torch torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
2022-09-24 15:46:37 +00:00
```
## Example of microphone
2022-09-24 02:02:40 +00:00
2022-09-24 15:46:37 +00:00
```bash
2022-09-24 00:26:37 +00:00
# Run in English
2022-09-24 06:39:41 +00:00
poetry run whisper_streaming --language en --model base
2022-09-23 10:20:11 +00:00
```
2022-09-24 00:38:40 +00:00
- ``--help`` shows full options
2022-09-24 00:31:13 +00:00
- ``--language`` sets the language to transcribe. The list of languages are shown with ``poetry run whisper_streaming -h``
2022-09-24 04:58:39 +00:00
- ``-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
2022-09-23 13:46:27 +00:00
- ``--debug`` outputs logs for debug
2022-09-23 13:19:53 +00:00
2022-09-24 15:46:37 +00:00
### Parse interval
If you want quick response, set small ``-n`` and add ``--allow-padding``.
However, this may be at the sacrifice of accuracy.
```bash
poetry run whisper_streaming --language en --model base -n 20 --allow-padding
```
2022-09-24 12:54:25 +00:00
## Example of web socket
2022-09-24 12:57:46 +00:00
**No security mechanism. Please make secure with your responsibility.**
2022-09-24 12:54:25 +00:00
2022-09-24 15:48:27 +00:00
### Host
Run with ``--host`` and ```--port``. You can set``-n`` and other options as use with microphone.
2022-09-24 12:54:25 +00:00
```bash
poetry run whisper_streaming --language en --model base --host 0.0.0.0 --port 8000
```
2022-09-24 15:48:27 +00:00
### Client
2022-09-24 12:54:25 +00:00
```bash
2022-09-24 12:56:17 +00:00
poetry run python -m whisper_streaming.websocket_client --host ADDRESS_OF_HOST --port 8000
2022-09-24 12:54:25 +00:00
```
2022-09-23 10:20:11 +00:00
## Tips
2022-09-24 04:58:39 +00:00
## PortAudio Error
2022-09-23 10:20:11 +00:00
If you get ``OSError: PortAudio library not found``: Install ``portaudio``
```bash
# Ubuntu
sudo apt-get install portaudio19-dev
```
## License
- [MIT License](LICENSE)
- Some codes are ported from the original whisper. Its license is also [MIT License](LICENSE.whisper)