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

Can 3 distractors be generated ? #11

Open
MdYeasinSamadArnob opened this issue Feb 11, 2022 · 1 comment
Open

Can 3 distractors be generated ? #11

MdYeasinSamadArnob opened this issue Feb 11, 2022 · 1 comment

Comments

@MdYeasinSamadArnob
Copy link

Hey, if I give context, question and answer as input then I get one distractor. Is 3 distractors possible?

@voidful
Copy link
Owner

voidful commented Mar 1, 2022

For BART version:

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("voidful/bart-distractor-generation-pm")

model = AutoModelForSeq2SeqLM.from_pretrained("voidful/bart-distractor-generation-pm")

example = "When you ' re having a holiday , one of the main questions to ask is which hotel or apartment to choose . However , when it comes to France , you have another special choice : treehouses . In France , treehouses are offered to travelers as a new choice in many places . The price may be a little higher , but you do have a chance to _ your childhood memories . Alain Laurens , one of France ' s top treehouse designers , said , ' Most of the people might have the experience of building a den when they were young . And they like that feeling of freedom when they are children . ' Its fairy - tale style gives travelers a special feeling . It seems as if they are living as a forest king and enjoying the fresh air in the morning . Another kind of treehouse is the ' star cube ' . It gives travelers the chance of looking at the stars shining in the sky when they are going to sleep . Each ' star cube ' not only offers all the comfortable things that a hotel provides for travelers , but also gives them a chance to look for stars by using a telescope . The glass roof allows you to look at the stars from your bed . </s> The passage mainly tells us </s> treehouses in france."

tokenizer.batch_decode(model.generate(tokenizer.encode("example",return_tensors='pt'),num_return_sequences=3,num_beams=3))

For BERT version in tfkit

you can refer to here: https://github.com/voidful/BDG/blob/main/BDG_selection.ipynb

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

2 participants