Skip to main content

🚂 Fine-tune OpenAI models for text classification, question answering, and more

Project description

opentrain

🚂 Fine-tune OpenAI models for text classification, question answering, and more


opentrain is a simple Python package to fine-tune OpenAI models for task-specific purposes such as text classification, token classification, or question answering.

💻 Usage

🦾 Fine-tune

import openai
from opentrain.train import OpenAITrainer

openai.api_key = "<ADD_OPENAI_API_KEY_HERE>"

trainer = OpenAITrainer(model="ada")
trainer.train(
    [
        {
            "prompt": "I love to play soccer ->",
            "completion": " soccer",
        },
        {
            "prompt": "I love to play basketball ->",
            "completion": " basketball",
        },
    ],
)

⚠️ Warning

Fine-tuning OpenAI models via their API may take too long, so please be patient. Also, bear in mind that in some cases you just won't need to fine-tune an OpenAI model for your task.

To keep track of all the models you fine-tuned, you should visit https://platform.openai.com/account/usage, and then in the "Daily usage breakdown (UTC)" you'll need to select the date where you triggered the fine-tuning and click on "Fine-tune training" to see all the fine-tune training requests that you sent.

Besides that, in the OpenAI Playground at https://platform.openai.com/playground, you'll see a dropdown menu for all the available models, both the default ones and the ones you fine-tuned. Usually, in the following format <MODEL>:ft-personal-<DATE>, e.g. ada:ft-personal-2021-03-01.

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

opentrain-0.0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

opentrain-0.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file opentrain-0.0.2.tar.gz.

File metadata

  • Download URL: opentrain-0.0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.0

File hashes

Hashes for opentrain-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4ec5e0f6e69c6804b6d975c1bdb4f44351230366261077c4d1204b8392e54a8f
MD5 4abc82987d0d1f0c947754137d5c437c
BLAKE2b-256 aa48628ebcd41ad7cec103b2bf3795028549da302295571c38cc09f4440778aa

See more details on using hashes here.

File details

Details for the file opentrain-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: opentrain-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.0

File hashes

Hashes for opentrain-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3eae8c0038e794d24cca7037140c3994b091319603b09df85b16d4024720e385
MD5 e5cb35191423d18511b33a6e6c02d88c
BLAKE2b-256 0138eb6fe186c47896c394e46cc25aca4e67aa2e90b522245170d4653de3a4c0

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