Spaces:
Sleeping
Sleeping
new_v2_llama3
#7
by
ivnban27-ctl
- opened
- app_config.py +2 -5
- convosim.py +1 -1
- models/model_seeds.py +3 -57
- utils/chain_utils.py +1 -1
app_config.py
CHANGED
@@ -4,21 +4,18 @@ from models.model_seeds import seeds, seed2str
|
|
4 |
ISSUES = [k for k,_ in seeds.items()]
|
5 |
SOURCES = [
|
6 |
"CTL_llama2",
|
7 |
-
# "CTL_llama3",
|
8 |
# "CTL_mistral",
|
9 |
'OA_rolemodel',
|
10 |
# 'OA_finetuned',
|
11 |
]
|
12 |
SOURCES_LAB = {"OA_rolemodel":'OpenAI GPT3.5',
|
13 |
"OA_finetuned":'Finetuned OpenAI',
|
14 |
-
"CTL_llama2": "Llama
|
15 |
-
#"CTL_llama3": "Llama 3",
|
16 |
"CTL_mistral": "Mistral",
|
17 |
}
|
18 |
|
19 |
ENDPOINT_NAMES = {
|
20 |
-
"CTL_llama2": "
|
21 |
-
# "CTL_llama3": "texter_simulator",
|
22 |
# 'CTL_llama2': "llama2_convo_sim",
|
23 |
"CTL_mistral": "convo_sim_mistral"
|
24 |
}
|
|
|
4 |
ISSUES = [k for k,_ in seeds.items()]
|
5 |
SOURCES = [
|
6 |
"CTL_llama2",
|
|
|
7 |
# "CTL_mistral",
|
8 |
'OA_rolemodel',
|
9 |
# 'OA_finetuned',
|
10 |
]
|
11 |
SOURCES_LAB = {"OA_rolemodel":'OpenAI GPT3.5',
|
12 |
"OA_finetuned":'Finetuned OpenAI',
|
13 |
+
"CTL_llama2": "Llama",
|
|
|
14 |
"CTL_mistral": "Mistral",
|
15 |
}
|
16 |
|
17 |
ENDPOINT_NAMES = {
|
18 |
+
"CTL_llama2": "conversation_simulator",
|
|
|
19 |
# 'CTL_llama2': "llama2_convo_sim",
|
20 |
"CTL_mistral": "convo_sim_mistral"
|
21 |
}
|
convosim.py
CHANGED
@@ -28,7 +28,7 @@ if 'texter_name' not in st.session_state:
|
|
28 |
memories = {'memory':{"issue": st.session_state['issue'], "source": st.session_state['previous_source']}}
|
29 |
|
30 |
with st.sidebar:
|
31 |
-
username = st.text_input("Username", value='
|
32 |
if 'counselor_name' not in st.session_state:
|
33 |
st.session_state["counselor_name"] = username #get_random_name(names_df=DEFAULT_NAMES_DF)
|
34 |
# temperature = st.slider("Temperature", 0., 1., value=0.8, step=0.1)
|
|
|
28 |
memories = {'memory':{"issue": st.session_state['issue'], "source": st.session_state['previous_source']}}
|
29 |
|
30 |
with st.sidebar:
|
31 |
+
username = st.text_input("Username", value='Barbara', max_chars=30)
|
32 |
if 'counselor_name' not in st.session_state:
|
33 |
st.session_state["counselor_name"] = username #get_random_name(names_df=DEFAULT_NAMES_DF)
|
34 |
# temperature = st.slider("Temperature", 0., 1., value=0.8, step=0.1)
|
models/model_seeds.py
CHANGED
@@ -6,12 +6,12 @@ texter: I need to talk to someone"""
|
|
6 |
},
|
7 |
"full_convo__seeded1": {
|
8 |
# "prompt": "Your character is suffering from bullying at school. Your character has suicidal thoughs but has not harmed himself. You are talkative, and open to talk about your problems.",
|
9 |
-
"memory": """texter:
|
10 |
-
texter:
|
11 |
},
|
12 |
"full_convo__seeded2": {
|
13 |
# "prompt": "Your character is suffering anxiety from finals week. Your character does not have suicidal thoughs but has harmed herself. You are talkative, and open to talk about your problems.",
|
14 |
-
"memory": """texter:
|
15 |
texter: I don't know what to do"""
|
16 |
},
|
17 |
"safety_assessment__seeded1": {
|
@@ -46,51 +46,6 @@ helper: You are so brave for dealing with this pain for so long.
|
|
46 |
helper: With all this going on I can tell you are struggling and in so much pain. Have you had any thoughts of suicide in the last few days, including today?
|
47 |
texter: Yes, all the time. I don't see any point in living a life without her"""
|
48 |
},
|
49 |
-
"full_convo__seeded3": {
|
50 |
-
# "prompt": "",
|
51 |
-
"memory": """texter: Help
|
52 |
-
texter: I am feeling so lost"""
|
53 |
-
},
|
54 |
-
"full_convo__seeded4": {
|
55 |
-
# "prompt": "",
|
56 |
-
"memory": """texter: Help
|
57 |
-
texter: I need help"""
|
58 |
-
},
|
59 |
-
"full_convo__seeded5": {
|
60 |
-
# "prompt": "",
|
61 |
-
"memory": """texter: Help
|
62 |
-
texter: hello? is anyone there to help?"""
|
63 |
-
},
|
64 |
-
"full_convo__seeded6": {
|
65 |
-
# "prompt": "",
|
66 |
-
"memory": """texter: Help
|
67 |
-
texter: I think I overdosed"""
|
68 |
-
},
|
69 |
-
"full_convo__hard": {
|
70 |
-
# "prompt": "",
|
71 |
-
"memory": """texter: Help
|
72 |
-
texter: Is there someone to talk?"""
|
73 |
-
},
|
74 |
-
"full_convo__hard__seeded1": {
|
75 |
-
# "prompt": "",
|
76 |
-
"memory": """texter: Help
|
77 |
-
texter: hello? is anyone there to help?"""
|
78 |
-
},
|
79 |
-
"full_convo__hard__seeded2": {
|
80 |
-
# "prompt": "",
|
81 |
-
"memory": """texter: Help
|
82 |
-
texter: I can't stand it anymore"""
|
83 |
-
},
|
84 |
-
"full_convo__hard__seeded3": {
|
85 |
-
# "prompt": "",
|
86 |
-
"memory": """texter: Help
|
87 |
-
texter: idk what to do"""
|
88 |
-
},
|
89 |
-
"full_convo__hard__seeded4": {
|
90 |
-
# "prompt": "",
|
91 |
-
"memory": """texter: Help
|
92 |
-
texter: I need help"""
|
93 |
-
},
|
94 |
# "NewSA__YesNo.2": {
|
95 |
# "prompt": "Your character is suffering from bullying at school. Your character has suicidal thoughs but has not harmed himself. You are talkative, and open to talk about your problems.",
|
96 |
# "memory": """texter: I just can’t take it anymore. Every day is just endless torment.
|
@@ -204,15 +159,6 @@ seed2str = {
|
|
204 |
"full_convo__seeded2": "Parent Issues",
|
205 |
"safety_assessment__seeded1": "Safety Assessment - Bullying ",
|
206 |
"safety_assessment__seeded2": "Safety Assessment - Grief ",
|
207 |
-
"full_convo__seeded3": "LGBTQ+",
|
208 |
-
"full_convo__seeded4": "Relationship Issues",
|
209 |
-
"full_convo__seeded5": "Child Abuse",
|
210 |
-
"full_convo__seeded6": "Overdose",
|
211 |
-
"full_convo__hard": "Difficult - General",
|
212 |
-
"full_convo__hard__seeded1": "Difficult - Bullying",
|
213 |
-
"full_convo__hard__seeded2": "Difficult - Parent Issues",
|
214 |
-
"full_convo__hard__seeded3": "Difficult - LGBTQ+",
|
215 |
-
"full_convo__hard__seeded4": "Difficult - Relationship Issues"
|
216 |
|
217 |
# "NewSA__NoNo.2": "No thoughts No Harm No context",
|
218 |
# "NewSA__YesNo.2": "Yes thoughts No Harm No context",
|
|
|
6 |
},
|
7 |
"full_convo__seeded1": {
|
8 |
# "prompt": "Your character is suffering from bullying at school. Your character has suicidal thoughs but has not harmed himself. You are talkative, and open to talk about your problems.",
|
9 |
+
"memory": """texter: TikTok
|
10 |
+
texter: Is someone real here?"""
|
11 |
},
|
12 |
"full_convo__seeded2": {
|
13 |
# "prompt": "Your character is suffering anxiety from finals week. Your character does not have suicidal thoughs but has harmed herself. You are talkative, and open to talk about your problems.",
|
14 |
+
"memory": """texter: HOME
|
15 |
texter: I don't know what to do"""
|
16 |
},
|
17 |
"safety_assessment__seeded1": {
|
|
|
46 |
helper: With all this going on I can tell you are struggling and in so much pain. Have you had any thoughts of suicide in the last few days, including today?
|
47 |
texter: Yes, all the time. I don't see any point in living a life without her"""
|
48 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
# "NewSA__YesNo.2": {
|
50 |
# "prompt": "Your character is suffering from bullying at school. Your character has suicidal thoughs but has not harmed himself. You are talkative, and open to talk about your problems.",
|
51 |
# "memory": """texter: I just can’t take it anymore. Every day is just endless torment.
|
|
|
159 |
"full_convo__seeded2": "Parent Issues",
|
160 |
"safety_assessment__seeded1": "Safety Assessment - Bullying ",
|
161 |
"safety_assessment__seeded2": "Safety Assessment - Grief ",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
# "NewSA__NoNo.2": "No thoughts No Harm No context",
|
164 |
# "NewSA__YesNo.2": "Yes thoughts No Harm No context",
|
utils/chain_utils.py
CHANGED
@@ -12,7 +12,7 @@ def get_chain(issue, language, source, memory, temperature, texter_name=""):
|
|
12 |
seed = seeds.get(issue, "GCT")['prompt']
|
13 |
template = get_template_role_models(issue, language, texter_name=texter_name, seed=seed)
|
14 |
return get_role_chain(template, memory, temperature)
|
15 |
-
elif source in ('CTL_llama2'
|
16 |
if language == "English":
|
17 |
language = "en"
|
18 |
elif language == "Spanish":
|
|
|
12 |
seed = seeds.get(issue, "GCT")['prompt']
|
13 |
template = get_template_role_models(issue, language, texter_name=texter_name, seed=seed)
|
14 |
return get_role_chain(template, memory, temperature)
|
15 |
+
elif source in ('CTL_llama2'):
|
16 |
if language == "English":
|
17 |
language = "en"
|
18 |
elif language == "Spanish":
|