Skip to content

Commit

Permalink
Update README.md (#8544)
Browse files Browse the repository at this point in the history
Modified Model in Action section. The class `AutoModelWithLMHead` is deprecated so changed it to `AutoModelForSeq2SeqLM` for encoder-decoder models. Removed duplicate eos token.
  • Loading branch information
vishxl authored Nov 18, 2020
1 parent 6c8fad4 commit 26dc659
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions model_cards/mrm8488/t5-base-finetuned-squadv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ The training script is a slightly modified version of [this one](https://colab.r
## Model in Action 🚀

```python
from transformers import AutoModelWithLMHead, AutoTokenizer
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-squadv2")
model = AutoModelWithLMHead.from_pretrained("mrm8488/t5-base-finetuned-squadv2")
model = AutoModelForSeq2SeqLM.from_pretrained("mrm8488/t5-base-finetuned-squadv2")

def get_answer(question, context):
input_text = "question: %s context: %s </s>" % (question, context)
input_text = "question: %s context: %s" % (question, context)
features = tokenizer([input_text], return_tensors='pt')

output = model.generate(input_ids=features['input_ids'],
Expand Down

0 comments on commit 26dc659

Please sign in to comment.