Skip to content

Haashimi/custom-data-chatgpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Train ChatGPT with custom data and create your own chatbot

Building your own AI-powered chatbot has never been easier. With OpenAI’s ChatGPT, you can train a language model using custom data tailored to your specific needs.

Step 1: Install python

Step 2: Upgrade Pip

  •  python3 -m pip install -U pip
    

Step 3: create virtual environment

  • python -m venv venv 
    

Step 4: activate environment

  • venv\Scripts\activate
    

Step 5: Install libraries

First command installs OpenAI library:

  • pip3 install openai 
    

Next, install GPT index, which is also called LlamaIndex. It allows the LLM to connect to the external data that is our knowledge base.
  •  pip3 install gpt_index 
    

Once done, install PyPDF2 Its python based PDF parsing library and needed if you are going to feed PDF files to model.

  • pip3 install PyPDF2
    

and finally install gradio which creates simple UI to interact with AI chatgpt.
  •  pip3 install gradio
    

Finally we are done with installing libraries and we can move on to creating script for training and prepare data as well.

Step 6: Get OpenAI key

Before diving into script, lets get API key from Open AI You can then click on Create new secret key to generate a key for our script Remember that once key is generated, you won’t be able to see it again. You must copy and save the key in some secure location to be able to access it later.

Step 7: Prepare data

Create a new directory named ‘docs’ anywhere you like and put PDF, TXT or CSV files inside it. You can add multiple files if you like but remember that more data you add, more the tokens will be used. Free accounts are given 18$ worth of tokens to use.

Step 8: Create script

Now that everything is in place, our next step is to create a python script to train chatbot with custom data. It will use files inside doc directory, that we created above, and generate a json file. You can use any text editor if you are using Visual Studio Code then its even better.

About

This app trains custom data using chatgpt models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages