{"record":{"id":"0c799f991f6b2e5b","repo":"oobabooga/textgen","slug":"unknown-gpu-choice-gpu-choice","errorCode":null,"errorMessage":"Unknown GPU choice: {gpu_choice}","messagePattern":"Unknown GPU choice: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"one_click.py","lineNumber":160,"sourceCode":"        return f\"{base_cmd}--index-url https://download.pytorch.org/whl/xpu\"\n    else:\n        return base_cmd\n\n\ndef get_requirements_file(gpu_choice):\n    \"\"\"Get requirements file path based on GPU choice\"\"\"\n    requirements_base = os.path.join(\"requirements\", \"full\")\n\n    if gpu_choice == \"NVIDIA_CUDA128\":\n        file_name = \"requirements.txt\"\n    elif gpu_choice == \"AMD\":\n        file_name = \"requirements_amd.txt\"\n    elif gpu_choice == \"APPLE\":\n        file_name = f\"requirements_apple_{'intel' if is_x86_64() else 'silicon'}.txt\"\n    elif gpu_choice in [\"INTEL\", \"NONE\"]:\n        file_name = \"requirements_cpu_only.txt\"\n    else:\n        raise ValueError(f\"Unknown GPU choice: {gpu_choice}\")\n\n    return os.path.join(requirements_base, file_name)\n\n\ndef get_current_commit():\n    result = run_cmd(\"git rev-parse HEAD\", capture_output=True, environment=True)\n    return result.stdout.decode('utf-8').strip()\n\n\ndef get_extensions_names():\n    return [foldername for foldername in os.listdir('extensions') if os.path.isfile(os.path.join('extensions', foldername, 'requirements.txt'))]\n\n\ndef check_env():\n    # If we have access to conda, we are probably in an environment\n    conda_exist = run_cmd(\"conda\", environment=True, capture_output=True).returncode == 0\n    if not conda_exist:\n        print(\"Conda is not installed. Exiting...\")","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/oobabooga/textgen/blob/ed888c71f221df552750e1834b3654abab8ae345/one_click.py#L142-L178","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Update the choice to a currently supported value: NVIDIA_CUDA128, AMD, APPLE, INTEL, or NONE (CPU-only).","If an old script/wrapper hardcodes the value, re-run the interactive installer to regenerate it, or edit the script to the new name.","If calling programmatically, validate against the supported list before invoking and fail with a clear message.","Check the repo's recent changelog for GPU-choice renames (CUDA 12.1 -> 12.8 transitions are a common cause)."],"exampleFix":"# before (stale wrapper)\ncmd = f\"python one_click.py --gpu NVIDIA\"  # raises ValueError: Unknown GPU choice\n\n# after\nSUPPORTED = {\"NVIDIA_CUDA128\", \"AMD\", \"APPLE\", \"INTEL\", \"NONE\"}\nassert gpu_choice in SUPPORTED, f'{gpu_choice} not supported; use one of {sorted(SUPPORTED)}'\ncmd = f\"python one_click.py --gpu {gpu_choice}\"","handlingStrategy":"type-guard","validationCode":"SUPPORTED_GPUS = {\"NVIDIA_CUDA128\", \"AMD\", \"APPLE\", \"INTEL\", \"NONE\"}\n\nif gpu_choice not in SUPPORTED_GPUS:\n    raise ValueError(f'Unsupported GPU choice {gpu_choice!r}; valid options: {sorted(SUPPORTED_GPUS)})')","typeGuard":"def is_supported_gpu_choice(choice: str) -> bool:\n    return choice in {\"NVIDIA_CUDA128\", \"AMD\", \"APPLE\", \"INTEL\", \"NONE\"}","tryCatchPattern":"try:\n    req_file = get_requirements_file(gpu_choice)\nexcept ValueError as e:\n    if 'Unknown GPU choice' in str(e):\n        gpu_choice = 'NONE'  # or re-prompt interactively\n        req_file = get_requirements_file(gpu_choice)\n    else:\n        raise","preventionTips":["After pulling upstream updates, check for renamed GPU choices before re-running saved install commands.","Regenerate start scripts with the current installer instead of hand-editing GPU choice strings.","Validate the choice against the supported set at the top of any automated install script."],"tags":["installation","gpu","configuration","startup"],"backgroundTag":null,"analyzedSha":"ed888c71f221df552750e1834b3654abab8ae345","analyzedAt":"2026-08-15T05:24:21.000Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}