Skip to main content

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 us!

If you discuss or use the overall prompt2model framework, please reference

@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}
}

If you discuss or use our dataset retrieval and transformation tools, please reference

@misc{prompt2modeldatatune,
      title={Better Synthetic Data by Retrieving and Transforming Existing Datasets}, 
      author={Saumya Gandhi and Ritu Gala and Vijay Viswanathan and Tongshuang Wu and Graham Neubig},
      year={2024},
      eprint={2404.14361},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Metadata

Release files for prompt2model 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prompt2model 0.1.0
File Size Uploaded
prompt2model-0.1.0.tar.gz 82.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prompt2model 0.1.0
File Interpreter ABI Platform
prompt2model-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 194.3 kB

Release files / prompt2model-0.1.0.tar.gz

Download URL prompt2model-0.1.0.tar.gz
Size 82.8 kB
Tags Source
SHA-256 checksum
How to use checksums
04aa17a476ded3d897c46efc1ccb85670f24ffc76c11296e2ca4d8894690175c
BLAKE2b-256 checksum
How to use checksums
7f994703344a06fe5a82a6c82cec5768ecdefe45056100d1012dcf6d06033a41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / prompt2model-0.1.0-py3-none-any.whl

Download URL prompt2model-0.1.0-py3-none-any.whl
Size 111.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be0cb44c5d68665f14b5a31d5e265e1dd5d7746de574a721e61d5ac74d7c14c5
BLAKE2b-256 checksum
How to use checksums
713a34f88b5c29c79f5910fd6f302c109313d8df96420395d49a451b3d296817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page