{"id":20779468,"url":"https://github.com/freedomintelligence/finetune_chatgpt","last_synced_at":"2025-04-30T19:45:53.341Z","repository":{"id":190436514,"uuid":"682625119","full_name":"FreedomIntelligence/finetune_chatgpt","owner":"FreedomIntelligence","description":"The example for finetuning chatgpt.","archived":false,"fork":false,"pushed_at":"2023-08-28T07:01:55.000Z","size":134,"stargazers_count":27,"open_issues_count":0,"forks_count":6,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-30T19:22:48.273Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FreedomIntelligence.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-24T15:12:29.000Z","updated_at":"2025-01-16T08:44:22.000Z","dependencies_parsed_at":"2023-08-24T17:31:07.889Z","dependency_job_id":null,"html_url":"https://github.com/FreedomIntelligence/finetune_chatgpt","commit_stats":null,"previous_names":["freedomintelligence/finetune_chatgpt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomIntelligence%2Ffinetune_chatgpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomIntelligence%2Ffinetune_chatgpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomIntelligence%2Ffinetune_chatgpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomIntelligence%2Ffinetune_chatgpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FreedomIntelligence","download_url":"https://codeload.github.com/FreedomIntelligence/finetune_chatgpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251773477,"owners_count":21641635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-17T13:28:04.079Z","updated_at":"2025-04-30T19:45:53.302Z","avatar_url":"https://github.com/FreedomIntelligence.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ChatGPT Fine-Tuning Guide\n\n## Introduction\nThis repository provides an example on how to fine-tune the ChatGPT model for a specific task. \n\nIt draws inspiration from the [GrammarGPT project](https://github.com/FreedomIntelligence/GrammarGPT). \n\nYou're free to modify the input files as per your requirements.\n\n## Steps to Fine-Tune Your Model\n\n### 1. Setup\n\nEnsure you have the latest OpenAI package installed (version `openai\u003e=0.27.9`).\n\n```bash\npip install -r requirements.txt\n```\n\n### 2. Data Preparation\n\nPrepare your custom training data (e.g., `train_data.jsonl`) and validation data (e.g., `dev_data.jsonl`).\n\n**Note:** The size of the input file is currently capped at 50MB. For more details, refer to the [OpenAI documentation on dataset preparation](https://platform.openai.com/docs/guides/fine-tuning/preparing-your-dataset).\n\n### 3. Model Training\n\nTo train your model, use the `train_model.py` script:\n\n```bash\npython train_model.py\n```\n\n**Important:** In `train_model.py`, ensure that you first upload the custom data to OpenAI. Once the upload is successful, the training will commence. The training process might take several hours, so please be patient.\n\n### 4. Model Testing\n\nTo test your fine-tuned model, use the `test_model.py` script:\n\n```bash\npython test_model.py\n```\n\n**Note:** You need to get the model id before the test.\n\n## Experimental Results\n\n| Model                     | # Param. | Data| Word-level (P/R/F) | Char-level(P/R/F)         |\n|:--------------------------|:---------|:----|:-------------------|:--------------------------|\n| S2S_BART                  | 375M     | 1061| 21.08/10.54/17.57  | 22.09/10.62/18.16         |\n| GrammarGPT                | 7B       | 1061| **42.42**/16.87/32.56  | **46.67**/18.58/**35.84** |\n| Fine-tuning GPT-3.5 Turbo | -        | 1061| 36.16/**34.75**/**35.87**  | 36.17/**33.69**/35.65     |\n\n\n## Additional Resources\n\n- Official OpenAI API documentation on fine-tuning: [API Reference](https://platform.openai.com/docs/api-reference/fine-tuning/create)\n- OpenAI Guide on creating a fine-tuned model: [Python Guide](https://platform.openai.com/docs/guides/fine-tuning/create-a-fine-tuned-model)\n- Video tutorial on fine-tuning ChatGPT: [YouTube Tutorial](https://www.youtube.com/watch?v=_yzmQbez7gk)\n\n## Acknowledgments\n\nSpecial thanks to the following repository for its invaluable insights:\n\n[OpenAI Fine-tuning Guide](https://github.com/horosin/open-finetuning/tree/main)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreedomintelligence%2Ffinetune_chatgpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreedomintelligence%2Ffinetune_chatgpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreedomintelligence%2Ffinetune_chatgpt/lists"}