RSPRIMES1234 commited on
Commit
950ac14
·
verified ·
1 Parent(s): 96d2ba3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -3
README.md CHANGED
@@ -1,3 +1,65 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+ Model Description
5
+ Model Name: Amazon Review Generator T5
6
+ Model ID: RSPRIMES1234/Amazon-Review-Generator-T5
7
+
8
+ 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.
9
+
10
+ Use Case
11
+ 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.
12
+
13
+ Model Architecture
14
+ 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.
15
+
16
+ Training Data
17
+ 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.
18
+
19
+ Training Procedure
20
+ The training was performed using the Hugging Face transformers library with the following settings:
21
+
22
+ Model: t5-base
23
+ Number of Epochs: 3
24
+ Batch Size: 16 for training, 32 for evaluation
25
+ Optimizer: AdamW
26
+ Learning Rate: Default settings
27
+ Hardware: Training was conducted on GPU (NVIDIA RTX 3060)
28
+ Model Performance
29
+ Due 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.
30
+
31
+ Example Usage
32
+ Here’s how you can use the model to generate reviews:
33
+
34
+ python
35
+ Copy code
36
+ import torch
37
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
38
+
39
+ # Load the model and tokenizer
40
+ model_name = "RSPRIMES1234/Amazon-Review-Generator-T5"
41
+ tokenizer = T5Tokenizer.from_pretrained(model_name)
42
+ model = T5ForConditionalGeneration.from_pretrained(model_name)
43
+
44
+ # Set up GPU usage (optional)
45
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
46
+ model = model.to(device)
47
+
48
+ # Define the function to generate reviews
49
+ def generate_review(product_title, star_rating):
50
+ input_text = f"review: {product_title}, {star_rating} Stars!"
51
+ inputs = tokenizer(input_text, return_tensors='pt', max_length=128, padding='max_length', truncation=True)
52
+ inputs = {k: v.to(device) for k, v in inputs.items()}
53
+ outputs = model.generate(inputs['input_ids'], max_length=128, no_repeat_ngram_size=3, num_beams=6, early_stopping=True)
54
+ review = tokenizer.decode(outputs[0], skip_special_tokens=True)
55
+ return review
56
+
57
+ # Example usage
58
+ product_title = "Example Product"
59
+ star_rating = 5
60
+ print(generate_review(product_title, star_rating))
61
+ Limitations and Considerations
62
+ Data Bias: The model was trained on reviews for software products, which may bias its performance when generating reviews for other types of products.
63
+ Ethical Use: Generated reviews should be used responsibly and ethically. Misuse of generated content can lead to misinformation and ethical concerns.
64
+ Citation
65
+ 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.