Views
No views yet
conda, follow these steps:1git clone https://github.com/tomer9080/CarelessWhisper-streaming
2cd CarelessWhisper-streamingconda env create -f environment.ymlconda activate careless_whisperlarge-v2 that was fine tuned on multilingual data is available, and supports English, French, Spanish, German and Portuguese with chunk size of 300 miliseconds.| Size | Chunk Size [msec] | Multilingual |
|---|---|---|
| base | 40, 100, 200, 300 | N/A |
| small | 40, 100, 200, 300, 1000 | N/A |
| large-v2 | 40, 100, 200, 300, 1000 | 300 |
Note: The models are hosted on the Hugging Face Hub, which requires an access token.
Make sure you are logged in with your token to access the models.
read is enough), and create it.pip install huggingface_hubhuggingface-cli login1# Using a local microphone for streaming transcription, dumping the recording to out.wav
2python transcribe.py \
3--output_filename out.wav \
4--channels 2 \
5--model small \
6--chunk_size 300 \
7--device cuda \
8--beam_size 5 \
9--ca_kv_cache \1# Simulating a stream on a wav file
2python transcribe.py \
3--model small \
4--chunk_size 300 \
5--device cuda \
6--beam_size 5 \
7--ca_kv_cache \
8--wav_file /path/to/audio.wav \
9--simulate_stream \
10--use_latency1import torch
2import careless_whisper_stream
3
4model_size = "small" # model size
5chunk_size = 300 # chunk size in milliseconds
6multilingual = False # currently on large-v2_300msec supports other languages than english.
7device = "cuda" if torch.cuda.is_available() else "cpu"
8
9model = careless_whisper_stream.load_streaming_model(name=model_size,
10 gran=chunk_size,
11 multilingual=multilingual,
12 device=device)
13
14# using a local microphone recording
15texts_microphone = model.transcribe(output_filename="/path/to/dump/file.wav",
16 channels=2,
17 beam_size=5,
18 ca_kv_cache=True)
19
20# Simulating on a wav file
21texts_wav_simulation = model.transcribe(simulate_stream=True,
22 wav_file="/path/to/file/you/want/to/transcribe.wav",
23 beam_size=5,
24 ca_kv_cache=True)training_code/ds_dict.py.ds_paths, where you should specify paths to the train, val, and test partitions of your dataset. Each partition should be a CSV file with the following three columns:wav_path — Path to the WAV audio file.tg_path — Path to the corresponding .TextGrid file containing forced alignment.raw_text — Ground truth transcription.Note: The dictionary key (i.e., the name of the dataset) will be used by the training script to identify and load the dataset correctly.
training_code/ds_dict.py.1python training_code/train.py \
2--lora \
3--streaming_train \
4--simulate_stream \
5--dataset LIBRI-960-ALIGNED \
6--name example_training_base_model \
7--size base \
8--batch_size 32 \
9--epochs 10 \
10--learning_rate 1e-5 \
11--rank 32 \
12--gran 15 \
13--extra_gran_blocks 1 \
14--streaming_fraction 0.25 \
15--top_k 5 \python training_code/train.py --help