ehdwns1516
commited on
Commit
•
99b2fc6
1
Parent(s):
08bc65c
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# gpt2_review_star3
|
2 |
+
|
3 |
+
* This model has been trained as a review_body dataset with a star of 3 in the [amazon_review dataset](https://huggingface.co/datasets/amazon_reviews_multi).
|
4 |
+
* Input text what you want to generate review.
|
5 |
+
* If the context is longer than 1200 characters, the context may be cut in the middle and the result may not come out well.
|
6 |
+
|
7 |
+
review generator DEMO: [Ainize DEMO](https://main-review-generator-ehdwns1516.endpoint.ainize.ai/)
|
8 |
+
|
9 |
+
review generator API: [Ainize API](https://ainize.web.app/redirect?git_repo=https://github.com/ehdwns1516/review_generator)
|
10 |
+
|
11 |
+
## Model links for each 1 to 5 star
|
12 |
+
* [ehdwns1516/gpt2_review_star1](https://huggingface.co/ehdwns1516/gpt2_review_star1)
|
13 |
+
* [ehdwns1516/gpt2_review_star2](https://huggingface.co/ehdwns1516/gpt2_review_star2)
|
14 |
+
* [ehdwns1516/gpt2_review_star3](https://huggingface.co/ehdwns1516/gpt2_review_star3)
|
15 |
+
* [ehdwns1516/gpt2_review_star4](https://huggingface.co/ehdwns1516/gpt2_review_star4)
|
16 |
+
* [ehdwns1516/gpt2_review_star5](https://huggingface.co/ehdwns1516/gpt2_review_star5)
|
17 |
+
|
18 |
+
## Overview
|
19 |
+
|
20 |
+
Language model: [gpt2](https://huggingface.co/klue/roberta-base)
|
21 |
+
|
22 |
+
Language: English
|
23 |
+
|
24 |
+
Training data: review_body dataset with a star of 3 in the [amazon_review dataset](https://huggingface.co/datasets/amazon_reviews_multi).
|
25 |
+
|
26 |
+
Code: See [Ainize Workspace](https://ainize.ai/workspace/create?imageId=hnj95592adzr02xPTqss&git=https://github.com/ehdwns1516/gpt2_review_fine-tunning_note)
|
27 |
+
|
28 |
+
## Usage
|
29 |
+
## In Transformers
|
30 |
+
|
31 |
+
```
|
32 |
+
from transformers import AutoTokenizer, AutoModelWithLMHead
|
33 |
+
|
34 |
+
tokenizer = AutoTokenizer.from_pretrained("ehdwns1516/gpt2_review_star3")
|
35 |
+
|
36 |
+
model = AutoModelWithLMHead.from_pretrained("ehdwns1516/gpt2_review_star3")
|
37 |
+
|
38 |
+
generator = pipeline(
|
39 |
+
"text-generation",
|
40 |
+
model="ehdwns1516/gpt2_review_star3",
|
41 |
+
tokenizer=tokenizer
|
42 |
+
)
|
43 |
+
|
44 |
+
context = "your context"
|
45 |
+
|
46 |
+
result = dict()
|
47 |
+
result[0] = generator(context)[0]
|
48 |
+
```
|