Downloads · 30 days
94
2% of all-time downloads
Ateeqq/product-description-generator
product-description-generator is a text generation model from Ateeqq. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This repository contains a fine-tuned model for generating high-quality product descriptions. The model is based on the t5-base and has 223 million parameters. It has been fine-tuned on the Amazon Product Dataset, whi…
Downloads · 30 days
94
2% of all-time downloads
All-time downloads
4.1K
Public
Parameters
223M
3.6 GB on disk
Likes
14
Public
Click a slice to open those files.
.bin892 MB · 50%
From the Hugging Face model README
This repository contains a fine-tuned model for generating high-quality product descriptions. The model is based on the t5-base and has 223 million parameters. It has been fine-tuned on the Amazon Product Dataset, which contains 10 million examples, with the cleaned version having 0.5 million examples.
T5 model expects a task related prefix: since it is a description generation task, we will add a prefix "description: "
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained("Ateeqq/product-description-generator")
model = AutoModelForSeq2SeqLM.from_pretrained("Ateeqq/product-description-generator").to(device)
def generate_description(title):
input_ids = tokenizer(f'description: {title}', return_tensors="pt", padding="longest", truncation=True, max_length=128).input_ids.to(device)
outputs = model.generate(
input_ids,
num_beams=5,
num_beam_groups=5,
num_return_sequences=5,
repetition_penalty=10.0,
diversity_penalty=3.0,
no_repeat_ngram_size=2,
temperature=0.7,
max_length=128
)
return tokenizer.batch_decode(outputs, skip_special_tokens=True)
title = '18-Piece Kitchen Dinnerware white Set, Plates, Dishes, Bowls'
generate_description(title)
['18-Piece Kitchen Dinnerware White Set, Plates, Dishes and Bowls. This set includes a large bowl with two plates for serving dinner or dessert dishes in the kitchen. The white plate is made of durable stainless steel that will not fade over time.',
'The 18 Piece Kitchen Dinnerware Set features a white plate, dish and bowl. This set is made of durable stainless steel with an elegant design that will add elegance to your kitchen.',
'This 18-piece dinnerware set is made of durable stainless steel. It features a white finish and comes with an easy to clean handle for ease of cleaning. The bowls are dishwasher safe, microwave safe or can be used as tablecloths in the kitchen.',
'Kitchen Dinnerware is a great addition to your kitchen. This 18-piece set includes four plates, two dishes and three bowls for serving food or beverages in the dining room with an elegant design that will add sophistication to any tabletop setting.',
"18-Piece Kitchen Dinnerware White Set, Plates & DisheSize(LxW) Size (HXD), Material is made of high quality stainless steel and the bowl has an elegant design. The dish set includes 1 plate with 2 plates; 3 dishes for 4 cups or 6 serving spoon/bowl 2. This dinner table sets are perfect to serve your food in style while also being easy on clean up 3. These white kitchen dining tables have been designed by professional chefs using only premium materials that will not scratch surfaces 4. Easy cleaning dishwasher safe 5. Durable material can be used as disposable wash cloth 6. Perfect gift idea For family members who love cooking."]
trainvalidation