Spaces:
Running
Running
shainaraza
commited on
Commit
•
8beec99
1
Parent(s):
3e5bb17
Update app.py
Browse files
app.py
CHANGED
@@ -30,6 +30,10 @@ class BiasPipeline:
|
|
30 |
ner_results = self.ner(texts)
|
31 |
return classification_results, ner_results
|
32 |
|
|
|
|
|
|
|
|
|
33 |
# Model setup for debiasing
|
34 |
debias_model = "newsmediabias/UnBIAS-LLama2-Debiaser-Chat-QLoRA"
|
35 |
debias_tokenizer = AutoTokenizer.from_pretrained(debias_model)
|
@@ -40,10 +44,6 @@ debias_pipeline = transformers.pipeline(
|
|
40 |
device_map="auto",
|
41 |
)
|
42 |
|
43 |
-
# Instruction for debiasing
|
44 |
-
instruction = ("Instruction: As a helpful, respectful and trustworthy debiasing assistant, your "
|
45 |
-
"task is to receive a text and return its unbiased version, without adding any unrelated content "
|
46 |
-
"or additional outputs.")
|
47 |
|
48 |
|
49 |
def get_debiased_sequence(prompt):
|
|
|
30 |
ner_results = self.ner(texts)
|
31 |
return classification_results, ner_results
|
32 |
|
33 |
+
|
34 |
+
# Constants and Global Variables
|
35 |
+
sys_message = "Task: Please just generate a bias-free version of the text provided, ensuring it's free from biases related to age, gender, politics, social nuances, or economic background, while keeping it roughly the same length as the original:"
|
36 |
+
instruction = "Instruction: As a helpful, respectful and trustworthy debiasing assistant, your task is to receive a text and return its unbiased version, Don't add additional comment. Just return the un biased version of the input text:"
|
37 |
# Model setup for debiasing
|
38 |
debias_model = "newsmediabias/UnBIAS-LLama2-Debiaser-Chat-QLoRA"
|
39 |
debias_tokenizer = AutoTokenizer.from_pretrained(debias_model)
|
|
|
44 |
device_map="auto",
|
45 |
)
|
46 |
|
|
|
|
|
|
|
|
|
47 |
|
48 |
|
49 |
def get_debiased_sequence(prompt):
|