In this project, we will explore how to leverage the full capabilities of GPT-3.5 turbo model, by improving its performance for specialized tasks through fine-tuning. We will create a custom gpt model that can be used for building a chatbot to provide assistance to a clothing store customers. The goal of implementating such solution is to improve customers experience by providing them with fast and accuracte assistance.
The dataset used for fine tuning the chatgpt-3.5-turbo model has been downloaded from kaggle. The main purpose of this dataset is to train a chatbot to provide fast assistance to a clothing store customers. The dataset is large of 1185 rows, with three columns: Contex, Question and Answer. We will only use two columns Question and Answer to train our custom chatgpt model. The dataset in the csv format will be later preprocess to meet OpenAI training data format.
- Load and Read the csv file data.
- Perform EDA on the data to remove duplicates, NAN values or any unwanted value if exist.
- Prepare the dataset to meet OpenAI fine tuning data format. Each example in the dataset should be a conversation in the same format as OpenAI ChatCompletions API function.
- conversation example: {'messages': [{'role': 'system', 'content': 'You are an ecommerce assistant with the purpose of taking customers questions and providing them with relevant response. Customers can report incidents, request services, seek guidance, or seek assistance. You only respond to ecommerce related questions. Do not respond to questions not related to ecommerce.'}, {'role': 'user', 'content': 'How long do I have to cancel my order?'}, {'role': 'assistant', 'content': 'Orders can be canceled within 8 hours. Follow steps on our website under "Order History" for a cancellation.'}]}
- Upload the data into OpenAI platform and launch the training. In the notebook, there are some functions allowing to check the training status but once the training is completed, OpenAI will send a notification email. The model has been trained with default values.
- Test your custom model. If needed, add more data and retrain.
https://www.kaggle.com/datasets/quangnguyen711/clothes-shop-chatbot-dataset
https://platform.openai.com/docs/guides/fine-tuning/preparing-your-dataset