Workaround for Peft not updating their package version on the git repo (#88)

* Workaround for Peft not updating their git package version

* Update webui.py

---------

Co-authored-by: oobabooga <112222186+oobabooga@users.noreply.github.com>
This commit is contained in:
jllllll 2023-06-20 18:21:10 -05:00 committed by GitHub
parent 9bb2fc8cd7
commit 5cbc0b28f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,6 +113,21 @@ def update_dependencies():
os.chdir("text-generation-webui")
run_cmd("git pull", assert_success=True, environment=True)
# Workaround for git+ packages not updating properly
with open("requirements.txt") as f:
requirements = f.read().splitlines()
git_requirements = [req for req in requirements if req.startswith("git+")]
# Loop through each "git+" requirement and uninstall it
for req in git_requirements:
# Extract the package name from the "git+" requirement
url = req.replace("git+", "")
package_name = url.split("/")[-1].split("@")[0]
# Uninstall the package using pip
run_cmd("python -m pip uninstall " + package_name, environment=True)
print(f"Uninstalled {package_name}")
# Installs/Updates dependencies from all requirements.txt
run_cmd("python -m pip install -r requirements.txt --upgrade", assert_success=True, environment=True)
extensions = next(os.walk("extensions"))[1]