diff --git a/assets/ar/factuality_disinformation_harmful_content/hate_speech/OSACT4SubtaskB_BLOOMZ_ZeroShot.py b/assets/ar/factuality_disinformation_harmful_content/hate_speech/OSACT4SubtaskB_BLOOMZ_ZeroShot.py new file mode 100644 index 00000000..48adbe95 --- /dev/null +++ b/assets/ar/factuality_disinformation_harmful_content/hate_speech/OSACT4SubtaskB_BLOOMZ_ZeroShot.py @@ -0,0 +1,39 @@ +import os + +from llmebench.datasets import OSACT4SubtaskBDataset +from llmebench.models import PetalsModel +from llmebench.tasks import HateSpeechTask + + +def config(): + return { + "dataset": OSACT4SubtaskBDataset, + "dataset_args": {}, + "task": HateSpeechTask, + "task_args": {}, + "model": PetalsModel, + "model_args": { + "class_labels": ["HS", "NOT_HS"], + "max_tries": 3, + }, + "general_args": { + "data_path": "data/factuality_disinformation_harmful_content/hate_speech/OSACT2020-sharedTask-test-tweets-labels.txt" + }, + } + + +def prompt(input_sample): + return { + "prompt": 'Given the following Arabic tweet, label it as "HS" or "NOT_HS" based on the content of the tweet. Provide only label.\n\n' + + "sentence: " + + input_sample + + "label: \n" + } + + +def post_process(response): + label = response["outputs"].strip() + label = label.replace("", "") + label = label.replace("", "") + + return label