add python code as example
Browse files
README.md
CHANGED
@@ -50,6 +50,34 @@ parameters:
|
|
50 |
|
51 |
# gpt2-medium-emailgen
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
This model is a fine-tuned version of [gpt2-medium](https://huggingface.co/gpt2-medium) on the postbot/multi-emails-100k dataset.
|
54 |
It achieves the following results on the evaluation set:
|
55 |
- Loss: 1.5840
|
|
|
50 |
|
51 |
# gpt2-medium-emailgen
|
52 |
|
53 |
+
|
54 |
+
Why write the entire email when you can generate (most of) it?
|
55 |
+
|
56 |
+
```python
|
57 |
+
from transformers import pipeline
|
58 |
+
|
59 |
+
model_tag = "postbot/gpt2-medium-emailgen"
|
60 |
+
generator = pipeline(
|
61 |
+
'text-generation',
|
62 |
+
model=model_tag,
|
63 |
+
)
|
64 |
+
|
65 |
+
prompt = """
|
66 |
+
Hello,
|
67 |
+
|
68 |
+
Following up on the bubblegum shipment."""
|
69 |
+
|
70 |
+
result = generator(
|
71 |
+
prompt,
|
72 |
+
max_length=64,
|
73 |
+
do_sample=False,
|
74 |
+
early_stopping=True,
|
75 |
+
) # generate
|
76 |
+
print(result[0]['generated_text'])
|
77 |
+
```
|
78 |
+
|
79 |
+
## about
|
80 |
+
|
81 |
This model is a fine-tuned version of [gpt2-medium](https://huggingface.co/gpt2-medium) on the postbot/multi-emails-100k dataset.
|
82 |
It achieves the following results on the evaluation set:
|
83 |
- Loss: 1.5840
|