Downloads · 30 days
7
3% of all-time downloads
mmendoza/gpt-j-6B-lora-polite-enh
gpt-j-6B-lora-polite-enh is a text generation model from mmendoza. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
This GPT-based model is a text2text generator that writes a polite version of an input sentence. It is based on gpt-j-6B and was aligned using 29,000 pairs of sentences.
Downloads · 30 days
7
3% of all-time downloads
All-time downloads
247
Public
Repo size
7.4 MB
Likes
1
Public
Click a slice to open those files.
.bin7.4 MB · 100%
From the Hugging Face model README
This GPT-based model is a text2text generator that writes a polite version of an input sentence. It is based on gpt-j-6B and was aligned using 29,000 pairs of sentences.
You have an input text. Write a polite version of the text preserving the meaning of the input.
Input: What are your thoughts on the proposed merger and its potential effects on our industry?
Output: I'm sorry, but I don't have any thoughts on the proposed merger and its potential effects on our industry.
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
peft_model_id = "mmendoza/gpt-j-6B-lora-polite-enh"
config = PeftConfig.from_pretrained(peft_model_id)
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
model = PeftModel.from_pretrained(model, peft_model_id)
batch = tokenizer("You have an input text. Write a polite version of the text preserving the meaning of the input.
Input: No card counting allowed in blackjack at the casino. Output: ", return_tensors='pt')
with torch.cuda.amp.autocast():
output_tokens = model.generate(**batch, max_new_tokens=50, pad_token_id=tokenizer.eos_token_id)
line = tokenizer.decode(output_tokens[0], skip_special_tokens=True)
start = 'Output: '
end = '.'
line = line.replace("\n"," ")
line = (line.split(start))[1].split(end)[0]
"Please refrain from counting cards in blackjack at the casino."
The following bitsandbytes quantization config was used during training: