{"id":17030010,"url":"https://github.com/alvarobartt/opentrain","last_synced_at":"2026-03-27T03:10:17.405Z","repository":{"id":153581291,"uuid":"626871675","full_name":"alvarobartt/opentrain","owner":"alvarobartt","description":"🚂 Fine-tune OpenAI models for text classification, question answering, and more","archived":false,"fork":false,"pushed_at":"2023-05-01T09:15:03.000Z","size":628,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-15T04:53:08.634Z","etag":null,"topics":["fine-tune","openai","openai-datasets","openai-python"],"latest_commit_sha":null,"homepage":"https://alvarobartt.github.io/opentrain/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alvarobartt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"alvarobartt"}},"created_at":"2023-04-12T10:24:18.000Z","updated_at":"2025-10-25T12:32:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"758fe4de-5a75-4dfc-8338-ddbc5acebc78","html_url":"https://github.com/alvarobartt/opentrain","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":"alvarobartt/python-package-template","purl":"pkg:github/alvarobartt/opentrain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fopentrain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fopentrain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fopentrain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fopentrain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alvarobartt","download_url":"https://codeload.github.com/alvarobartt/opentrain/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fopentrain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31013961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T02:58:54.984Z","status":"ssl_error","status_checked_at":"2026-03-27T02:58:46.993Z","response_time":164,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fine-tune","openai","openai-datasets","openai-python"],"created_at":"2024-10-14T08:03:26.900Z","updated_at":"2026-03-27T03:10:17.394Z","avatar_url":"https://github.com/alvarobartt.png","language":"Python","funding_links":["https://github.com/sponsors/alvarobartt"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eopentrain\u003c/h1\u003e\n  \u003cp\u003e\n    \u003cem\u003e🚂 Fine-tune OpenAI models for text classification, question answering, and more\u003c/em\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n`opentrain` is a simple Python package to fine-tune OpenAI models for task-specific purposes such as text classification, token classification, or question answering.\n\nMore information about OpenAI Fine-tuning at https://platform.openai.com/docs/guides/fine-tuning.\n\n## 💻 Usage\n\n### 📦 Data management\n\n```python\nimport openai\nfrom opentrain import Dataset\n\nopenai.api_key = \"\u003cADD_OPENAI_API_KEY_HERE\u003e\"\n\ndataset = Dataset.from_file(\"data.jsonl\")\ndataset.info\ndataset.download(output_path=\"downloaded-data.jsonl\")\n```\n\n### 🦾 Fine-tune\n\n```python\nimport openai\nfrom opentrain import Train\n\nopenai.api_key = \"\u003cADD_OPENAI_API_KEY_HERE\u003e\"\n\ntrainer = Train(model=\"ada\")\ntrainer.train(\n    [\n        {\n            \"prompt\": \"I love to play soccer -\u003e\",\n            \"completion\": \" soccer\",\n        },\n        {\n            \"prompt\": \"I love to play basketball -\u003e\",\n            \"completion\": \" basketball\",\n        },\n    ],\n)\n```\n\n### 🤖 Predict\n\n```python\nimport openai\nfrom opentrain import Inference\n\nopenai.api_key = \"\u003cADD_OPENAI_API_KEY_HERE\u003e\"\n\npredict = Inference(model=\"ada:ft-personal-2021-03-01-00-00-01\")\npredict.predict(\"I love to play -\u003e\")\n```\n\n## ⚠️ Warning\n\nFine-tuning OpenAI models via their API may take too long, so please be patient. Also, bear in mind\nthat in some cases you just won't need to fine-tune an OpenAI model for your task.\n\nTo keep track of all the models you fine-tuned, you should visit https://platform.openai.com/account/usage, \nand then in the \"Daily usage breakdown (UTC)\" you'll need to select the date where you triggered the\nfine-tuning and click on \"Fine-tune training\" to see all the fine-tune training requests that you sent.\n\nBesides that, in the OpenAI Playground at https://platform.openai.com/playground, you'll see a dropdown\nmenu for all the available models, both the default ones and the ones you fine-tuned. Usually, in the \nfollowing format `\u003cMODEL\u003e:ft-personal-\u003cDATE\u003e`, e.g. `ada:ft-personal-2021-03-01-00-00-01`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarobartt%2Fopentrain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falvarobartt%2Fopentrain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarobartt%2Fopentrain/lists"}