privateGPT Installation Guide for Windows Machine (PC)

Introduction:
Embark on a journey to create your very own private language model with our straightforward installation guide for PrivateGPT on a Windows machine. Whether you’re a seasoned developer or just eager to delve into the world of personal language models, this guide breaks down the process into simple steps, explained in plain English.


Prerequisite: Install Conda

If Conda is not yet installed on your system, follow these steps:

  1. Download the Miniconda installer for Windows from here.
  2. Run the installer and follow the on-screen instructions to complete the installation. Make sure to check the box that says “Add Miniconda3 to my PATH environment variable” during installation.
  3. After installation, close and reopen your terminal to make sure the changes take effect.

Step 1: Clone and Set Up the Environment

Start by cloning the PrivateGPT repository and configuring the environment. Open your terminal and execute the following commands:

git clone https://github.com/imartinez/privateGPT
cd privateGPT
conda create -n privateGPT python=3.11 
conda activate privateGPT

These commands fetch the necessary files and set up a virtual environment for PrivateGPT. Afterward, restart your terminal and ensure you select the Python 3.11.6 interpreter in Visual Studio Code or proceed with Anaconda Prompt (with privateGPT virtual environment).


Step 2: Install Poetry package

Poetry simplifies the management of Python dependencies and packaging. Follow these commands to install Poetry:

conda install -c conda-forge pipx 
pipx install poetry
set "PATH=%USERPROFILE%\.local\pipx\venvs\poetry\Scripts;%PATH%"
poetry install --with ui,local

In case you encounter issues with the pypika installation, use the following commands:

pip wheel --use-pep517 "pypika (==0.48.9)"
poetry install --with ui,local

Step 3: Run the Application

It’s time to get PrivateGPT up and running. Execute these commands in your terminal:

cd scripts
ren setup setup.py
cd ..
poetry run python scripts/setup.py
set PGPT_PROFILES=local
set PYTHONPATH=.
poetry run python -m uvicorn private_gpt.main:app --reload --port 8001

Wait for the model to download, and once you spot “Application startup complete,” open your web browser and navigate to 127.0.0.1:8001.


Additional Notes:

  • Changing the Model: Modify settings.yaml in the root folder to switch between different models.
  • Running on GPU: If you want to utilize your GPU, ensure you have PyTorch installed.



GPU Setup Commands

  1. Install PyTorch with CUDA support:
pip install torch==2.0.0+cu118 --index-url https://download.pytorch.org/whl/cu118
  1. Set CMake arguments for llama-cpp-python:
$env:CMAKE_ARGS='-DLLAMA_CUBLAS=on'; poetry run pip install --force-reinstall --no-cache-dir llama-cpp-python

Run PrivateGPT with GPU Acceleration

Now, launch PrivateGPT with GPU support:

poetry run python -m uvicorn private_gpt.main:app --reload --port 8001

Additional Notes:

  • Verify that your GPU is compatible with the specified CUDA version (cu118).
  • Ensure that the necessary GPU drivers are installed on your system.

Conclusion:

Congratulations! You’ve successfully installed PrivateGPT on your Windows machine. Take the time to explore and customize your private language model. Should you have any questions or encounter any challenges, refer to the official documentation or reach out to the supportive community. Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *