nguyenvulebinh / spoken-norm

huggingface.co
Total runs: 2
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: February 12 2022

Introduction of spoken-norm

Model Details of spoken-norm

Transformation spoken text to written text

This model is used for formatting raw asr text output from spoken text to written text (Eg. date, number, id, ...). It also supports formatting "out of vocab" by using external vocabulary.

Some of examples:

input  : tám giờ chín phút ngày mười tám tháng năm năm hai nghìn không trăm hai mươi hai
output : 8h9 18/5/2022

input  : mã số quy đê tê tê đê hai tám chéo hai không không ba
output : mã số qdttd28/2003

input  : thể tích tám mét khối trọng lượng năm mươi ki lô gam
output : thể tích 8 m3 trọng lượng 50 kg

input    : ngày hai tám tháng tư cô vít bùng phát ở sờ cốt lờn chiếm tám mươi phần trăm là biến chủng đen ta và bê ta
ex_vocab : ['scotland', 'covid', 'delta', 'beta']
output   : 28/4 covid bùng phát ở scotland chiếm 80 % là biến chủng delta và beta
Model architecture

Model

Infer model

import torch
import model_handling
from data_handling import DataCollatorForNormSeq2Seq
from model_handling import EncoderDecoderSpokenNorm
import os
os.environ["CUDA_VISIBLE_DEVICES"] = ""
Init tokenizer and model
tokenizer = model_handling.init_tokenizer()
model = EncoderDecoderSpokenNorm.from_pretrained('nguyenvulebinh/spoken-norm', cache_dir=model_handling.cache_dir)
data_collator = DataCollatorForNormSeq2Seq(tokenizer)
Infer sample
bias_list = ['scotland', 'covid', 'delta', 'beta']
input_str = 'ngày hai tám tháng tư cô vít bùng phát ở sờ cốt lờn chiếm tám mươi phần trăm là biến chủng đen ta và bê ta'
inputs = tokenizer([input_str])
input_ids = inputs['input_ids']
attention_mask = inputs['attention_mask']
if len(bias_list) > 0:
    bias = data_collator.encode_list_string(bias_list)
    bias_input_ids = bias['input_ids']
    bias_attention_mask = bias['attention_mask']
else:
    bias_input_ids = None
    bias_attention_mask = None

inputs = {
    "input_ids": torch.tensor(input_ids),
    "attention_mask": torch.tensor(attention_mask),
    "bias_input_ids": bias_input_ids,
    "bias_attention_mask": bias_attention_mask,
}
Format input text with bias phrases
outputs = model.generate(**inputs, output_attentions=True, num_beams=1, num_return_sequences=1)

for output in outputs.cpu().detach().numpy().tolist():
    # print('\n', tokenizer.decode(output, skip_special_tokens=True).split(), '\n')
    print(tokenizer.sp_model.DecodePieces(tokenizer.decode(output, skip_special_tokens=True).split()))
28/4 covid bùng phát ở scotland chiếm 80 % là biến chủng delta và beta
Format input text without bias phrases
outputs = model.generate(**{
    "input_ids": torch.tensor(input_ids),
    "attention_mask": torch.tensor(attention_mask),
    "bias_input_ids": None,
    "bias_attention_mask": None,
}, output_attentions=True, num_beams=1, num_return_sequences=1)

for output in outputs.cpu().detach().numpy().tolist():
    # print('\n', tokenizer.decode(output, skip_special_tokens=True).split(), '\n')
    print(tokenizer.sp_model.DecodePieces(tokenizer.decode(output, skip_special_tokens=True).split()))
28/4 cô vít bùng phát ở sờ cốt lờn chiếm 80 % là biến chủng đen ta và bê ta
Contact

[email protected]

Follow

Runs of nguyenvulebinh spoken-norm on huggingface.co

2
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About spoken-norm huggingface.co Model

spoken-norm huggingface.co

spoken-norm huggingface.co is an AI model on huggingface.co that provides spoken-norm's model effect (), which can be used instantly with this nguyenvulebinh spoken-norm model. huggingface.co supports a free trial of the spoken-norm model, and also provides paid use of the spoken-norm. Support call spoken-norm model through api, including Node.js, Python, http.

nguyenvulebinh spoken-norm online free

spoken-norm huggingface.co is an online trial and call api platform, which integrates spoken-norm's modeling effects, including api services, and provides a free online trial of spoken-norm, you can try spoken-norm online for free by clicking the link below.

nguyenvulebinh spoken-norm online free url in huggingface.co:

https://huggingface.co/nguyenvulebinh/spoken-norm

spoken-norm install

spoken-norm is an open source model from GitHub that offers a free installation service, and any user can find spoken-norm on GitHub to install. At the same time, huggingface.co provides the effect of spoken-norm install, users can directly use spoken-norm installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

spoken-norm install url in huggingface.co:

https://huggingface.co/nguyenvulebinh/spoken-norm

Url of spoken-norm

Provider of spoken-norm huggingface.co

nguyenvulebinh
ORGANIZATIONS

Other API from nguyenvulebinh