From 8ff2586d45e9bd4652bfabaff96a59a78627e6a8 Mon Sep 17 00:00:00 2001 From: kingbri Date: Sun, 4 Aug 2024 10:13:19 -0400 Subject: [PATCH] Start: Fix pip update, method calls, and logging platform.system() was not called in some places, breaking the ternary on Windows. Pip's --upgrade flag does not actually update dependencies to their latest versions. That's what the --upgrade-strategy eager flag is for. Tell the user where their start preferences are coming from. Signed-off-by: kingbri --- backends/exllamav2/utils.py | 4 ++-- start.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/backends/exllamav2/utils.py b/backends/exllamav2/utils.py index eaaf0e0..cf73be4 100644 --- a/backends/exllamav2/utils.py +++ b/backends/exllamav2/utils.py @@ -16,7 +16,7 @@ def check_exllama_version(): f"or greater. Your current version is {current_version}.\n" "Please update your environment by running an update script " "(update_scripts/" - f"update_deps.{'bat' if platform.system == 'Windows' else 'sh'})\n\n" + f"update_deps.{'bat' if platform.system() == 'Windows' else 'sh'})\n\n" "Or you can manually run a requirements update " "using the following command:\n\n" "For CUDA 12.1:\n" @@ -75,7 +75,7 @@ def supports_paged_attn(): "and features that rely on it (ex. CFG). \n" "Please upgrade your environment by running an update script " "(update_scripts/" - f"update_deps.{'bat' if platform.system == 'Windows' else 'sh'})\n\n" + f"update_deps.{'bat' if platform.system() == 'Windows' else 'sh'})\n\n" "Or you can manually run a requirements update " "using the following command:\n\n" "For CUDA 12.1:\n" diff --git a/start.py b/start.py index 8356d3d..e42f307 100644 --- a/start.py +++ b/start.py @@ -71,7 +71,7 @@ def get_install_features(lib_name: str = None): print( f"WARN: GPU library {lib_name} not found. " "Skipping GPU-specific dependencies.\n" - "WARN: Please delete gpu_lib.txt and restart " + "WARN: Please remove the `gpu_lib` key from start_options.json and restart " "if you want to change your selection." ) return @@ -154,6 +154,7 @@ if __name__ == "__main__": if start_options_path.exists(): with open(start_options_path) as start_options_file: start_options = json.load(start_options_file) + print("Loaded your saved preferences from `start_options.json`") if start_options.get("first_run_done"): first_run = False @@ -201,10 +202,12 @@ if __name__ == "__main__": features = f"[{install_features}]" if install_features else "" # pip install .[features] - install_command = f"pip install -U .{features}" + # Make sure to use eager upgrade strategy + # to push packages to their latest versions + install_command = f"pip install -U --upgrade-strategy eager .{features}" print(f"Running install command: {install_command}") subprocess.run(install_command.split(" ")) - print("\n") + print() if args.update_deps: print( @@ -245,5 +248,5 @@ if __name__ == "__main__": "\n" "This error was raised because a package was not found.\n" "Update your dependencies by running update_scripts/" - f"update_deps.{'bat' if platform.system == 'Windows' else 'sh'}\n\n" + f"update_deps.{'bat' if platform.system() == 'Windows' else 'sh'}\n\n" )