Skip to main content

Simple wav2vec2 wrapper

Project description

pyw2v2

Work in progress!

This module is a wrapper for Wav2Vec2 models, intended to accelerate ARS research.

Install

This module can be easily be installed with pip:

pip install pyw2v2

Examples

Different examples can be found here.

Fine-tuning CTC model example

This example will show how to load a pretrained model, load dataset, process dataset, and fine-tune CTC model.

Example configuration files can be found here.

from pyw2v2 import ModelCTC, DatasetPreprocessor
from pyw2v2.utils import load_config, load_custom_dataset_commonvoice_format

if __name__ == "__main__":
    # Load pretrained model
    model_config = load_config("../configs/ctc/default.yaml")
    model = ModelCTC(model_config)
    
    # Loading dataset in Common Voice format
    train_set = load_custom_dataset_commonvoice_format('../datasets/example', 'train')
    eval_set = load_custom_dataset_commonvoice_format('../datasets/example', 'test')

    # Set up dataset preprocessor
    dataproc_config = load_config("../configs/dataproc/default.yaml").data_proc
    data_processor = DatasetPreprocessor(dataproc_config)
    data_processor.processor = model.processor

    # Process data
    train_set = data_processor.process(train_set, dataproc_config.n_samples_train)
    eval_set = data_processor.process(eval_set, dataproc_config.n_samples_test)
    
    # Train/Fine-tune model
    model.train(train_set, eval_set)

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

pyw2v2-0.0.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

pyw2v2-0.0.2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file pyw2v2-0.0.2.tar.gz.

File metadata

  • Download URL: pyw2v2-0.0.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for pyw2v2-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7f74a830d9f49e47d12e4d38d565d0f8cf4d815bd63ced2aa6ce4afe73179b51
MD5 695ff0c3e0d0502f067a307fa6766103
BLAKE2b-256 668e4306c7ea2a7b1e73bf63a5d5bc9788ba448b19aac18a462af34b16c848d5

See more details on using hashes here.

File details

Details for the file pyw2v2-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyw2v2-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for pyw2v2-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 624f601287f8ae679e9a019034cddab7878913717962a09564270c80899d5d70
MD5 b70b774eaf9879ee71087bf57be5a159
BLAKE2b-256 bfd674677e3650f0b00ca76b2b0f5159ee8d84f002f831abf652a6de0e9802dd

See more details on using hashes here.

Supported by

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