Skip to main content

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

Usage

To use the process_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 process_audio

# Example usage with a file path
process_audio(
    audio_data="path/to/audio/file.wav",
    output_directory="path/to/output/directory",
    whisper_model_name="tiny.en",
    separate_vocals=True,
    processing_batch_size=8,
    language_code="en",
    suppress_numeric_tokens=True,
    computation_device="cuda"
)

# Example usage with in-memory bytes data
with open("path/to/audio/file.wav", "rb") as f:
    audio_bytes = f.read()

process_audio(
    audio_data=audio_bytes,
    output_directory="path/to/output/directory",
    whisper_model_name="tiny.en",
    separate_vocals=True,
    processing_batch_size=8,
    language_code="en",
    suppress_numeric_tokens=True,
    computation_device="cuda"
)

Parameters

  • audio_data (str or bytes): The input audio, either as a file path (str) or in-memory bytes data (bytes).
  • output_directory (str, optional): The directory where output files will be saved. Defaults to the directory of the input file if not specified.
  • whisper_model_name (str): The name of the Whisper model to use for transcription. Defaults to "tiny.en".
  • separate_vocals (bool): Whether to perform vocal separation from the background music. Defaults to True.
  • processing_batch_size (int): The batch size for processing the audio. Defaults to 8.
  • language_code (str): The language code for transcription. Defaults to "en".
  • suppress_numeric_tokens (bool): Whether to suppress numeric tokens during transcription. Defaults to True.
  • computation_device (str): The device to use for computation, either "cuda" or "cpu". Defaults to "cuda" if available.

This function does not return a value but saves output files to the specified directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_whisper_diarizer-0.1.2.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fast_whisper_diarizer-0.1.2-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file fast_whisper_diarizer-0.1.2.tar.gz.

File metadata

  • Download URL: fast_whisper_diarizer-0.1.2.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for fast_whisper_diarizer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8ec90fbf076d48694860dac1cb05b09d88d2a92277edc3423be280a35b652c54
MD5 9d53b7aa02e8c66ef7e25978962de618
BLAKE2b-256 cfa02871cfe59584b6c97ec4ee60c9e5ccaff345578eb317f3e13f4b9e7b6718

See more details on using hashes here.

File details

Details for the file fast_whisper_diarizer-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for fast_whisper_diarizer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bb782dfc91a81a9c846b26f4eb0fc374c2ea3c54bb45244d9d5caf024bb76704
MD5 68c27569036e83e8a6c12cfaa819f52d
BLAKE2b-256 86a4137902db117a3f336bbab5c1c2ec6079372b95a59756e49b1f070b8b9c43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page