VenkatManda commited on
Commit
c464522
1 Parent(s): f5f2caf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -1
README.md CHANGED
@@ -4,4 +4,67 @@ datasets:
4
  - VenkatManda/KaggleQuestions
5
  language:
6
  - en
7
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  - VenkatManda/KaggleQuestions
5
  language:
6
  - en
7
+ ---
8
+
9
+ # Kaggle Q&A Model Fine-tuned from GPT-2
10
+
11
+ ## Overview
12
+
13
+ This repository contains a question-answering (Q&A) model fine-tuned from OpenAI's GPT-2 on Kaggle data. The model is hosted on Hugging Face's model hub and can be easily used for various question-answering tasks.
14
+
15
+ ## Model Details
16
+
17
+ - **Base Model**: OpenAI's GPT-2
18
+ - **Fine-tuned Dataset**: Kaggle Q&A data
19
+ - **Model Type**: Transformer-based Language Model
20
+ - **Framework**: Hugging Face's Transformers Library
21
+
22
+ ## Usage
23
+
24
+ To use this model, follow these steps:
25
+
26
+ 1. Install the `transformers` library by Hugging Face:
27
+
28
+ ```bash
29
+ pip install transformers
30
+
31
+ # Load the model using its identifier:
32
+
33
+ ```bash
34
+ from transformers import AutoTokenizer, AutoModelForQuestionAnswering
35
+
36
+ # Load tokenizer and model
37
+ tokenizer = AutoTokenizer.from_pretrained("VenkatManda/KaggleQuestionsModelGPT2")
38
+ model = AutoModelForQuestionAnswering.from_pretrained("VenkatManda/KaggleQuestionsModelGPT2")
39
+
40
+
41
+
42
+ # Provide context and question
43
+ context = "Your context here"
44
+ question = "Your question here?"
45
+
46
+ # Tokenize input
47
+ inputs = tokenizer(question, context, return_tensors="pt")
48
+
49
+ # Perform inference
50
+ outputs = model(**inputs)
51
+
52
+ # Get answer
53
+ answer_start_scores = outputs.start_logits
54
+ answer_end_scores = outputs.end_logits
55
+ answer_start = torch.argmax(answer_start_scores)
56
+ answer_end = torch.argmax(answer_end_scores) + 1
57
+ answer = tokenizer.convert_tokens_to_string(tokenizer.convert_ids_to_tokens(inputs["input_ids"][0][answer_start:answer_end]))
58
+ print("Answer:", answer)
59
+
60
+
61
+ @article{venkat2024kagglegpt2qa,
62
+ title={Kaggle Q&A Model Fine-tuned from GPT-2},
63
+ author={Venkat},
64
+ journal={GitHub},
65
+ year={2024},
66
+ howpublished={\url{https://github.com/venkat/kaggle-gpt2-qa}}
67
+ }
68
+
69
+
70
+