Autodistill GPT Module
This repository contains the code supporting the GPT (text) base model for use with Autodistill.
You can use Autodistill GPT to classify text using OpenAI's GPT models for use in training smaller, fine-tuned text classification models. You can also use Autodistill GPT to use LLaMAfile text generation models.
Read the full Autodistill documentation.
Installation
To use GPT or LLaMAfile models with Autodistill, you need to install the following dependency:
pip3 install autodistill-gpt-text
Quickstart (LLaMAfile)
from autodistill_gpt_text import GPTClassifier
# define an ontology to map class names to our GPT prompt
# the ontology dictionary has the format {caption: class}
# where caption is the prompt sent to the base model, and class is the label that will
# be saved for that caption in the generated annotations
# then, load the model
base_model = GPTClassifier(
ontology=CaptionOntology(
{
"computer vision": "computer vision",
"natural language processing": "nlp"
}
),
base_url = "http://localhost:8080/v1", # your llamafile server
model_id="LLaMA_CPP"
)
# label a single text
result = GPTClassifier.predict("This is a blog post about computer vision.")
# label a JSONl file of texts
base_model.label("data.jsonl", output="output.jsonl")
Quickstart (GPT)
from autodistill_gpt_text import GPTClassifier
# define an ontology to map class names to our GPT prompt
# the ontology dictionary has the format {caption: class}
# where caption is the prompt sent to the base model, and class is the label that will
# be saved for that caption in the generated annotations
# then, load the model
base_model = GPTClassifier(
ontology=CaptionOntology(
{
"computer vision": "computer vision",
"natural language processing": "nlp"
}
)
)
# label a single text
result = GPTClassifier.predict("This is a blog post about computer vision.")
# label a JSONl file of texts
base_model.label("data.jsonl", output="output.jsonl")
The output JSONl file will contain all the data in your original file, with a new classification key in each entry that contains the predicted text label associated with that entry.
License
This project is licensed under an MIT license.
🏆 Contributing
We love your input! Please see the core Autodistill contributing guide to get started. Thank you 🙏 to all our contributors!
Metadata
Release files for autodistill-gpt-text 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autodistill_gpt_text-0.1.0.tar.gz | 3.5 kB | Without provenance | Details for autodistill_gpt_text-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autodistill_gpt_text-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for autodistill_gpt_text-0.1.0-py3-none-any.whl |
Total release size: 7.2 kB
Release files / autodistill_gpt_text-0.1.0.tar.gz
| Download URL | autodistill_gpt_text-0.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebe1ed58dab790f2d8b7dcfefb88175ad3e6d9cdf1e3183c34939c0449915962
|
|
BLAKE2b-256 checksum How to use checksums |
3fcaf0dafb84a5d0fca25cbc3e5c5bd9fe46ea370f9e759bce8f31e9fc23cb6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / autodistill_gpt_text-0.1.0-py3-none-any.whl
| Download URL | autodistill_gpt_text-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31e6f5dd7031a1ad5be93f3fdf070d396a385b95f0dd49ecf2f719fd988be1f2
|
|
BLAKE2b-256 checksum How to use checksums |
ff39914b1dd5080d421b263ffa49d019597f034cb64c5a095e3539658058ffff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for autodistill-gpt-text 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.