A super easy tool to fine-tune GPT models using the OpenAI API with a simple Flask backend and React frontend.
Fine-tuning is training a pre-trained AI model (like GPT) on a specific dataset to adapt it to particular needs or improve its performance on certain types of tasks!
In the server
folder:
- The data to fine-tune the model is located in
data/data.jsonl
(see finetune.py for the fine-tuning code) - The fine-tuned model will be identified with an ID, which will be stored in
model_id.txt
Note: You will find sample data/prompts in data.jsonl
-
You will need an OpenAI API key to use this toolkit.
-
Add your OpenAI API key to a
.env
file in theserver
directory:OPENAI_API_KEY=your_openai_api_key_here
-
Clone the repository:
git clone https://github.com/your-username/gpt-finetune-kit.git cd gpt-finetune-kit
-
Navigate to the 'server' directory
cd server pip install -r requirements.txt
-
Insert the desired data and prompts in data/data.jsonl
-
Fine-tune model
python finetune.py
-
Start the backend server to initiate the backend
python server.py
The backend is now at http://localhost:8080/api/home
-
Set up the frontend: Open a new terminal and navigate to the client directory
cd ../client npm install npm run dev
The frontend is now accessible at http://localhost:3000
Note: Please check your OpenAI projects dashboard to confirm the status of your fine-tuning jobs. If a job fails, it is likely due to improperly formatted or insufficient data.
Happy fine-tuning!