Update model card from MODEL_README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,100 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language: en
|
3 |
+
license: apache-2.0
|
4 |
+
tags:
|
5 |
+
- t5
|
6 |
+
- question-generation
|
7 |
+
- text2text-generation
|
8 |
+
- mcq
|
9 |
+
pretty_name: T5 for Technical MCQ Generation
|
10 |
---
|
11 |
+
|
12 |
+
# T5 for Technical MCQ Generation
|
13 |
+
|
14 |
+
## Model Description
|
15 |
+
|
16 |
+
This is a `t5-base` model fine-tuned for the specific task of generating technical multiple-choice questions (MCQs). Given a context paragraph and a correct answer, the model generates a relevant question.
|
17 |
+
|
18 |
+
This model is part of a larger pipeline that also generates distractors for the MCQ. It was developed to assist in creating educational content and assessments for technical topics.
|
19 |
+
|
20 |
+
The model was fine-tuned by [Ayush472](https://huggingface.co/Ayush472).
|
21 |
+
|
22 |
+
## Intended Uses & Limitations
|
23 |
+
|
24 |
+
### How to Use
|
25 |
+
|
26 |
+
This model is designed to be used within a larger MCQ generation pipeline but can be used as a standalone question generator. You can use it with the `transformers` library `pipeline` function for text-to-text generation.
|
27 |
+
|
28 |
+
First, install the necessary library:
|
29 |
+
```bash
|
30 |
+
pip install transformers sentencepiece
|
31 |
+
```
|
32 |
+
|
33 |
+
Then, you can use the following Python code to generate a question:
|
34 |
+
|
35 |
+
```python
|
36 |
+
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
37 |
+
|
38 |
+
model_name = "Ayush472/Technical_mcq_model"
|
39 |
+
tokenizer = T5Tokenizer.from_pretrained(model_name)
|
40 |
+
model = T5ForConditionalGeneration.from_pretrained(model_name)
|
41 |
+
|
42 |
+
# The context from which the question should be generated
|
43 |
+
context = "The `await` keyword pauses the execution of an async function until a Promise is settled, making asynchronous code look synchronous."
|
44 |
+
# The desired answer to the question
|
45 |
+
answer = "It pauses the execution of an async function until a Promise is settled"
|
46 |
+
|
47 |
+
# Prepare the input for the model
|
48 |
+
input_text = f"generate question: context: {context} answer: {answer}"
|
49 |
+
|
50 |
+
inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True)
|
51 |
+
|
52 |
+
# Generate the output
|
53 |
+
outputs = model.generate(
|
54 |
+
inputs.input_ids,
|
55 |
+
attention_mask=inputs.attention_mask,
|
56 |
+
max_length=64,
|
57 |
+
num_beams=4,
|
58 |
+
early_stopping=True
|
59 |
+
)
|
60 |
+
|
61 |
+
# Decode the generated question
|
62 |
+
generated_question = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
63 |
+
|
64 |
+
print(f"Context: {context}")
|
65 |
+
print(f"Answer: {answer}")
|
66 |
+
print(f"Generated Question: {generated_question}")
|
67 |
+
|
68 |
+
# Expected Output:
|
69 |
+
# Generated Question: What does the `await` keyword do in JavaScript?
|
70 |
+
```
|
71 |
+
|
72 |
+
### Limitations and Bias
|
73 |
+
|
74 |
+
* The model's knowledge is limited to the data it was trained on. It may not be able to generate questions for highly niche or very new technical topics.
|
75 |
+
* The quality of the generated question is highly dependent on the quality and clarity of the input context and answer.
|
76 |
+
* While the model is designed to generate factually consistent questions, it may occasionally produce questions that are awkwardly phrased or not perfectly aligned with the provided answer.
|
77 |
+
* There is no inherent mechanism to prevent the generation of biased or unfair questions if the training data contained such biases.
|
78 |
+
|
79 |
+
## Training Data
|
80 |
+
|
81 |
+
The model was fine-tuned on a private, custom-built dataset of technical articles and their corresponding multiple-choice questions. The dataset covered various topics in software development, including programming languages (Python, JavaScript), data structures, algorithms, and machine learning concepts.
|
82 |
+
|
83 |
+
## Training Procedure
|
84 |
+
|
85 |
+
The model was fine-tuned using the `transformers` library's `Trainer` API on a single NVIDIA T4 GPU. The `t5-base` model was used as the starting checkpoint. The training process involved formatting the dataset into `context: {context} answer: {answer}` inputs and the corresponding question as the target label.
|
86 |
+
|
87 |
+
## Citation
|
88 |
+
|
89 |
+
If you use this model in your work, please consider citing it:
|
90 |
+
|
91 |
+
```bibtex
|
92 |
+
@misc{ayush472_t5_mcq_2025,
|
93 |
+
author = {Ayush},
|
94 |
+
title = {T5 for Technical MCQ Generation},
|
95 |
+
year = {2025},
|
96 |
+
publisher = {Hugging Face},
|
97 |
+
journal = {Hugging Face repository},
|
98 |
+
howpublished = {\\url{https://huggingface.co/Ayush472/Technical_mcq_model}}
|
99 |
+
}
|
100 |
+
```
|