Update README.md
Browse files
README.md
CHANGED
|
@@ -38,7 +38,8 @@ Model Sample Output (excerpt)
|
|
| 38 |
Markov (n=3) “I loved you so sincerely, so sincerely, so silented you so tenderly, without hope…”
|
| 39 |
Markov (n=5) “I loved you so tenderly, without let it not want to cause you soul; But hope, Tormented you…”
|
| 40 |
GPT-2 (medium) “I love you with all my heart, without reserve. I am in love with you now, and have never been. I am in love with you now, and will never be…”
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
Markov chains: good for local coherence, but collapse quickly.
|
| 44 |
|
|
@@ -54,14 +55,16 @@ Markov chains
|
|
| 54 |
|
| 55 |
mc = NGramMarkov(n=5)
|
| 56 |
mc.train(corpus)
|
| 57 |
-
print(mc.generate("
|
| 58 |
|
| 59 |
|
| 60 |
## GPT-2 (via 🤗 Transformers)
|
| 61 |
|
| 62 |
from transformers import pipeline
|
|
|
|
| 63 |
generator = pipeline("text-generation", model="gpt2-medium")
|
| 64 |
-
|
|
|
|
| 65 |
|
| 66 |
✨ Author
|
| 67 |
|
|
|
|
| 38 |
Markov (n=3) “I loved you so sincerely, so sincerely, so silented you so tenderly, without hope…”
|
| 39 |
Markov (n=5) “I loved you so tenderly, without let it not want to cause you soul; But hope, Tormented you…”
|
| 40 |
GPT-2 (medium) “I love you with all my heart, without reserve. I am in love with you now, and have never been. I am in love with you now, and will never be…”
|
| 41 |
+
|
| 42 |
+
## Key Observations
|
| 43 |
|
| 44 |
Markov chains: good for local coherence, but collapse quickly.
|
| 45 |
|
|
|
|
| 55 |
|
| 56 |
mc = NGramMarkov(n=5)
|
| 57 |
mc.train(corpus)
|
| 58 |
+
print(mc.generate("<Pushkin Poetry Corpus of Choice>", 200))
|
| 59 |
|
| 60 |
|
| 61 |
## GPT-2 (via 🤗 Transformers)
|
| 62 |
|
| 63 |
from transformers import pipeline
|
| 64 |
+
|
| 65 |
generator = pipeline("text-generation", model="gpt2-medium")
|
| 66 |
+
|
| 67 |
+
print(generator("<Pushkin Poetry Corpus of Choice>", max_length=80, do_sample=True))
|
| 68 |
|
| 69 |
✨ Author
|
| 70 |
|