YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co./docs/hub/model-cards#model-card-metadata)
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"""
- Downloads last month
- 12
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.