ashish-merlyn commited on
Commit
c2dd6df
1 Parent(s): 02646c9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +97 -0
README.md CHANGED
@@ -1,3 +1,100 @@
1
  ---
2
  license: apache-2.0
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ tags:
4
+ - MerlynMind
5
+ - education
6
  ---
7
+
8
+ # Merlyn-education-teacher-assistant
9
+
10
+ Merlyn-education-teacher-assistant is a 12b parameter decoder-style transformer model for the education domain. It is fine-tuned from a [pythia-12b](https://huggingface.co/EleutherAI/pythia-12b) base-model.
11
+
12
+ This model was trained by [Merlyn Mind](https://www.merlyn.org/).
13
+
14
+ Merlyn-education-teacher-assistant is part of the family of Merlyn Mind models designed specifically for use in in- and out-of-classroom education.
15
+
16
+ Merlyn-education-teacher-assistant makes helpful recommendations based on the ongoing classroom discussion, suggesting research activities and topics for further exploration.
17
+
18
+ ## Model Date
19
+
20
+ June 26, 2023
21
+
22
+ ## Model License
23
+
24
+ Apache-2.0
25
+
26
+ ## Documentation
27
+
28
+ * [Merlyn Mind’s education-specific language models](https://www.merlyn.org/)
29
+
30
+ ## Usage
31
+
32
+ Loading model and tokenizer:
33
+
34
+ ```python
35
+ import torch
36
+ from transformers import AutoTokenizer, AutoModelForCausalLM
37
+
38
+ model_path = "MerlynMind/merlyn-education-teacher-assistant"
39
+ device = torch.device("cuda:0") # change device id as necessary
40
+ model = AutoModelForCausalLM.from_pretrained(model_path)
41
+ tokenizer = AutoTokenizer.from_pretrained(model_path, fast_tokenizer=True)
42
+ model.to(device) # move to device
43
+ ```
44
+
45
+ Prompt example:
46
+
47
+ ```python
48
+ conversation = ''''user1':\tHow do some gases help keep the Earth warm?
49
+ 'user2':\tSome gases, called greenhouse gases, act like a blanket around Earth by trapping heat from the sun in the atmosphere, which keeps our planet warm. This process is known as the greenhouse effect.
50
+ 'user1':\tHow can we reduce greenhouse gas emissions?
51
+ 'user2':\tWe can reduce greenhouse gas emissions by using renewable energy sources, increasing energy efficiency, and reducing waste.'''
52
+
53
+ prompt = tokenizer.bos_token
54
+ prompt += '''Instruction:\tYou are teaching high school students.
55
+ Instruction:\tYou are observing the following conversation between two users.
56
+ Instruction:\tGenerate 3 research activities based on the conversation.
57
+ Instruction:\tThe research activities should be doable by high school students.
58
+ Instruction:\tYour response should be a well-formed JSON array of 3 objects, each with a 'title' property and an 'activity' property.
59
+
60
+ Conversation:''' + f"\n{conversation}" + " Response:"
61
+ ```
62
+
63
+ Inference:
64
+
65
+ ```python
66
+ inputs = tokenizer(prompt, return_tensors="pt").to(device)
67
+ generate_ids = model.generate(
68
+ **inputs,
69
+ max_new_tokens=1024,
70
+ temperature=0.0,
71
+ num_beams=2
72
+ )
73
+ response = tokenizer.decode(generate_ids[0],
74
+ skip_special_tokens=True,
75
+ clean_up_tokenization_spaces=True)
76
+ ```
77
+
78
+ Example output (after response processing):
79
+
80
+ ```json
81
+ [
82
+ {"title": "Understanding the Greenhouse Effect", "activity": "Research the greenhouse effect and the role of greenhouse gases in keeping Earth warm. Create a presentation or poster explaining the greenhouse effect and how greenhouse gases act as a blanket around Earth."},
83
+ {"title": "Renewable Energy Sources", "activity": "Identify different renewable energy sources, such as solar, wind, and geothermal energy, and explain how they can help reduce greenhouse gas emissions."},
84
+ {"title": "Energy Efficiency and Waste Reduction", "activity": "Research energy efficiency and waste reduction practices, and develop a plan to implement these practices in your school or community to reduce greenhouse gas emissions."}
85
+ ]
86
+ ```
87
+
88
+ ## Citation
89
+
90
+ To cite this model, please use:
91
+
92
+ ```
93
+ @online{MerlynEducationModels,
94
+ author = {Merlyn Mind AI Team},
95
+ title = {Merlyn Mind's education-domain language models},
96
+ year = {2023},
97
+ url = {merlyn.org},
98
+ urldate = {2023-06-26}
99
+ }
100
+ ```