Spaces:
Sleeping
Sleeping
File size: 6,282 Bytes
f3e0ba5 18d7e6c d2c9c50 f3e0ba5 adae8ef f3e0ba5 adae8ef f3e0ba5 |
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
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"] |