File size: 2,809 Bytes
51a57c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
license: mit
datasets:
- head_qa
language:
- en
library_name: transformers
---

# ibleducation/ibl-multiple-choice-7B
ibleducation/ibl-multiple-choice-7B is a model finetuned on top of mistralai/Mistral-7B-Instruct-v0.1


The model is finetuned to generate a multiple choice questions.
The output of the model is a json object with the following entries
1. category: The topic area of the question
2. qtext: The question text
3. ra: The aid of the correct answer
4. answers: a list of possible answer choices each with an `aid` (answer id) and `atext` (answer text.)



## Example Conversations
1. Question:  Photosynthesis \
   Answer:
   ```json
     {
      "category": "Photosynthesis",
      "qtext": "The chlorophyll fluorescence measurement technique is based on the emission of fluorescence by the chlorophylls present in the photosynthetic pigmentation:",
      "ra": 4,
      "answers": [
        {"aid": 1, "atext": "It is used to determine the light absorption characteristics of the pigments."},
        {"aid": 2, "atext": "It is used to determine the light emission characteristics of the pigments."},
        {"aid": 3, "atext": "It is used to determine the kinetics of light absorption by the pigments."},
        {"aid": 4, "atext": "It is used to determine the kinetics of light emission by the pigments."},
        {"aid": 5, "atext": "It is used to determine the energy that the pigments emit when they absorb light."}
      ]
    }
   ```


## Model Details

- **Developed by:** [IBL Education](https://ibl.ai)
- **Model type:** [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
- **Base Model:** [Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
- **Language:** English
- **Finetuned from weights:** [Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
- **Finetuned on data:**
  - [Head_qa](https://huggingface.co/datasets/head_qa)
- **Model License:** MIT

## How to Get Started with the Model

### Install the necessary packages

Requires: [transformers](https://pypi.org/project/transformers/) > 4.35.0 
```shell
pip install transformers
pip install accelerate
```
### You can then try the following example code

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import transformers
import torch

model_id = "ibleducation/ibl-multiple-choice-7B"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
  model_id,
  device_map="auto",
)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
)
prompt = "<s>[INST] Algebra [/INST] "

response = pipeline(prompt)
print(response['generated_text'])
```

**Important** - Use the prompt template below:
```
<s>[INST] {prompt} [/INST] 
```