Downloads · 30 days
24
4% of all-time downloads
RSPRIMES1234/Amazon-Review-Generator-T5
Amazon-Review-Generator-T5 is a text generation model from RSPRIMES1234. 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.
[](https://github.com/RSPRIMES1234/Amazon-Review-Generator-T5) [](https://www.linkedin.com/in/amritesh-chandra-38779117b/) [](https://x.com/AmriteshCh67267)
Downloads · 30 days
24
4% of all-time downloads
All-time downloads
581
Public
Parameters
223M
892 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors892 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of the T5 model designed to generate Amazon product reviews based on the product title and star rating. The fine-tuning process was conducted on a dataset of software product reviews from the "McAuley-Lab/Amazon-Reviews-2023" dataset.
The primary use case of this model is to generate realistic and coherent product reviews for Amazon products. It can be particularly useful for generating sample reviews for product listings, sentiment analysis, and natural language generation tasks in e-commerce.
The model is based on the T5 (Text-to-Text Transfer Transformer) architecture, which is a versatile transformer model for a variety of text generation tasks.
The model was fine-tuned on a dataset of Amazon software product reviews. The data was preprocessed to include only verified purchases with review texts longer than 100 characters. A total of 100,000 samples were used for fine-tuning.
The training was performed using the Hugging Face transformers library with the following settings:
t5-baseDue to the scope of this project, comprehensive evaluation metrics are not provided. However, sample outputs demonstrate the model’s ability to generate coherent and contextually relevant reviews.
Here’s how you can use the model to generate reviews:
import torch
from transformers import T5Tokenizer, T5ForConditionalGeneration
# Load the model and tokenizer
model_name = "RSPRIMES1234/Amazon-Review-Generator-T5"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)
# Set up GPU usage (optional)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = model.to(device)
# Define the function to generate reviews
def generate_review(product_title, star_rating):
input_text = f"review: {product_title}, {star_rating} Stars!"
inputs = tokenizer(input_text, return_tensors='pt', max_length=128, padding='max_length', truncation=True)
inputs = {k: v.to(device) for k, v in inputs.items()}
outputs = model.generate(inputs['input_ids'], max_length=128, no_repeat_ngram_size=3, num_beams=6, early_stopping=True)
review = tokenizer.decode(outputs[0], skip_special_tokens=True)
return review
# Example usage
product_title = "Example Product"
star_rating = 5
print(generate_review(product_title, star_rating))
If you use this model in your research or applications, please cite the original T5 paper and provide a link to this model on Hugging Face.