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](https://private-user-images.githubusercontent.com/2577384/262811663-39ca466a-5355-4d82-8312-303e52ba2bca.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxNzcxMDIsIm5iZiI6MTcyNDE3NjgwMiwicGF0aCI6Ii8yNTc3Mzg0LzI2MjgxMTY2My0zOWNhNDY2YS01MzU1LTRkODItODMxMi0zMDNlNTJiYTJiY2EucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjBUMTgwMDAyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2RlMTVhZGI2MjBlMjIzZDc1ODNhMmU2N2MzMmZlYzJkNWZjNzNlY2NkMTNmNTcxNDhkMGYyMjAwYzExZDQxMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.WBAip2n43d6pbel8Mn2l4Q7syGaBE-wNDvdEFDV0RUk)
You can run our demo of Prompt2Model
through a notebook:
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.
promptmodel_demo.mp4
You can see the tips and examples to write a good prompt in prompt_examples.
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.
If you're interested in contributing to the prompt2model
project, please
- refer to CONTRIBUTING.md
- open an issue or submit a PR
- join us on discord
- or reach out to @vijaytarian and @Chenan3_Zhao on Twitter
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}
}