Downloads · 30 days
11
2% of all-time downloads
newsmediabias/UnBIAS-LLama2-Debiaser-Chat
UnBIAS-LLama2-Debiaser-Chat is a text generation model from newsmediabias. Use it when you need the model to write or continue text. It is set up for transformers.
import pandas as pd import time from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoModelForTokenClassification, AutoModelForCausalLM, pipeline, BitsAndBytesConfig, LogitsProcessor, LogitsP…
Downloads · 30 days
11
2% of all-time downloads
All-time downloads
544
Public
Repo size
27 GB
Likes
0
Public
Click a slice to open those files.
.bin13.5 GB · 100%
From the Hugging Face model README
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"""