Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ArSarcasm_BLOOMZ_Zeroshot.py #186

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from llmebench.datasets import ArSarcasmDataset

from llmebench.models import PetalsModel

from llmebench.tasks import SarcasmTask


Expand All @@ -28,9 +26,10 @@ def config():

def prompt(input_sample):
prompt_string = (
f"Predict whether the tweet is sarcastic or not. If it is sarcastic, respond with 'TRUE'. If it is not sarcastic, respond with 'FALSE'.\n\n"
f"text: {input_sample}\n"
f"label: "
'Predict whether the following "tweet" is sarcastic. Return "yes" if the tweet is sarcastic and "no" if the tweet is not sarcastic. Provide only label.\n\ntweet: '
+ input_sample
+ "\n"
"label: \n"
)
return {
"prompt": prompt_string,
Expand All @@ -41,9 +40,9 @@ def post_process(response):
label = response["outputs"].strip().lower()
label = label.replace("<s>", "").replace("</s>", "")

if label == "true":
if label == "yes":
return "TRUE"
elif label == "false":
elif label == "no":
return "FALSE"
else:
return None
Loading