A project that implements GPT-3 training with whatsapp messages.
This simple Python script gets your Whatsapp conversations exported as TXT and compress into a single jsonl file which is used to train a fine-tuned Open AI GPT-3 model, to simulate your responses.
- OpenAI account and OpenAI API Token
- Python 3.11
- Few whatsapp conversations (More than 2000 messages)
- Around $20 to train and use the fined-tuned model
- Create OpenAI API account
- Get the API Key
- Download and install Python 3.11
- Clone this repo
git clone https://github.com/felps-dev/gpt-3-whatsapp-training - Create a virtualenv inside the cloned repo
python3 -m venv env - Activate your virtual env
env/Scripts/Activate(for windows) andsource env/bin/activatefor unix based OS (Mac, Linux, etc) - Install requirements
pip install -r requirements.txt - Export your Whatsapp messages
- Go to a conversation
- Press 3 dots on top right corner
- Export conversation
- Export without media
- Get the TXT file from each conversation
- Put the TXT files from previous step inside
training_datafolder - Create a copy of the file
.env_templatenamed as.env - Fill the
.envwith your info- RESPONSE_USER - Is your nickname on TXT files
- OPENAI_API_KEY - Is the api key from previous steps
- MODEL_ENGINE - Is the model generated after training finishes
- Don't worry to not have MODEL_ENGINE, you didnt made the training yet.
- Prepare the data for training using
python3 compress_training_data.py - This will create a new file named
training_data.jsonl - Start the training using the command
openai api fine_tunes.create -t training_data.jsonl -m davinci - You can use other models instead davinci, see there
- Wait until the training finishes, you can get the info using
openai api fine_tunes.get -i your_ft_id_given_by_previous_command - Once the training finishes, you can get your model using the info from previous step, on
fine_tuned_modelproperty. - Now put your model-id inside
MODEL_ENGINEat .env file - Start chat by using
python3 chat.py