Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding configurable premise #47

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

michaellavelle
Copy link
Contributor

@michaellavelle michaellavelle commented Jul 27, 2020

I noticed that many prompts/scrolls include a statement of intent at the start of the prompt ( a "premise" )

for example.

https://github.com/maraoz/gpt-scrolls/blob/master/tweets/twitter-fiction.txt

the premise would be

"Twitter fiction: 21 authors try their hand at 140-character novels
We challenged...at Twitter fiction."

This PR adds a premise to GPT which can be set on GPT in a similar way to the examples, and a configurable premise_prefix and premise_suffix to control how this premise appears and the gap between it and the examples etc. If the premise is not set or empty string this prefix and suffix should not be used. Otherwise, if premise is set, this setup allows the prefix-premise-suffix to be prepended to the examples.

Also included is a sample app for this, which uses the Twitter fiction example above. I've also demonstrated with this app how the config parameters and examples could be loaded from a template json file ( for formatting ) and a prompt json file ( for the content ).

Files are currently residing here:

https://github.com/ml4j/gpt-scrolls/tree/master/tweets
https://github.com/ml4j/gtp-3-prompt-templates/tree/master/question-answer/default/templates

These are currently set to remote urls simply for demonstration purposes - it would be great if GPT-3 applications had the ability to pull in json files of a standard format from different projects. It would allow the separation of content and formatting - allowing a prompt to be used with different formats or vice versa).

If you like this idea of premises, I can amend this PR to remove the remote urls and commit the json files into the project as part of this PR - if so would you be able to recommend where they could reside ?

…PT. Adding example file to demonstrate using twitter fiction prompt from gpt-scrolls
…ters to gpt.

Adding run_twitter_fiction_app.py
from api import GPT, Example, UIConfig
from api import demo_web_app

PROMPT_EXAMPLE_URL = "https://raw.githubusercontent.com/ml4j/gpt-scrolls/master/tweets/twitter-fiction-prompt.json"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per comment below, these external URLs are really for demonstration purposes for this PR review - I'd suggest committing the raw json files as part of this PR should you wish to merge this into the codebase)

@shreyashankar
Copy link
Owner

Hi! Thanks for making the PR. I have a somewhat busy week at work, so I'll try to take a look later this week or sometime this weekend definitely :)

@michaellavelle
Copy link
Contributor Author

Hi Shreya - no worries - whenever you get chance - no rush :-)

Hope you week goes well at work,

Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants