mirror of
https://github.com/kennethreitz/instructor.git
synced 2026-06-05 22:50:18 +00:00
@@ -0,0 +1,92 @@
|
||||
# Using the Command Line Interface
|
||||
The instructor CLI provides functionalities for managing fine-tuning jobs on OpenAI.
|
||||
|
||||
## Creating a Fine-Tuning Job
|
||||
|
||||
### View Jobs Options
|
||||
|
||||
```sh
|
||||
$ instructor jobs --help
|
||||
|
||||
Usage: instructor jobs [OPTIONS] COMMAND [ARGS]...
|
||||
|
||||
Monitor and create fine tuning jobs
|
||||
|
||||
╭─ Options ───────────────────────────────────────────────────────────────────────────────╮
|
||||
│ --help Show this message and exit. │
|
||||
╰─────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ cancel Cancel a fine-tuning job. │
|
||||
│ create-from-file Create a fine-tuning job from a file. │
|
||||
│ create-from-id Create a fine-tuning job from an existing ID. │
|
||||
│ list Monitor the status of the most recent fine-tuning jobs. │
|
||||
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
|
||||
```
|
||||
|
||||
### Create from File
|
||||
|
||||
The create-from-file command uploads and trains a model in a single step:
|
||||
|
||||
```sh
|
||||
$ instructor jobs create-from-file transformed_data.jsonl
|
||||
```
|
||||
|
||||
### Create from ID
|
||||
|
||||
The create-from-id command uses an uploaded file and trains a model
|
||||
|
||||
```sh
|
||||
$ instructor files upload transformed_data.jsonl
|
||||
$ instructor files list
|
||||
...
|
||||
$ instructor jobs create-from-file <file_id>
|
||||
```
|
||||
|
||||
|
||||
### Viewing Files and Jobs
|
||||
|
||||
#### Viewing Jobs
|
||||
|
||||
```sh
|
||||
$ instructor jobs list
|
||||
|
||||
OpenAI Fine Tuning Job Monitoring
|
||||
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
|
||||
┃ ┃ ┃ ┃ Completion ┃ ┃ ┃ ┃ ┃
|
||||
┃ Job ID ┃ Status ┃ Creation Time ┃ Time ┃ Model Name ┃ File ID ┃ Epochs ┃ Base Model ┃
|
||||
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
|
||||
│ ftjob-PWo6uwk… │ 🚫 cancelled │ 2023-08-23 │ N/A │ │ file-F7lJg6Z4… │ 3 │ gpt-3.5-turbo-… │
|
||||
│ │ │ 23:10:54 │ │ │ │ │ │
|
||||
│ ftjob-1whjva8… │ 🚫 cancelled │ 2023-08-23 │ N/A │ │ file-F7lJg6Z4… │ 3 │ gpt-3.5-turbo-… │
|
||||
│ │ │ 22:47:05 │ │ │ │ │ │
|
||||
│ ftjob-wGoBDld… │ 🚫 cancelled │ 2023-08-23 │ N/A │ │ file-F7lJg6Z4… │ 3 │ gpt-3.5-turbo-… │
|
||||
│ │ │ 22:44:12 │ │ │ │ │ │
|
||||
│ ftjob-yd5aRTc… │ ✅ succeeded │ 2023-08-23 │ 2023-08-23 │ ft:gpt-3.5-tur… │ file-IQxAUDqX… │ 3 │ gpt-3.5-turbo-… │
|
||||
│ │ │ 14:26:03 │ 15:02:29 │ │ │ │ │
|
||||
└────────────────┴──────────────┴────────────────┴────────────────┴─────────────────┴────────────────┴────────┴─────────────────┘
|
||||
Automatically refreshes every 5 seconds, press Ctrl+C to exit
|
||||
```
|
||||
|
||||
|
||||
#### Viewing Files
|
||||
|
||||
```sh
|
||||
$ instructor files list
|
||||
|
||||
OpenAI Files
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┓
|
||||
┃ File ID ┃ Size (bytes) ┃ Creation Time ┃ Filename ┃ Purpose ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━┩
|
||||
│ file-0lw2BSNRUlXZXRRu2beCCWjl │ 369523 │ 2023-08-23 23:31:57 │ file │ fine-tune │
|
||||
│ file-IHaUXcMEykmFUp1kt2puCDEq │ 369523 │ 2023-08-23 23:09:35 │ file │ fine-tune │
|
||||
│ file-ja9vRBf0FydEOTolaa3BMqES │ 369523 │ 2023-08-23 22:42:29 │ file │ fine-tune │
|
||||
│ file-F7lJg6Z47CREvmx4kyvyZ6Sn │ 369523 │ 2023-08-23 22:42:03 │ file │ fine-tune │
|
||||
│ file-YUxqZPyJRl5GJCUTw3cNmA46 │ 369523 │ 2023-08-23 22:29:10 │ file │ fine-tune │
|
||||
└───────────────────────────────┴──────────────┴─────────────────────┴──────────┴───────────┘
|
||||
```
|
||||
|
||||
# Contributions
|
||||
|
||||
We aim to provide a light wrapper around the API rather than offering a complete CLI. Contributions are welcome! Please feel free to make an issue at [jxnl/instructor/issues](https://github.com/jxnl/instructor/issues) or submit a pull request.
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# Using the OpenAI API Usage CLI
|
||||
|
||||
The OpenAI API Usage CLI tool provides functionalities for monitoring your OpenAI API usage, breaking it down by model, date, and cost.
|
||||
|
||||
## Monitoring API Usage
|
||||
|
||||
### View Usage Options
|
||||
|
||||
```sh
|
||||
$ instructor usage --help
|
||||
|
||||
Usage: instructor usage [OPTIONS] COMMAND [ARGS]...
|
||||
|
||||
Check OpenAI API usage data
|
||||
|
||||
╭─ Options ───────────────────────────────────────────────────────╮
|
||||
│ --help Show this message and exit. │
|
||||
╰─────────────────────────────────────────────────────────────────╯
|
||||
╭─ Commands ──────────────────────────────────────────────────────╮
|
||||
│ list Displays OpenAI API usage data for the past N days. │
|
||||
╰─────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
### List Usage for Specific Number of Days
|
||||
|
||||
To display API usage for the past 3 days, use the following command:
|
||||
|
||||
```sh
|
||||
$ instructor usage list -n 3
|
||||
```
|
||||
|
||||
This will output a table similar to:
|
||||
|
||||
```plaintext
|
||||
Usage Summary by Date, Snapshot, and Cost
|
||||
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
|
||||
┃ Date ┃ Snapshot ID ┃ Total Requests ┃ Total Cost ($) ┃
|
||||
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
|
||||
│ 2023-09-04 │ gpt-4-0613 │ 44 │ 0.68 │
|
||||
│ 2023-09-04 │ gpt-3.5-turbo-16k-0613 │ 195 │ 0.84 │
|
||||
│ 2023-09-04 │ text-embedding-ada-002-v2 │ 276 │ 0.00 │
|
||||
│ 2023-09-04 │ gpt-4-32k-0613 │ 328 │ 49.45 │
|
||||
└────────────┴───────────────────────────┴────────────────┴────────────────┘
|
||||
```
|
||||
|
||||
### List Usage for Today
|
||||
|
||||
To display the API usage for today, simply run:
|
||||
|
||||
```sh
|
||||
$ instructor usage list
|
||||
```
|
||||
|
||||
# Contributions
|
||||
|
||||
We aim to provide a light wrapper around the API rather than offering a complete CLI. Contributions are welcome! Please feel free to make an issue at [jxnl/instructor/issues](https://github.com/jxnl/instructor/issues) or submit a pull request.
|
||||
|
||||
Reference in New Issue
Block a user