YAML Metadata
Warning:
The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
Politeness Generative Model
Overview
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.
Prompt
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.
Quick tutorial
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)
Load the Politeness Model
model = PeftModel.from_pretrained(model, peft_model_id)
Prompting
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."
library_name: peft
Training procedure
The following bitsandbytes quantization config was used during training:
- load_in_8bit: True
- load_in_4bit: False
- llm_int8_threshold: 6.0
- llm_int8_skip_modules: None
- llm_int8_enable_fp32_cpu_offload: False
- llm_int8_has_fp16_weight: False
- bnb_4bit_quant_type: fp4
- bnb_4bit_use_double_quant: False
- bnb_4bit_compute_dtype: float32
Framework versions
- PEFT 0.4.0.dev0
- Downloads last month
- 6