Views
No views yet
deepset/roberta-base-squad2 on a custom Q&A dataset about Fanshawe College programs and admission requirements. It answers questions related to Fanshawe’s educational offerings in a helpful, focused way.Disclaimer: This model is not affiliated with or officially endorsed by Fanshawe College. It was built using publicly available information for educational purposes.
1from transformers import AutoTokenizer, AutoModelForQuestionAnswering
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("lamtdse61743/Roberta-Fanshawe")
5model = AutoModelForQuestionAnswering.from_pretrained("lamtdse61743/Roberta-Fanshawe")
6
7def ask_question(question, context):
8 inputs = tokenizer(question, context, return_tensors="pt")
9 with torch.no_grad():
10 outputs = model(**inputs)
11 start = torch.argmax(outputs.start_logits)
12 end = torch.argmax(outputs.end_logits) + 1
13 return tokenizer.decode(inputs["input_ids"][0][start:end], skip_special_tokens=True)
14
15context = "Fanshawe College requires a minimum GPA of 2.5 for admission into its Construction Project Management program."
16question = "What is the GPA requirement for admission?"
17print(ask_question(question, context))
18