Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to perform text infilling #438

Open
oierIM opened this issue Apr 10, 2024 · 0 comments
Open

How to perform text infilling #438

oierIM opened this issue Apr 10, 2024 · 0 comments

Comments

@oierIM
Copy link

oierIM commented Apr 10, 2024

I'm attempting to perform text infilling, but it doesn't seem to work. I'm not sure if the input that I am providing is correct or not, or how to change it so that it works propertly. Here is the code that I'm using:

from transformers import OFAModel, OFATokenizer

model = OFAModel.from_pretrained('path', use_cache=True)
tokenizer = OFATokenizer.from_pretrained('path')

txt = ' what is the complete text of "A <mask> woman"?'

inputs = tokenizer([txt], return_tensors="pt").input_ids
gen = model.generate(inputs)

If I print 'gen', I get the following: ['\x1a "what's the woman"?"? "what's the woman"?"? "what's']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant