Update README.md
Browse files
README.md
CHANGED
@@ -74,7 +74,10 @@ Educational tools, tutoring platforms, and self-learning systems need a way to *
|
|
74 |
|
75 |
### Bonus: Retrieval-Augmented Generation (RAG)
|
76 |
|
77 |
-
A **custom RAG function** is
|
|
|
|
|
|
|
78 |
|
79 |
- Input can be a **subheading** or **small excerpt** from a textbook.
|
80 |
- The model fetches relevant supporting context form the textbook using a retirever.
|
@@ -117,6 +120,14 @@ def format_prompt(qtype, difficulty, context, answer=""):
|
|
117 |
|
118 |
---
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
## How to Use the Model
|
121 |
|
122 |
```python
|
@@ -132,7 +143,9 @@ def format_prompt(qtype, difficulty, context, answer=""):
|
|
132 |
answer_part = f"[{answer}]" if answer else ""
|
133 |
return f"<extra_id_97>{qtype} <extra_id_98>{difficulty} <extra_id_99>{answer_part} {context}"
|
134 |
|
|
|
135 |
context = "The sun is the center of our solar system."
|
|
|
136 |
qtype = "short answer" # qtype: ("short answer", "multiple choice question", "true or false question")
|
137 |
difficulty = "easy" # difficulty: ("easy", "medium", "hard")
|
138 |
prompt = format_prompt("short answer", "easy", context)
|
@@ -146,4 +159,9 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
146 |
|
147 |
```
|
148 |
|
|
|
|
|
|
|
|
|
|
|
149 |
|
|
|
74 |
|
75 |
### Bonus: Retrieval-Augmented Generation (RAG)
|
76 |
|
77 |
+
A **custom RAG function** is provided in this github link
|
78 |
+
https://github.com/Alla-Avinash/NLP-Question-Generation-with-RAG/blob/main/T5base_question_generation.py
|
79 |
+
|
80 |
+
This enables question generation from larger content sources like textbooks:
|
81 |
|
82 |
- Input can be a **subheading** or **small excerpt** from a textbook.
|
83 |
- The model fetches relevant supporting context form the textbook using a retirever.
|
|
|
120 |
|
121 |
---
|
122 |
|
123 |
+
## Code & Fine-tuning Guide
|
124 |
+
|
125 |
+
If you want to see how the T5 base model is Finetuned, you can check out the below github link
|
126 |
+
|
127 |
+
https://github.com/Alla-Avinash/NLP-Question-Generation-with-RAG/blob/main/Finetune.ipynb
|
128 |
+
|
129 |
+
---
|
130 |
+
|
131 |
## How to Use the Model
|
132 |
|
133 |
```python
|
|
|
143 |
answer_part = f"[{answer}]" if answer else ""
|
144 |
return f"<extra_id_97>{qtype} <extra_id_98>{difficulty} <extra_id_99>{answer_part} {context}"
|
145 |
|
146 |
+
# You can put any text here to create a question based on this context
|
147 |
context = "The sun is the center of our solar system."
|
148 |
+
|
149 |
qtype = "short answer" # qtype: ("short answer", "multiple choice question", "true or false question")
|
150 |
difficulty = "easy" # difficulty: ("easy", "medium", "hard")
|
151 |
prompt = format_prompt("short answer", "easy", context)
|
|
|
159 |
|
160 |
```
|
161 |
|
162 |
+
---
|
163 |
+
|
164 |
+
### Try it out in the Huggingface Spaces (without the RAG implementation)
|
165 |
+
|
166 |
+
https://huggingface.co/spaces/Avinash250325/Question_Generation_with_RAG
|
167 |
|