Skip to content

Commit

Permalink
Fix Haiku example
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-lew committed Feb 20, 2024
1 parent d157797 commit b75bf06
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/haiku.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def count_syllables(word, unknown_word_syllables=100):
LLM.batch_size = 40

# Example poems for the prompt.
# Authors:
# - Amy Lowell
# - Sonia Sanchez
# - Katsushika Hokusai
# - Matsuo Basho
# Note that not all of these follow the syllabic constraints of a Haiku; the goal is
# to encode a certain 'poetic style' but to leave the syllabic constraints to be enforced
# by the probabilistic program (enabling generalization to other syllabic constraints).
Expand All @@ -46,26 +51,21 @@ def count_syllables(word, unknown_word_syllables=100):
speech and breath. loving you is
a long river running.
3. "Keys"
I search for my keys
in a million places, but
they are in my hand.
3. "Practice"
I write, erase, rewrite
Erase again, and then
A poppy blooms.
4. "Caterpillar"
A caterpillar,
this deep in fall
this deep in fall,
still not a butterfly."""

# Ask user for poem title (without newline)
poem_title = input("Enter a title for your Haiku: ")
poem_prompt = f"""{example_poems}
5. {poem_title}
5. "{poem_title}"
"""

# Cache prompt for faster generation
Expand Down

0 comments on commit b75bf06

Please sign in to comment.