Downloads · 30 days
5
2% of all-time downloads
borislitvak/boris-bloomz-peft-marketing
boris-bloomz-peft-marketing is a machine learning model from borislitvak. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
The model generates funky marketing emails, see example below. Implementation: A QLORA fine tuning over a bigscience/bloomz-3b, utilizing the FourthBrainGenAI/MarketMail-AI dataset with 17 rows.
Downloads · 30 days
5
2% of all-time downloads
All-time downloads
202
Public
Repo size
4.9 MB
Likes
0
Public
Click a slice to open those files.
.bin4.9 MB · 100%
From the Hugging Face model README
The model generates funky marketing emails, see example below. Implementation: A QLORA fine tuning over a bigscience/bloomz-3b, utilizing the FourthBrainGenAI/MarketMail-AI dataset with 17 rows.
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
peft_model_id = "borislitvak/boris-bloomz-peft-marketing"
config = PeftConfig.from_pretrained(peft_model_id)
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=False, device_map='auto')
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
# Load the Lora model
model = PeftModel.from_pretrained(model, peft_model_id)
from IPython.display import display, Markdown
def make_inference(product, description):
batch = tokenizer(f"### INSTRUCTION\nBelow is a product and description, please write a marketing email for this product.\n\n### Product:\n{product}\n### Description:\n{description}\n\n### Marketing Email:\n", return_tensors='pt')
with torch.cuda.amp.autocast():
output_tokens = model.generate(**batch, max_new_tokens=200)
# for Jupyter. If serving in regular Python, remove display/Markdown
display(Markdown((tokenizer.decode(output_tokens[0], skip_special_tokens=True))))
your_product_name_here = ""
your_product_description_here = ""
make_inference(your_product_name_here, your_product_description_here)