mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-12-26 14:20:40 +01:00
Add cuBLAS llama-cpp-python wheel installation (#102)
Parses requirements.txt using regex to determine required version.
This commit is contained in:
parent
bb79037ebd
commit
11a8fd1eb9
13
webui.py
13
webui.py
@ -1,5 +1,6 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import glob
|
import glob
|
||||||
|
import re
|
||||||
import os
|
import os
|
||||||
import site
|
import site
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -110,10 +111,10 @@ def update_dependencies():
|
|||||||
os.chdir("text-generation-webui")
|
os.chdir("text-generation-webui")
|
||||||
run_cmd("git pull", assert_success=True, environment=True)
|
run_cmd("git pull", assert_success=True, environment=True)
|
||||||
|
|
||||||
# Workaround for git+ packages not updating properly
|
# Workaround for git+ packages not updating properly Also store requirements.txt for later use
|
||||||
with open("requirements.txt") as f:
|
with open("requirements.txt") as f:
|
||||||
requirements = f.read().splitlines()
|
textgen_requirements = f.read()
|
||||||
git_requirements = [req for req in requirements if req.startswith("git+")]
|
git_requirements = [req for req in textgen_requirements.splitlines() if req.startswith("git+")]
|
||||||
|
|
||||||
# Loop through each "git+" requirement and uninstall it
|
# Loop through each "git+" requirement and uninstall it
|
||||||
for req in git_requirements:
|
for req in git_requirements:
|
||||||
@ -161,6 +162,12 @@ def update_dependencies():
|
|||||||
if '+cu' not in torver and run_cmd("conda list -f pytorch-cuda | grep pytorch-cuda", environment=True, capture_output=True).returncode == 1:
|
if '+cu' not in torver and run_cmd("conda list -f pytorch-cuda | grep pytorch-cuda", environment=True, capture_output=True).returncode == 1:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Install llama-cpp-python built with cuBLAS support for NVIDIA GPU acceleration
|
||||||
|
if '+cu' in torver:
|
||||||
|
llama_cpp = re.search('(?<=llama-cpp-python==)\d+(?:\.\d+)*', textgen_requirements)
|
||||||
|
if llama_cpp is not None:
|
||||||
|
run_cmd(f'python -m pip install llama-cpp-python=={llama_cpp[0]} --force-reinstall --no-deps --index-url=https://jllllll.github.io/llama-cpp-python-cuBLAS-wheels/AVX2/cu117', environment=True)
|
||||||
|
|
||||||
# Finds the path to your dependencies
|
# Finds the path to your dependencies
|
||||||
for sitedir in site.getsitepackages():
|
for sitedir in site.getsitepackages():
|
||||||
if "site-packages" in sitedir:
|
if "site-packages" in sitedir:
|
||||||
|
Loading…
Reference in New Issue
Block a user