Skip to main content

A library for distilling models from prompts.

Project description

prompt2model - Generate Deployable Models from Instructions

PyPI version Github Actions CI tests MIT license

Prompt2Model is a system that takes a natural language task description (like the prompts used for LLMs such as ChatGPT) to train a small special-purpose model that is conducive for deployment.

prompt2model_teaser

Quick Start

pip install prompt2model

Our current prompt2model implementation uses the OpenAI API. Accordingly, you need to:

  • Sign up on the OpenAI website and obtain an OpenAI API key.

  • Set the environment variable OPENAI_API_KEY to your API key by running the following command in your terminal:

export OPENAI_API_KEY=<your key>

You can then run

python cli_demo.py

to create a small model from a prompt, as shown in the demo video below. This script must be run on a device with an internet connection to access the OpenAI API. For best results, run this script on a device with a GPU for training your model.

Demo

https://github.com/neulab/prompt2model/assets/2577384/8d73394b-3028-4a0b-bdc3-c127082868f2

Tips and Examples to Write a Good Prompt

You can see the tips and examples to write a good prompt in prompt_examples.

Components

The prompt2model package is composed of several components, each designed to fulfill a specific purpose. To gain a comprehensive understanding of how to utilize each component effectively, please consult the readme.md file situated in the directory of the respective component. These files can be found at ./prompt2model/<component>/readme.md. They provide detailed information and instructions on customizing and maximizing the functionality of each component within the package.

Contribution

If you're interested in contributing to the prompt2model project, please refer to CONTRIBUTING.md, or reach out to @vijaytarian and @Chenan3_Zhao.

Cite

We have written a paper describing Prompt2Model in detail.

If you use Prompt2Model in your research, please cite our paper:

@misc{prompt2model,
      title={Prompt2Model: Generating Deployable Models from Natural Language Instructions},
      author={Vijay Viswanathan and Chenyang Zhao and Amanda Bertsch and Tongshuang Wu and Graham Neubig},
      year={2023},
      eprint={2308.12261},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prompt2model-0.0.2.tar.gz (64.7 kB view details)

Uploaded Source

Built Distribution

prompt2model-0.0.2-py3-none-any.whl (88.1 kB view details)

Uploaded Python 3

File details

Details for the file prompt2model-0.0.2.tar.gz.

File metadata

  • Download URL: prompt2model-0.0.2.tar.gz
  • Upload date:
  • Size: 64.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for prompt2model-0.0.2.tar.gz
Algorithm Hash digest
SHA256 449b5ef8ad819661cf2f67f488417e48fa39cebb519bc68ea38dbddd6da45f98
MD5 ee71839eac58559f13a68b1c358dc93d
BLAKE2b-256 908550ae20acb196c8f06ff45f0d7c63129e30fbb17159f2c453a3aac43d8cf4

See more details on using hashes here.

File details

Details for the file prompt2model-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: prompt2model-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 88.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for prompt2model-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 97fddddc32901115aa22d4d0c1f95cf60235c2f8ce00d041be36294f4fa185a7
MD5 491e14a1cde9ce28f85389460ac356f7
BLAKE2b-256 71b54af37facc7fa7cfd7cedb21d633a6bc5e542d7f4f3bd15e6641bc2d95ce8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page