Edit model card

You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Product Description Generator

Overview

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.

Usage

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

tokenizer = AutoTokenizer.from_pretrained("Ateeqq/product-description-generator", token="your_token")
model = AutoModelForSeq2SeqLM.from_pretrained("Ateeqq/product-description-generator", token="your_token")

input_text = "18-Piece Kitchen Dinnerware white Set, Plates, Dishes, Bowls"

inputs = tokenizer.encode("description: " + input_text, return_tensors="pt", max_length=128, truncation=True)

outputs = model.generate(inputs, max_length=400, num_beams=2, num_beam_groups=2, num_return_sequences=2, repetition_penalty=1.0, diversity_penalty=3.0, no_repeat_ngram_size=2, temperature=0.9, early_stopping=True)

description = tokenizer.decode(outputs[1], skip_special_tokens=True)

print(description)

Getting Multiple Outputs

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

device = "cuda"
tokenizer = AutoTokenizer.from_pretrained("Ateeqq/product-description-generator", token='your_token')
model = AutoModelForSeq2SeqLM.from_pretrained("Ateeqq/product-description-generator", token='your_token').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)

Outputs:

['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.',
 "p>This 18-piece dinnerware set is made of high quality stainless steel. The white plate and dish are dishwasher safe, easy to clean with the included lids for ease of use. This dining table set features an elegant design that will add elegance style in your kitchen or living room. It's also perfect for serving food on any occasion like birthday parties, house warming ceremonies, Thanksgiving celebrations etc."]

Features

  • Architecture: t5-base (223M parameters)
  • Training Dataset: Trained on 0.5 million cleaned examples
  • Training Time:
    • Hardware: Colab T4 GPU
    • Speed: 4.91 iterations/second
    • Training Time: 5:53:49
    • Metrics:
      • Loss: 2.53
      • Training Loss Step: 0.095
      • Validation Loss Step: 1.670
      • Validation Loss Epoch: 2.290
      • Training Loss Epoch: 1.410

Data Preparation

  • Training Data: First 250,000 examples for train
  • Validation Data: First 40,000 examples for validation
  • Source Max Token Length: 50
  • Target Max Token Length: 300
  • Batch Size: 1
  • Max Epochs: 1

Future Work

  • Update Training Data: Retrain the model using the latest 0.5 million cleaned examples.
  • Optimize Training Parameters: Experiment with different batch sizes, learning rates, and epochs to further improve model performance.
  • Expand Dataset: Incorporate more diverse product datasets to enhance the model's versatility and robustness.

License

Limited Use: It grants a non-exclusive, non-transferable license to use the this model. This means you can't freely share it with others or sell the model itself.

Downloads last month
122

Dataset used to train Ateeqq/product-description-generator