Skip to content

Commit

Permalink
Add BLOOMZ asset for OSACT4SubtaskB (#218)
Browse files Browse the repository at this point in the history
Co-authored-by: Fahim Imaduddin Dalvi <[email protected]>
  • Loading branch information
firojalam and fdalvi authored Sep 14, 2023
1 parent 42025ac commit 83ef2bd
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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("<s>", "")
label = label.replace("</s>", "")

return label

0 comments on commit 83ef2bd

Please sign in to comment.