The lead image for this article was generated by HackerNoon's AI Image Generator via the prompt "a robot using an old desktop computer"
There's something new in the AI space. In this post, I'll walk you through the process of installing and setting up PrivateGPT.
A powerful tool that allows you to query documents locally without the need for an internet connection. Whether you're a researcher, dev, or just curious about exploring document querying tools, PrivateGPT provides an efficient and secure solution. This tutorial accompanies a Youtube video, where you can find a step-by-step demonstration of the installation process!
Python 3.10 or later installed on your system or virtual env
Basic knowledge of using the command line Interface (CLI/Terminal)
Git installed
First, let's create a virtual environment. You can create a folder on your desktop. In the screenshot below you can see I created a folder called 'blog_projects'. Open the command line from that folder or navigate to that folder using the terminal/ Command Line. Follow the steps below to create a virtual environment.
python3 -m venv myenv
The name of your virtual environment will be 'myenv'
source myenv/bin/activate
myenv\Scripts\activate
git clone https://github.com/imartinez/privateGPT.git
By creating and activating the virtual environment before cloning the repository, we ensure that the project dependencies will be installed and managed within this environment. This helps maintain a clean and isolated development environment specific to this project.
After cloning the repository, you can proceed to install the project dependencies and start working on the project within the activated virtual environment.
Then copy the code repo from Github, and go into your directory or folder where you want your project to live. Open the terminal or navigate to your folder from the command line.
Once everything loads, you can run the install requirements command to install the needed dependencies.
CD <FOLDER NAME>
pip install -r requirements.txt
Make sure you create a models folder in your project to place the model you downloaded.
PrivateGPT comes with a sample dataset that uses a 'state of the union transcript' as an example. However, you can also ingest your own dataset. Let me show you how.
python ingest.py
Perfect! The data ingestion process is complete. Now, let's move on to the next step!
If you have this error: cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_'
, use this command: python -m pip install requests "urllib3<2"
Key thing to mention, IF YOU ADD NEW DOCUMENTS TO YOUR SOURCE_DOCS you need to rerun ‘python ingest.py’
---------------------------------------------------------------
Now comes the exciting part—asking questions to your documents using PrivateGPT. Let me show you how it's done.
[ project directory 'privateGPT' , if you type ls in your CLI you will see the READ.ME file, among a few files.]
python privateGPT.py
Tricks and tips: