93 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			93 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | ||
| type: "note"
 | ||
| created: "2024-03-13T00:32:56.770Z"
 | ||
| updated: "2024-03-13T03:55:25.945Z"
 | ||
| ---
 | ||
| 
 | ||
| # Private GPT
 | ||
| 
 | ||
| ```bash
 | ||
| # https://youtu.be/WxYC9-hBM_g?t=1088&si=bvOL8BmNI6KWht5r
 | ||
| # https://github.com/imartinez/privateGPT
 | ||
| # https://docs.privategpt.dev/overview/welcome/introduction
 | ||
| # https://medium.com/@docteur_rs/installing-privategpt-on-wsl-with-gpu-support-5798d763aa31
 | ||
| sudo -i
 | ||
| apt update
 | ||
| apt-get upgrade -y
 | ||
| apt install -y software-properties-common
 | ||
| add-apt-repository ppa:deadsnakes/ppa
 | ||
| [enter]
 | ||
| apt-get remove -y python3
 | ||
| apt autoremove -y
 | ||
| python3 --version
 | ||
| apt-get install -y python3 python3-dev python3-venv python3-pip bluez libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libturbojpeg0-dev tzdata ffmpeg liblapack3 liblapack-dev libatlas-base-dev
 | ||
| python3 --version
 | ||
| apt-get remove -y python3
 | ||
| apt autoremove -y
 | ||
| python3 --version
 | ||
| apt install -y python3.12 -y
 | ||
| python3 --version
 | ||
| ls /usr/bin/python3*
 | ||
| update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2
 | ||
| update-alternatives --config python3
 | ||
| [enter]
 | ||
| python3 --version
 | ||
| exit
 | ||
| python3 --version
 | ||
| sudo apt-get install -y build-essential
 | ||
| sudo apt-get install -y git gcc make openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev zlib1g-dev libncursesw5-dev libgdbm-dev libc6-dev zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libffi-dev
 | ||
| git clone https://github.com/imartinez/privateGPT
 | ||
| curl https://pyenv.run | bash
 | ||
| export PATH="/home/$(whoami)/.pyenv/bin:$PATH"
 | ||
| export PYENV_ROOT="$HOME/.pyenv"
 | ||
| [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
 | ||
| eval "$(pyenv init -)"
 | ||
| source .bashrc
 | ||
| sudo apt-get install -y lzma
 | ||
| sudo apt-get install -y liblzma-dev
 | ||
| pyenv install 3.11
 | ||
| pyenv global 3.11
 | ||
| pip install pip --upgrade
 | ||
| pyenv local 3.11
 | ||
| curl -sSL https://install.python-poetry.org | python3 -
 | ||
| export PATH="/home/phares/.local/bin:$PATH"
 | ||
| source ~/.bashrc
 | ||
| poetry --version
 | ||
| cd privateGPT
 | ||
| # poetry install --with ui
 | ||
| # poetry install --with local
 | ||
| # https://stackoverflow.com/questions/78149911/poetry-poetry-install-with-ui-error-groups-not-found-ui-via-with
 | ||
| poetry install --extras ui
 | ||
| poetry install --extras local
 | ||
| exit
 | ||
| ```
 | ||
| 
 | ||
| ```PowerShell
 | ||
| wsl --export Ubuntu "Ubuntu\Ubuntu-Private-GPT-001.tar"
 | ||
| wsl --unregister ubuntu
 | ||
| ```
 | ||
| 
 | ||
| ```bash To Do !!!
 | ||
| paint "C:\Users\phares\Pictures\Screenshots\Screenshot 2024-03-12 205249.png"
 | ||
| export PATH="/usr/local/cuda-12.3/bin:$PATH"
 | ||
| export LD_LIBRARY_PATH="/usr/local/cuda-12.3/lib64:$LD_LIBRARY_PATH"
 | ||
| ℹ️ Maybe check the content of “/user/local” to be sure that you do have the “cuda-12.3” folder. Yours might have a different version.
 | ||
| 
 | ||
| Reload your configuration and check that all is working as expected
 | ||
| 
 | ||
| source ~/.bashrc
 | ||
| nvcc --version
 | ||
| nvidia-smi.exe
 | ||
| ℹ️ “nvidia-smi” isn’t available on WSL so just verify that the .exe one detects your hardware. Both commands should displayed gibberish but no apparent errors.
 | ||
| 
 | ||
| Building and Running PrivateGPT
 | ||
| Finally, install LLAMA CUDA libraries and Python bindings:
 | ||
| ```
 | ||
| 
 | ||
| ```bash
 | ||
| CMAKE_ARGS='-DLLAMA_CUBLAS=on' poetry run pip install --force-reinstall --no-cache-dir llama-cpp-python
 | ||
| poetry run python scripts/setup
 | ||
| make run
 | ||
| make ingest ./dailynotes -- --watch
 | ||
| ```
 |