Speechbox

Latest version: v0.2.1

Safety actively analyzes 688724 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.1.2

Fixes a bug with beam search. See: https://github.com/huggingface/speechbox/commit/4d15bc9feb2adb6a330386ebdf08c4bc60f5b6ef

Beam search (`num_beams > 1`) has now been checked against greedy search and it seems to work as expected.

0.1.1

Make sure a nice error message is given if `accelerate` is not installed. See: https://github.com/huggingface/speechbox/commit/8671ba23c06d3086d240e273ecd00427597c7c52

0.1.0

Hello world `speechbox`!

This is the first release of `speechbox`, providing the **Punctuation Restoration** task using [whisper](https://huggingface.co/models?other=whisper).

You need to install `speechbox` as well as `transformers` & `accelerate` in order to use the `PunctuationRestorer` class:


pip install --upgrade speechbox transformers accelerate


For an initial example, we recommend to also install `datasets`:


pip install datasets


Then you can run the following code snippet:

python
from speechbox import PunctuationRestorer
from datasets import load_dataset

streamed_dataset = load_dataset("librispeech_asr", "clean", split="validation", streaming=True)

get first sample
sample = next(iter(streamed_dataset))

print out normalized transcript
print(sample["text"])
=> "HE WAS IN A FEVERED STATE OF MIND OWING TO THE BLIGHT HIS WIFE'S ACTION THREATENED TO CAST UPON HIS ENTIRE FUTURE"

load the restoring class
restorer = PunctuationRestorer.from_pretrained("openai/whisper-tiny.en")
restorer.to("cuda")

restored_text, log_probs = restorer(sample["audio"]["array"], sample["text"], sampling_rate=sample["audio"]["sampling_rate"], num_beams=1)

print("Restored text:\n", restored_text)


**Note**: This project is very young and intended to be run largely by the community. Please check out the [Contribution Guide](https://github.com/huggingface/speechbox#contributing) if you'd like to contribute :heart:

You can try out the model here: https://huggingface.co/spaces/speechbox/whisper-restore-punctuation as well.

Speechly,
:hugs:

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.