No project description provided
Project description
asrp
ASR text preprocessing utility
install
pip install asrp
usage - preprocess
input: dictionary, with key sentence
output: preprocessed result, inplace handling.
import asrp
batch_data = {
'sentence': "I'm fine, thanks."
}
asrp.fun_en(batch_data)
dynamic loading
import asrp
batch_data = {
'sentence': "I'm fine, thanks."
}
preprocessor = getattr(asrp, 'fun_en')
preprocessor(batch_data)
usage - evaluation
import asrp
targets = ['HuggingFace is great!', 'Love Transformers!', 'Let\'s wav2vec!']
preds = ['HuggingFace is awesome!', 'Transformers is powerful.', 'Let\'s finetune wav2vec!']
print("chunk size WER: {:2f}".format(100 * asrp.chunked_wer(targets, preds, chunk_size=None)))
print("chunk size CER: {:2f}".format(100 * asrp.chunked_cer(targets, preds, chunk_size=None)))
usage - hubertcode
import asrp
hc = asrp.HubertCode("facebook/hubert-large-ll60k", './km_feat_100_layer_20', 20)
hc('voice file path')
usage - code2speech
import asrp
code = [] # discrete unit
# download tts checkpoint and waveglow_checkpint from https://github.com/pytorch/fairseq/tree/main/examples/textless_nlp/gslm/unit2speech
cs = asrp.Code2Speech(tts_checkpoint='./tts_checkpoint_best.pt', waveglow_checkpint='waveglow_256channels_new.pt')
cs(code)
# play on notebook
import IPython.display as ipd
ipd.Audio(data=cs(code), autoplay=False, rate=cs.sample_rate)
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
asrp-0.0.28.tar.gz
(27.7 kB
view details)
Built Distribution
asrp-0.0.28-py3-none-any.whl
(25.1 kB
view details)
File details
Details for the file asrp-0.0.28.tar.gz
.
File metadata
- Download URL: asrp-0.0.28.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f1dfc02b5a1e40d346a504526035cfb03f0ec5ebcf5cc8f7317fb43dc7d570d |
|
MD5 | d9d378a28eaf567e92333c9fb6edce08 |
|
BLAKE2b-256 | a521eabf4bff8a61ef082f834dd23c0b747bc61e91b4dc1b34008b430dd4cdca |
File details
Details for the file asrp-0.0.28-py3-none-any.whl
.
File metadata
- Download URL: asrp-0.0.28-py3-none-any.whl
- Upload date:
- Size: 25.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 854be434daa28519758982bb445de36f0c5bc45753b8d866aecf72992a141e07 |
|
MD5 | a02e7a377fba29349b925581928479d8 |
|
BLAKE2b-256 | 2ac972c3d0c408b3db6d6d7fe9ebba75ffb4e68fa038fb0ad48572699469b360 |