ToddGoldfarb
commited on
Commit
•
f3970b8
1
Parent(s):
77885a5
Update README.md
Browse files
README.md
CHANGED
@@ -6,13 +6,11 @@ language:
|
|
6 |
- en
|
7 |
pipeline_tag: conversational
|
8 |
---
|
9 |
-
# What is Cadet-
|
10 |
|
11 |
-
Inspired by Allen AI's **Cosmo-XL**, **Cadet-
|
12 |
|
13 |
-
**Cadet-
|
14 |
-
|
15 |
-
This is my first SEQ2SEQ NLP Model I've ever made! I'm very excited to share it here on HuggingFace! :)
|
16 |
|
17 |
If you have any questions, or any comments on improvements, please contact me at: **tcgoldfarb@gmail.com**
|
18 |
|
@@ -22,11 +20,11 @@ If you have any questions, or any comments on improvements, please contact me at
|
|
22 |
|
23 |
Here is the link to the Google Colab file, where I walk through the process of training the model and using the SODA public dataset from AI2.
|
24 |
|
25 |
-
https://colab.research.google.com/drive/
|
26 |
|
27 |
-
# Get Started With Cadet-
|
28 |
|
29 |
-
Use the code snippet below to get started with Cadet-
|
30 |
|
31 |
```
|
32 |
import torch
|
@@ -35,12 +33,12 @@ import colorful as cf
|
|
35 |
|
36 |
cf.use_true_colors()
|
37 |
cf.use_style('monokai')
|
38 |
-
class
|
39 |
def __init__(self):
|
40 |
-
print(cf.bold | cf.purple("Waking up Cadet-
|
41 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
42 |
-
self.tokenizer = AutoTokenizer.from_pretrained("t5-
|
43 |
-
self.model = AutoModelForSeq2SeqLM.from_pretrained("ToddGoldfarb/Cadet-
|
44 |
self.conversation_history = ""
|
45 |
|
46 |
def observe(self, observation):
|
@@ -98,36 +96,36 @@ class CadetTinyAgent:
|
|
98 |
continue_chat = ""
|
99 |
|
100 |
# MODIFY THESE STRINGS TO YOUR LIKING :)
|
101 |
-
situation_narrative = "Imagine you are Cadet-
|
102 |
-
role_instruction = "You are Cadet-
|
103 |
|
104 |
self.chat(situation_narrative, role_instruction)
|
105 |
continue_chat = get_valid_input(cf.purple("Start a new conversation with new setup? [Y/N]:"), "Y")
|
106 |
if continue_chat in ["N", "n"]:
|
107 |
break
|
108 |
|
109 |
-
print(cf.blue("
|
110 |
|
111 |
def chat(self, situation_narrative, role_instruction):
|
112 |
print(cf.green(
|
113 |
-
"Cadet-
|
114 |
while True:
|
115 |
user_input = input("You: ")
|
116 |
if user_input == "[RESET]":
|
117 |
self.reset_history()
|
118 |
-
print(cf.green("[Conversation history cleared. Chat with Cadet-
|
119 |
continue
|
120 |
if user_input == "[END]":
|
121 |
break
|
122 |
response = self.generate(situation_narrative, role_instruction, user_input)
|
123 |
-
print(cf.blue("
|
124 |
|
125 |
|
126 |
def main():
|
127 |
print(cf.bold | cf.blue("LOADING MODEL"))
|
128 |
|
129 |
-
|
130 |
-
|
131 |
|
132 |
|
133 |
if __name__ == '__main__':
|
|
|
6 |
- en
|
7 |
pipeline_tag: conversational
|
8 |
---
|
9 |
+
# What is Cadet-Medium?
|
10 |
|
11 |
+
Inspired by Allen AI's **Cosmo-XL**, **Cadet-Medium** is a somewhat small conversational model trained off of the **SODA** dataset. **Cadet-Medium** is intended for inference at the edge (on something as small as a 2GB RAM Raspberry Pi).
|
12 |
|
13 |
+
**Cadet-Medium** is trained off of the **t5-base** pretrained model from Google.
|
|
|
|
|
14 |
|
15 |
If you have any questions, or any comments on improvements, please contact me at: **tcgoldfarb@gmail.com**
|
16 |
|
|
|
20 |
|
21 |
Here is the link to the Google Colab file, where I walk through the process of training the model and using the SODA public dataset from AI2.
|
22 |
|
23 |
+
https://colab.research.google.com/drive/1uekZ0gO3GqjPwno16tV1A4Gitrl7p3ur?usp=sharing
|
24 |
|
25 |
+
# Get Started With Cadet-Medium
|
26 |
|
27 |
+
Use the code snippet below to get started with Cadet-Medium!
|
28 |
|
29 |
```
|
30 |
import torch
|
|
|
33 |
|
34 |
cf.use_true_colors()
|
35 |
cf.use_style('monokai')
|
36 |
+
class CadetMedAgent:
|
37 |
def __init__(self):
|
38 |
+
print(cf.bold | cf.purple("Waking up Cadet-Medium..."))
|
39 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
40 |
+
self.tokenizer = AutoTokenizer.from_pretrained("t5-base", model_max_length=512)
|
41 |
+
self.model = AutoModelForSeq2SeqLM.from_pretrained("ToddGoldfarb/Cadet-Medium", low_cpu_mem_usage=True).to(self.device)
|
42 |
self.conversation_history = ""
|
43 |
|
44 |
def observe(self, observation):
|
|
|
96 |
continue_chat = ""
|
97 |
|
98 |
# MODIFY THESE STRINGS TO YOUR LIKING :)
|
99 |
+
situation_narrative = "Imagine you are Cadet-Medium talking to ???."
|
100 |
+
role_instruction = "You are Cadet-Medium, and you are talking to ???."
|
101 |
|
102 |
self.chat(situation_narrative, role_instruction)
|
103 |
continue_chat = get_valid_input(cf.purple("Start a new conversation with new setup? [Y/N]:"), "Y")
|
104 |
if continue_chat in ["N", "n"]:
|
105 |
break
|
106 |
|
107 |
+
print(cf.blue("CM: See you!"))
|
108 |
|
109 |
def chat(self, situation_narrative, role_instruction):
|
110 |
print(cf.green(
|
111 |
+
"Cadet-Medium is running! Input [RESET] to reset the conversation history and [END] to end the conversation."))
|
112 |
while True:
|
113 |
user_input = input("You: ")
|
114 |
if user_input == "[RESET]":
|
115 |
self.reset_history()
|
116 |
+
print(cf.green("[Conversation history cleared. Chat with Cadet-Medium!]"))
|
117 |
continue
|
118 |
if user_input == "[END]":
|
119 |
break
|
120 |
response = self.generate(situation_narrative, role_instruction, user_input)
|
121 |
+
print(cf.blue("CM: " + response))
|
122 |
|
123 |
|
124 |
def main():
|
125 |
print(cf.bold | cf.blue("LOADING MODEL"))
|
126 |
|
127 |
+
CadetMed = CadetMedAgent()
|
128 |
+
CadetMed.run()
|
129 |
|
130 |
|
131 |
if __name__ == '__main__':
|