CoolFace
Modelpublic

newsmediabias/UnBIAS-LLama2-Debiaser-Chat

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes14downloads
Model Card
import pandas as pd
import time
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoModelForTokenClassification, AutoModelForCausalLM, pipeline, BitsAndBytesConfig, LogitsProcessor, LogitsProcessorList
import torch

debiaser_tokenizer = AutoTokenizer.from_pretrained("newsmediabias/UnBIAS-LLama2-Debiaser-Chat")
debiaser_model = AutoModelForCausalLM.from_pretrained("newsmediabias/UnBIAS-LLama2-Debiaser-Chat")

# <s>[INST] <<SYS>> System prompt <</SYS>> User prompt [/INST] Model answer </s>

instruction = "Debias this text:"
system_message = "You are a text debiasing bot, you take as input a text and you output its debiased version by rephrasing it to be free from any age, gender, political, social or socio-economic biases, without any extra outputs"

pipe = pipeline(task="text-generation", model=debiaser_model, tokenizer=debiaser_tokenizer,max_length=500)
debiased_text = pipe(f"<s>[INST] <<SYS>>{system_message}<</SYS>> {instruction} {text} [/INST]")


instruction = "Debias this text:"
system_message = "You are a text debiasing bot, you take as input a text and you output its debiased version by rephrasing it to be free from any age, gender, political, social or socio-economic biases, without any extra outputs"
text=" I hate the fact that asians are taking over all jobs "
pipe = pipeline(task="text-generation", model=debiaser_model, tokenizer=debiaser_tokenizer,max_length=500)
debiased_text = pipe(f"<s>[INST] <<SYS>>{system_message}<</SYS>> {instruction} {text} [/INST]")

debiased_text"""