{ "cells": [ { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "import openai\n", "from openai import OpenAI\n", "import os" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "client = OpenAI(api_key=None)" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "BASE_MODEL = \"gpt-4o-2024-08-06\"\n", "\n", "INPUT_TRAIN = \"chatgpt-train-8192.jsonl\"\n", "INPUT_TEST = \"chatgpt-test-8192.jsonl\"\n", "\n", "assert os.path.isfile(INPUT_TEST)\n", "assert os.path.isfile(INPUT_TRAIN)" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "train_file = client.files.create(\n", " file=open(INPUT_TRAIN, \"rb\"),\n", " purpose=\"fine-tune\"\n", ")\n", "\n", "test_file = client.files.create(\n", " file=open(INPUT_TEST, \"rb\"),\n", " purpose=\"fine-tune\"\n", ")" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "FineTuningJob(id='ftjob-gmBbrQUbH7ebPO9eapimGI0T', created_at=1728612535, error=Error(code=None, message=None, param=None), fine_tuned_model=None, finished_at=None, hyperparameters=Hyperparameters(n_epochs='auto', batch_size='auto', learning_rate_multiplier='auto'), model='gpt-4o-2024-08-06', object='fine_tuning.job', organization_id='org-uw3iag65cO1uuHFelRfNqH99', result_files=[], seed=2060928557, status='validating_files', trained_tokens=None, training_file='file-BO3hthNeSTuawThRSDeDUTxh', validation_file='file-4C0xDKTAfiL8EqqMIMfYQLde', estimated_finish=None, integrations=[], user_provided_suffix=None)" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "client.fine_tuning.jobs.create(\n", " training_file=train_file.id,\n", " validation_file=test_file.id,\n", " model=BASE_MODEL\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "metricsubs-chunktranslate", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.0" } }, "nbformat": 4, "nbformat_minor": 2 }