deepphonemizer

Crates.iodeepphonemizer
lib.rsdeepphonemizer
version1.0.0
sourcesrc
created_at2024-05-07 18:00:00.278664
updated_at2024-05-07 18:00:00.278664
descriptionA Rust implementation of the DeepPhonemizer G2P model (inference only).
homepage
repositoryhttps://github.com/ExpressiveLabs/deepphonemizer-rs
max_upload_size
id1232507
size306,907
layetri (layetri)

documentation

README

DeepPhonemizer in Rust

This repository contains a pure Rust implementation of the inferencing engine from DeepPhonemizer using the tch crate and the TorchScript JIT functionality.

Usage

To use the crate, add the following to your Cargo.toml:

[dependencies]
deepphonemizer-rs = "1.0.0"

Then, you can use the crate as follows:

use deepphonemizer::phonemizer::Phonemizer;

fn main() {
    let model_path = PathBuf::from("/path/to/model.pt");
    let config_path = PathBuf::from("/path/to/config.yaml");
    let language = "en_us";


    // Create the phonemizer from your trained DeepPhonemizer checkpoint
    let phonemizer = Phonemizer::from_checkpoint(
        model_path,
        config_path,
        Device::cuda_if_available(),
        None
    ).unwrap();
    
    // Run inference on text
    let phrase = "I am a worm and my name is Ben. Isn't this fantastic?".to_string();
    let result = phonemizer.phonemize(phrase, language);
    
    println!("{:?}", result);
}

Please note that this crate expects a traced checkpoint. To create this, refer to the original documentation.

License

deepphonemizer-rs is licensed under the MIT License.

Commit count: 31

cargo fmt