Spaces:
Sleeping
Sleeping
model_name_or_path = "FacebookAI/xlm-roberta-large" | |
CPC_LABEL2STR = { | |
"0_ActiveEngagement": "Active Engagement", | |
"1_Explore": "Explore", | |
"2_IRA": "Immidiate Risk Assessment", | |
"3_SafetyAssessment": "Safety Assessment", | |
"4_SP&NS": "Safety Planning & Next Steps", | |
"5_EmergencyIntervention": "Emergency Intervention", | |
"6_WrappingUp": "Wrapping Up", | |
"7_Other": "Other", | |
} | |
CPC_LBL_OPTS = list(CPC_LABEL2STR.keys()) | |
def cpc_label2str(phase): | |
return CPC_LABEL2STR[phase] | |
def phase2int(phase): | |
return int(phase.split("_")[0]) | |
BP_LBL_OPTS = ["None", "Advice", "Personal Info", "Advice & Personal Info"] | |
BP_THRESHOLD = 0.6 | |
BP_LAB2STR = { | |
"is_advice": "Advice", | |
"is_personal_info": "Personal Info Sharing", | |
} | |
QUESTION2PHASE = { | |
"question_1": ["0_ActiveEngagement"], | |
"question_4": ["1_Explore"], | |
"question_5": ["1_Explore"], | |
# "question_7": ["1_Explore"], | |
# "question_9": ["4_SP&NS"], | |
"question_10": ["4_SP&NS"], | |
# "question_11": ["4_SP&NS"], | |
"question_14": ["6_WrappingUp"], | |
# "question_15": ["ALL"], | |
"question_19": ["ALL"], | |
# "question_21": ["ALL"], | |
# "question_22": ["ALL"], | |
"question_23": ["2_IRA", "3_SafetyAssessment"], | |
} | |
QUESTION2FILTERARGS = { | |
"question_1": { | |
"phases": QUESTION2PHASE["question_1"], | |
"pre_n": 2, | |
"post_n": 8, | |
"ignore": ["7_Other"], | |
}, | |
"question_4": { | |
"phases": QUESTION2PHASE["question_4"], | |
"pre_n": 5, | |
"post_n": 5, | |
"ignore": ["7_Other"], | |
}, | |
"question_5": { | |
"phases": QUESTION2PHASE["question_5"], | |
"pre_n": 5, | |
"post_n": 5, | |
"ignore": ["7_Other"], | |
}, | |
# "question_7": { | |
# "phases": QUESTION2PHASE["question_7"], | |
# "pre_n": 5, | |
# "post_n": 15, | |
# "ignore": ["7_Other"], | |
# }, | |
# "question_9": { | |
# "phases": QUESTION2PHASE["question_9"], | |
# "pre_n": 5, | |
# "post_n": 5, | |
# "ignore": ["7_Other"], | |
# }, | |
"question_10": { | |
"phases": QUESTION2PHASE["question_10"], | |
"pre_n": 5, | |
"post_n": 5, | |
"ignore": ["7_Other"], | |
}, | |
# "question_11": { | |
# "phases": QUESTION2PHASE["question_11"], | |
# "pre_n": 5, | |
# "post_n": 5, | |
# "ignore": ["7_Other"], | |
# }, | |
"question_14": { | |
"phases": QUESTION2PHASE["question_14"], | |
"pre_n": 10, | |
"post_n": 0, | |
"ignore": ["7_Other"], | |
}, | |
# "question_15": { | |
# "phases": QUESTION2PHASE["question_15"], | |
# "pre_n": 5, | |
# "post_n": 5, | |
# "ignore": ["7_Other"], | |
# }, | |
"question_19": { | |
"phases": QUESTION2PHASE["question_19"], | |
"pre_n": 5, | |
"post_n": 5, | |
"ignore": ["7_Other"], | |
}, | |
# "question_21": { | |
# "phases": QUESTION2PHASE["question_21"], | |
# "pre_n": 5, | |
# "post_n": 5, | |
# "ignore": ["7_Other"], | |
# }, | |
# "question_22": { | |
# "phases": QUESTION2PHASE["question_22"], | |
# "pre_n": 5, | |
# "post_n": 5, | |
# "ignore": ["7_Other"], | |
# }, | |
"question_23": { | |
"phases": QUESTION2PHASE["question_23"], | |
"pre_n": 5, | |
"post_n": 5, | |
"ignore": ["7_Other"], | |
}, | |
} | |
START_INST = "<|user|>" | |
END_INST = "<|end|>\n<|assistant|>" | |
NAME2QUESTION = { | |
"question_1": "Did the helper introduce themself in the opening message? Answer only Yes or No.", | |
"question_4": "Did the helper actively listened to the texter's crisis? Answer only Yes or No.", | |
"question_5": "Did the helper reflect on the main issue that led the texter reach out? Answer only Yes or No.", | |
# "question_7": "Did the helper collaborated with the texter to identify the goal of the conversation? Answer only Yes or No.", | |
# "question_9": "Did the helper collaborated with the texter to create next steps? Answer only Yes or No.", | |
"question_10": "Did the helper explored texter's existing coping skills? Answer only Yes or No.", | |
# "question_11": "Did the helper explored texter’s social support? Answer only Yes or No.", | |
"question_14": "Did helper reflected the texter’s plan, reiterate coping skills, and end in a supportive way? Answer only Yes or No.", | |
# "question_15": "Did the helper consistently used Good Contact Techniques? Answer only Yes or No.", | |
"question_19": "Did the helper consistently reflected empathy through the conversation? Answer only Yes or No.", | |
# "question_21": "Did the helper shared personal information? Answer only Yes or No.", | |
# "question_22": "Did the helper gave advice? Answer only Yes or No.", | |
"question_23": "Did the helper explicitely initiated imminent risk assessment? Answer only Yes or No.", | |
} | |
NAME2PROMPT = { | |
k: "--------Conversation:\n{convo}\n{start_inst}" + v + "\n{end_inst}" | |
for k, v in NAME2QUESTION.items() | |
} | |
NAME2PROMPT_EXPL = { | |
k: v.split("Answer only Yes or No.")[0] + "Answer Yes or No, and give an explanation in a new line.\n{end_inst}" | |
for k, v in NAME2PROMPT.items() | |
} | |
QUESTIONDEFAULTS = { | |
"question_1": {True: "No, There was no evidence of Active Engagement", False: "No"}, | |
"question_4": {True: "No, There was no evidence of Exploration Phase", False: "No"}, | |
"question_5": {True: "No, There was no evidence of Exploration Phase", False: "No"}, | |
# "question_7": {True: "N/A Texter disengaged, Not Applicable", False: "N/A"}, | |
# "question_9": {True: "N/A Texter disengaged, Not Applicable", False: "N/A"}, | |
"question_10": {True: "N/A Texter disengaged, Not Applicable", False: "N/A"}, | |
# "question_11": {True: "N/A Texter disengaged, Not Applicable", False: "N/A"}, | |
"question_14": {True: "N/A Texter disengaged, Not Applicable", False: "N/A"}, | |
# "question_15": "Did the helper consistently used Good Contact Techniques? Answer only Yes or No.", | |
"question_19": {True: "N/A Texter disengaged, Not Applicable", False: "N/A"}, | |
# "question_21": "Did the helper shared personal information? Answer only Yes or No.", | |
# "question_22": "Did the helper gave advice? Answer only Yes or No.", | |
"question_23": {True: "No, There was no evidence of Imminent Risk Assessment", False: "No"}, | |
} | |
TEXTER_PREFIX = "texter" | |
HELPER_PREFIX = "helper" | |
TA_OPTIONS = ["N/A", "No", "Yes"] |