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 Discord Colab

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

Notebook

You can run our demo of Prompt2Model through a notebook:

Command Line

You can also run through the command line.

pip install prompt2model

Prompt2Model supports various platforms such as OpenAI, Anthropic, Huggingface, etc. using LiteLLM.

If you are using OpenAI models (such as the default gpt-3.5-turbo), please obtain an OpenAI API key on their website then 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>

List of all supported providers

You can then run

python prompt2model_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

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.8.tar.gz (58.9 kB view details)

Uploaded Source

Built Distribution

prompt2model-0.0.8-py3-none-any.whl (83.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for prompt2model-0.0.8.tar.gz
Algorithm Hash digest
SHA256 4e9c69748b58a4bdf4ff0a1d3252cd11d4b54643f71f78051673773de81e2783
MD5 a45c7dd6eb7aac4df9baac90d83d949b
BLAKE2b-256 a1dabc931684d21e510d9d4e25f666779aec9c259e0ddfa7450290834acbc84e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for prompt2model-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 be84683c8b3b7bfa8f40eb9f0a964e3d6693d01c436f9e1256595e57debc20a6
MD5 048007f14828773027a8795d4d244f69
BLAKE2b-256 296bb9734adfc0b7b97e007c6001787ec9219fb86f98a451e3050c1be612fc35

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