From 03b4067f3197de0ef753d2fe415785e0a5dffebb Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 9 Jan 2025 11:58:33 -0800 Subject: [PATCH] Installer: ask 1 question for NVIDIA users instead of 2 --- docker/amd/Dockerfile | 2 +- docker/cpu/Dockerfile | 2 +- docker/intel/Dockerfile | 2 +- docker/nvidia/Dockerfile | 2 +- one_click.py | 45 +++++++++++++++++++++------------------- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/docker/amd/Dockerfile b/docker/amd/Dockerfile index 365e88e3..cfbcf7e4 100644 --- a/docker/amd/Dockerfile +++ b/docker/amd/Dockerfile @@ -13,7 +13,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,rw \ WORKDIR /home/app/ RUN git clone https://github.com/oobabooga/text-generation-webui.git WORKDIR /home/app/text-generation-webui -RUN GPU_CHOICE=B USE_CUDA118=FALSE LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./start_linux.sh --verbose +RUN GPU_CHOICE=C LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./start_linux.sh --verbose COPY CMD_FLAGS.txt /home/app/text-generation-webui/ EXPOSE ${CONTAINER_PORT:-7860} ${CONTAINER_API_PORT:-5000} ${CONTAINER_API_STREAM_PORT:-5005} WORKDIR /home/app/text-generation-webui diff --git a/docker/cpu/Dockerfile b/docker/cpu/Dockerfile index 04ccf94a..8f643d2f 100644 --- a/docker/cpu/Dockerfile +++ b/docker/cpu/Dockerfile @@ -17,7 +17,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,rw \ WORKDIR /home/app/ RUN git clone https://github.com/oobabooga/text-generation-webui.git WORKDIR /home/app/text-generation-webui -RUN GPU_CHOICE=N USE_CUDA118=FALSE LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./start_linux.sh --verbose +RUN GPU_CHOICE=N LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./start_linux.sh --verbose COPY CMD_FLAGS.txt /home/app/text-generation-webui/ EXPOSE ${CONTAINER_PORT:-7860} ${CONTAINER_API_PORT:-5000} ${CONTAINER_API_STREAM_PORT:-5005} # set umask to ensure group read / write at runtime diff --git a/docker/intel/Dockerfile b/docker/intel/Dockerfile index bc67a185..d2ed671e 100644 --- a/docker/intel/Dockerfile +++ b/docker/intel/Dockerfile @@ -13,7 +13,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,rw \ WORKDIR /home/app/ RUN git clone https://github.com/oobabooga/text-generation-webui.git WORKDIR /home/app/text-generation-webui -RUN GPU_CHOICE=D USE_CUDA118=FALSE LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./start_linux.sh --verbose +RUN GPU_CHOICE=E LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./start_linux.sh --verbose COPY CMD_FLAGS.txt /home/app/text-generation-webui/ EXPOSE ${CONTAINER_PORT:-7860} ${CONTAINER_API_PORT:-5000} ${CONTAINER_API_STREAM_PORT:-5005} # set umask to ensure group read / write at runtime diff --git a/docker/nvidia/Dockerfile b/docker/nvidia/Dockerfile index 66a717a7..900a4329 100644 --- a/docker/nvidia/Dockerfile +++ b/docker/nvidia/Dockerfile @@ -13,7 +13,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,rw \ WORKDIR /home/app/ RUN git clone https://github.com/oobabooga/text-generation-webui.git WORKDIR /home/app/text-generation-webui -RUN GPU_CHOICE=A USE_CUDA118=FALSE LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./start_linux.sh --verbose +RUN GPU_CHOICE=A LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./start_linux.sh --verbose COPY CMD_FLAGS.txt /home/app/text-generation-webui/ EXPOSE ${CONTAINER_PORT:-7860} ${CONTAINER_API_PORT:-5000} ${CONTAINER_API_STREAM_PORT:-5005} WORKDIR /home/app/text-generation-webui diff --git a/one_click.py b/one_click.py index ca11efac..e78a2450 100644 --- a/one_click.py +++ b/one_click.py @@ -232,33 +232,45 @@ def get_user_choice(question, options_dict): def install_webui(): - # Ask the user for the GPU vendor if "GPU_CHOICE" in os.environ: choice = os.environ["GPU_CHOICE"].upper() print_big_message(f"Selected GPU choice \"{choice}\" based on the GPU_CHOICE environment variable.") + + # Warn about changed meanings and handle old NVIDIA choice + if choice == "B": + print_big_message("Warning: GPU_CHOICE='B' now means 'NVIDIA (CUDA 11.8)' in the new version.") + elif choice == "C": + print_big_message("Warning: GPU_CHOICE='C' now means 'AMD' in the new version.") + elif choice == "D": + print_big_message("Warning: GPU_CHOICE='D' now means 'Apple M Series' in the new version.") + elif choice == "A" and "USE_CUDA118" in os.environ: + choice = "B" if os.environ.get("USE_CUDA118", "").lower() in ("yes", "y", "true", "1", "t", "on") else "A" else: choice = get_user_choice( "What is your GPU?", { - 'A': 'NVIDIA', - 'B': 'AMD (Linux/MacOS only. Requires ROCm SDK 6.1 on Linux)', - 'C': 'Apple M Series', - 'D': 'Intel Arc (IPEX)', - 'N': 'None (I want to run models in CPU mode)' + 'A': 'NVIDIA - CUDA 12.1 (recommended)', + 'B': 'NVIDIA - CUDA 11.8 (legacy GPUs)', + 'C': 'AMD - Linux/macOS only, requires ROCm 6.1', + 'D': 'Apple M Series', + 'E': 'Intel Arc (beta)', + 'N': 'CPU mode' }, ) + # Convert choices to GPU names for compatibility gpu_choice_to_name = { "A": "NVIDIA", - "B": "AMD", - "C": "APPLE", - "D": "INTEL", + "B": "NVIDIA", + "C": "AMD", + "D": "APPLE", + "E": "INTEL", "N": "NONE" } selected_gpu = gpu_choice_to_name[choice] - use_cuda118 = "N" + use_cuda118 = (choice == "B") # CUDA version is now determined by menu choice # Write a flag to CMD_FLAGS.txt for CPU mode if selected_gpu == "NONE": @@ -267,18 +279,9 @@ def install_webui(): print_big_message("Adding the --cpu flag to CMD_FLAGS.txt.") cmd_flags_file.write("\n--cpu\n") - # Check if the user wants CUDA 11.8 + # Handle CUDA version display elif any((is_windows(), is_linux())) and selected_gpu == "NVIDIA": - if "USE_CUDA118" in os.environ: - use_cuda118 = "Y" if os.environ.get("USE_CUDA118", "").lower() in ("yes", "y", "true", "1", "t", "on") else "N" - else: - print("\nDo you want to use CUDA 11.8 instead of 12.1?\nOnly choose this option if your GPU is very old (Kepler or older).\n\nFor RTX and GTX series GPUs, say \"N\".\nIf unsure, say \"N\".\n") - use_cuda118 = input("Input (Y/N)> ").upper().strip('"\'').strip() - while use_cuda118 not in 'YN': - print("Invalid choice. Please try again.") - use_cuda118 = input("Input> ").upper().strip('"\'').strip() - - if use_cuda118 == 'Y': + if use_cuda118: print("CUDA: 11.8") else: print("CUDA: 12.1")