A package for audio transcription and speaker diarization using Whisper and NeMo toolkit
Project description
Fast Whisper Diarizer
Fast Whisper Diarizer is a Python package for audio transcription and speaker diarization using the Whisper model and NeMo toolkit.
Installation
To install the package, run:
pip install fast-whisper-diarizer
Initialization
Before using the diarize_audio function, you need to initialize the models using the initialize_models function. This ensures that the necessary models are loaded and ready for processing.
Example:
from fast_whisper_diarizer import initialize_models
whisper_model_name = "tiny.en"
# Initialize models
initialize_models(whisper_model_name)
Usage
To use the diarize_audio function, you can follow the example below. This function allows you to process audio data for transcription and speaker diarization, accepting both file paths and in-memory bytes data as input.
Example
from fast_whisper_diarizer import diarize_audio
# Example usage with a file path
final_transcript = diarize_audio(
audio_data="path/to/audio/file.wav",
whisper_model_name="tiny.en"
)
print(final_transcript)
# Example usage with in-memory bytes data
with open("path/to/audio/file.wav", "rb") as f:
audio_bytes = f.read()
final_transcript = diarize_audio(
audio_data=audio_bytes,
whisper_model_name="tiny.en"
)
print(final_transcript)
Parameters
- audio_data (str or bytes): The input audio, either as a file path (str) or in-memory bytes data (bytes).
- whisper_model_name (str): The name of the Whisper model to use for transcription.
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
separate_vocals |
bool |
True |
Whether to separate vocals from the audio. |
processing_batch_size |
int |
8 |
Batch size for processing audio. |
language_code |
str |
None |
Language code for transcription. |
suppress_numeric_tokens |
bool |
True |
Whether to suppress numeric tokens in transcription. |
computation_device |
str |
'cpu' |
Device to use for computation ('cpu' or 'cuda'). |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fast_whisper_diarizer-0.1.32.tar.gz.
File metadata
- Download URL: fast_whisper_diarizer-0.1.32.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42a745cae4980ebdd062fd194e986a71dca291e6a1fbf50d366cb0104cf59f4d
|
|
| MD5 |
d5f2e0b45d690c13c04d81ea5f54100a
|
|
| BLAKE2b-256 |
6e2e3f3150010d69fad607472478c7c5ac1edb0e60f7ebbde353efbf84abfbd3
|
File details
Details for the file fast_whisper_diarizer-0.1.32-py3-none-any.whl.
File metadata
- Download URL: fast_whisper_diarizer-0.1.32-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f86d12d2dc85f1088b36e8b0e087f862e6defde1d6b9296f05c6617c51a52e52
|
|
| MD5 |
9faf3373f0415fd0414672177ee10132
|
|
| BLAKE2b-256 |
a9a9e95a5f7eb424dd73d2e046f5df6a17f6685242f5a254454e22ede6b460ad
|