Downloads · 30 days
17
2% of all-time downloads
s-nlp/lewit-informal
lewit-informal is a machine learning model from s-nlp. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
LEWIP-informal model is designed to transfer formal text into informal keeping the important slots from the source text. The slots can be either pre-defined or detected automatically.
Downloads · 30 days
17
2% of all-time downloads
All-time downloads
801
Public
Repo size
1.8 GB
Likes
0
Public
Click a slice to open those files.
.bin892 MB · 100%
From the Hugging Face model README
LEWIP-informal model is designed to transfer formal text into informal keeping the important slots from the source text. The slots can be either pre-defined or detected automatically.
The model is based on LEWIP (Levenshtein editing with the parallel corpus). It exploits the ability of T5 model to fill the slots between the known texts with undefined number of tokens.
!pip install lewip_informal
from lewip_informal import LEWIP
model = LEWIP(use_cuda = True)
text = 'I want to go to NY'
ent = ['NY']
model.generate(text, ent)
# expected output 'i wanna go to NY'
In case the important slots are not known, they are automatically detected with auxiliary tagger model.
from lewip_informal import LEWIP
model = LEWIP(predefined_entities = False, use_cuda = True)
text = 'I really want to travel to NY'
model.generate(text)
# expected output 'I really want to go to NY'
You may want to have a look at the slots which were labeled as important by the tagger. Use 'show_template' variable
model.generate(text, show_template = True)
# expected output
# I <extra_id_0> want to <extra_id_1> to NY
# 'I really want to go to NY'