Fast prompt tuning framework for large language models
Project description
ruPrompts
ruPrompts is a high-level yet extensible library for fast language model tuning via automatic prompt search, featuring integration with HuggingFace Hub, configuration system powered by Hydra, and command line interface.
Prompt is a text instruction for language model, like
Translate English to French:
cat =>
For some tasks the prompt is obvious, but for some it isn't. With ruPrompts you can define only the prompt format, like <P*10>{text}<P*10>, and train it automatically for any task, if you have a training dataset.
You can currently use ruPrompts for text-to-text tasks, such as summarization, detoxification, style transfer, etc., and for styled text generation, as a special case of text-to-text.
Features
- Modular structure for convenient extensibility
- Integration with HF Transformers, support for all models with LM head
- Integration with HF Hub for sharing and loading pretrained prompts
- CLI and configuration system powered by Hydra
- Pretrained prompts for ruGPT-3
Installation
ruPrompts can be installed with pip:
pip install ruprompts[hydra]
See Installation for other installation options.
Usage
Loading a pretrained prompt for styled text generation:
>>> import ruprompts
>>> from transformers import pipeline
>>> ppln_joke = pipeline("text-generation-with-prompt", prompt="konodyuk/prompt_rugpt3large_joke")
>>> ppln_joke("Говорит кружка ложке")
[{"generated_text": 'Говорит кружка ложке: "Не бойся, не утонешь!".'}]
For text2text tasks:
>>> ppln_detox = pipeline("text2text-generation-with-prompt", prompt="konodyuk/prompt_rugpt3large_detox_russe")
>>> ppln_detox("Опять эти тупые дятлы все испортили, чтоб их черти взяли")
[{"generated_text": 'Опять эти люди все испортили'}]
Proceed to Quick Start for a more detailed introduction or start using ruPrompts right now with our Colab Tutorials.
License
ruPrompts is Apache 2.0 licensed. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ruprompts-0.1.3.tar.gz.
File metadata
- Download URL: ruprompts-0.1.3.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.9 Darwin/21.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f5519548934469f917a8cd818e8b09a1f2bb9e7177d7adfae68232d1724ab86
|
|
| MD5 |
06a46613015a006de8ba2976d7d4fc25
|
|
| BLAKE2b-256 |
74f7fe479862034423161bdc589f85edc24cf67fe2f87ad9fe703c030ef15cb0
|
File details
Details for the file ruprompts-0.1.3-py3-none-any.whl.
File metadata
- Download URL: ruprompts-0.1.3-py3-none-any.whl
- Upload date:
- Size: 29.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.9 Darwin/21.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f24bed944121bffdea94909bdc9e8cd2f2230d2ff7b4d1a907e9430db670a6b4
|
|
| MD5 |
f19d576ab1329dc98e998f245b941a3c
|
|
| BLAKE2b-256 |
b38d0a528352fdd093351ea981cc658d7c061d2cd9c87a945dd4d2dff9634654
|