craffel / promptsource

Toolkit for collecting and applying templates of prompting instances

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PromptSource

Toolkit for collecting and applying templates of prompting instances.

WIP

Setup

  1. Download the repo
  2. Navigate to root directory of the repo
  3. Install requirements with pip install -r requirements.txt

Running

From the root directory of the repo, you can launch the editor with

streamlit run promptsource/promptsource.py

There are 3 modes in the app:

  • Helicopter view: aggregate high level metrics on the current state of the sourcing
  • Prompted dataset viewer: check the templates you wrote or already written on entire dataset
  • Sourcing: write new prompts

Contributing

Join the Hackaprompt and help writing templates!

Contribution guidelines and step-by-step HOW TO are described here.

Writing Templates

A prompt template is expressed in Jinja.

It is rendered using an example from the corresponding Hugging Face datasets library (a dictionary). The separator ||| should appear once to divide the template into prompt and output. Generally, the prompt should provide information on the desired behavior, e.g., text passage and instructions, and the output should be a desired response.

Here's an example for AG News:

{{text}}
Is this a piece of news regarding {{"world politics"}}, {{"sports"}}, {{"business"}}, or {{"science and technology"}}? |||
{{ ["World politics", "Sports", "Business", "Science and technology"][label] }}

For more information, read the Contribution guidelines.

Other documentation

Known Issues

Warning or Error about Darwin on OS X: Try downgrading PyArrow to 3.0.0.

About

Toolkit for collecting and applying templates of prompting instances

License:Apache License 2.0


Languages

Language:Python 99.5%Language:Makefile 0.5%