oobabooga/textgen · error · ValueError

Unknown GPU choice: {gpu_choice}

Error message

Unknown GPU choice: {gpu_choice}

What it means

Thrown by the requirements-file selector in one_click.py when the GPU choice string does not match any known platform key. The installer maps an exact choice name ('NVIDIA_CUDA128', 'AMD', 'APPLE', 'INTEL', 'NONE') to a requirements file under requirements/full/; anything else — including legacy names like 'NVIDIA' or 'NVIDIA_CUDA121' after a version bump — is rejected rather than silently installing the wrong wheels.

Source

Thrown at one_click.py:160

        return f"{base_cmd}--index-url https://download.pytorch.org/whl/xpu"
    else:
        return base_cmd


def get_requirements_file(gpu_choice):
    """Get requirements file path based on GPU choice"""
    requirements_base = os.path.join("requirements", "full")

    if gpu_choice == "NVIDIA_CUDA128":
        file_name = "requirements.txt"
    elif gpu_choice == "AMD":
        file_name = "requirements_amd.txt"
    elif gpu_choice == "APPLE":
        file_name = f"requirements_apple_{'intel' if is_x86_64() else 'silicon'}.txt"
    elif gpu_choice in ["INTEL", "NONE"]:
        file_name = "requirements_cpu_only.txt"
    else:
        raise ValueError(f"Unknown GPU choice: {gpu_choice}")

    return os.path.join(requirements_base, file_name)


def get_current_commit():
    result = run_cmd("git rev-parse HEAD", capture_output=True, environment=True)
    return result.stdout.decode('utf-8').strip()


def get_extensions_names():
    return [foldername for foldername in os.listdir('extensions') if os.path.isfile(os.path.join('extensions', foldername, 'requirements.txt'))]


def check_env():
    # If we have access to conda, we are probably in an environment
    conda_exist = run_cmd("conda", environment=True, capture_output=True).returncode == 0
    if not conda_exist:
        print("Conda is not installed. Exiting...")

View on GitHub (pinned to ed888c71f2)

Solutions

  1. Update the choice to a currently supported value: NVIDIA_CUDA128, AMD, APPLE, INTEL, or NONE (CPU-only).
  2. If an old script/wrapper hardcodes the value, re-run the interactive installer to regenerate it, or edit the script to the new name.
  3. If calling programmatically, validate against the supported list before invoking and fail with a clear message.
  4. Check the repo's recent changelog for GPU-choice renames (CUDA 12.1 -> 12.8 transitions are a common cause).

Example fix

# before (stale wrapper)
cmd = f"python one_click.py --gpu NVIDIA"  # raises ValueError: Unknown GPU choice

# after
SUPPORTED = {"NVIDIA_CUDA128", "AMD", "APPLE", "INTEL", "NONE"}
assert gpu_choice in SUPPORTED, f'{gpu_choice} not supported; use one of {sorted(SUPPORTED)}'
cmd = f"python one_click.py --gpu {gpu_choice}"
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED_GPUS = {"NVIDIA_CUDA128", "AMD", "APPLE", "INTEL", "NONE"}

if gpu_choice not in SUPPORTED_GPUS:
    raise ValueError(f'Unsupported GPU choice {gpu_choice!r}; valid options: {sorted(SUPPORTED_GPUS)})')

Type guard

def is_supported_gpu_choice(choice: str) -> bool:
    return choice in {"NVIDIA_CUDA128", "AMD", "APPLE", "INTEL", "NONE"}

Try / catch

try:
    req_file = get_requirements_file(gpu_choice)
except ValueError as e:
    if 'Unknown GPU choice' in str(e):
        gpu_choice = 'NONE'  # or re-prompt interactively
        req_file = get_requirements_file(gpu_choice)
    else:
        raise

Prevention

When it happens

Trigger: Passing a GPU choice to the install path that isn't one of the enumerated strings: calling the installer function programmatically with 'NVIDIA' (pre-rename name), 'CUDA', an empty string, or a choice persisted by an older version of the script (e.g. saved 'NVIDIA_CUDA121' after the project moved to CUDA 12.8 wheels).

Common situations: Re-running an old start/command script that hardcodes a previous GPU choice name after upgrading the repo; environment files or wrappers caching a stale choice string; automated CI invoking one_click with a hand-typed value; project renamed CUDA variants between releases.

Related errors


AI-assisted analysis of oobabooga/textgen@ed888c71f2 (2026-08-15). Data as JSON: /api/errors/0c799f991f6b2e5b. Report an issue: GitHub.