Instructions to use ashishkat/questionAnswer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ashishkat/questionAnswer with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("ashishkat/questionAnswer") model = AutoModelForSeq2SeqLM.from_pretrained("ashishkat/questionAnswer", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -48,4 +48,21 @@ def generate_answer(question, context):
|
|
| 48 |
|
| 49 |
return " ".join(pred) ## returns the predicted string as answer
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
```
|
|
|
|
| 48 |
|
| 49 |
return " ".join(pred) ## returns the predicted string as answer
|
| 50 |
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
context = "The Normans (Norman: Nourmands; French: Normands; Latin: Normanni) were the people who \
|
| 55 |
+
in the 10th and 11th centuries gave their name to Normandy, a region in France. They were\
|
| 56 |
+
descended from Norse (\"Norman\" comes from \"Norseman\") raiders and pirates from Denmark,\
|
| 57 |
+
Iceland and Norway who, under their leader Rollo, agreed to swear fealty to King Charles III\
|
| 58 |
+
of West Francia. Through generations of assimilation and mixing with the native Frankish and\
|
| 59 |
+
Roman-Gaulish populations, their descendants would gradually merge with the Carolingian-based\
|
| 60 |
+
cultures of West Francia. The distinct cultural and ethnic identity of the Normans emerged initially\
|
| 61 |
+
in the first half of the 10th century, and it continued to evolve over the succeeding centuries."
|
| 62 |
+
|
| 63 |
+
question = "From which countries did the Norse originate?"
|
| 64 |
+
# question = "Who was the Norse leader?" "rollo"
|
| 65 |
+
# actual_answer = "Denmark, Iceland and Norway"
|
| 66 |
+
answer = generate_answer(context, question)
|
| 67 |
+
print(answer)
|
| 68 |
```
|