Skip to content

feat: add custom PyTorch index URL override#133

Open
Pfannkuchensack wants to merge 1 commit into
invoke-ai:mainfrom
Pfannkuchensack:feat/custom-torch-index-url
Open

feat: add custom PyTorch index URL override#133
Pfannkuchensack wants to merge 1 commit into
invoke-ai:mainfrom
Pfannkuchensack:feat/custom-torch-index-url

Conversation

@Pfannkuchensack

Copy link
Copy Markdown

Why

The launcher derives the PyTorch index URL from InvokeAI's pins.json. That file exposes only a single cuda (and rocm/cpu) entry per platform, so every Nvidia GPU tier collapses onto the same index (currently cu128). This causes two real problems the pins can't cover:

  • Older Nvidia GPUs (e.g. 20xx): the pinned cu128 build doesn't work for them, so users have to manually reinstall a compatible torch build after every update — the launcher overwrites it each time with --force-reinstall.
  • AMD on Windows: pins.json provides no rocm index for win32, so the installer silently falls back to the default PyPI index and installs a non-working (CUDA/CPU) build. There is no official ROCm-on-Windows wheel index the launcher could ship as a default.

This PR adds an advanced escape hatch: a user-settable, persisted PyTorch index URL that overrides the pinned one for all installs and updates. The user takes responsibility for providing a working URL.

What changed

  • New "Custom PyTorch Index URL" setting in the Settings modal, persisted in the electron-store (customTorchIndexUrl). Empty = use Invoke's default (unchanged behavior).
  • InstallManager uses the override in place of the pins-derived index when set, and logs a clear notice when the override is active.
  • The hint text makes the limitation explicit: this only changes the index/build — the torch version is still pinned by the invokeai package.

How to test

  1. Run the launcher in dev (npm run dev).
  2. Open Settings. Confirm a new "Custom PyTorch Index URL" field appears with the warning hint.
  3. Persistence / clearing:
    • Enter a value (e.g. https://download.pytorch.org/whl/cu126), click elsewhere to blur, close and reopen Settings → the value persists.
    • Clear the field and blur → it is removed
  4. Override is applied: start an install/reinstall and watch the install log. With the field set you should see:
    • the magenta line Custom torch index URL override is active (set in Settings): <url>
    • the install command using --index=<your-url> instead of the pinned one.
  5. Default path unchanged: clear the field, start an install again → the log shows the index from pins.json (e.g. cu128) and no override line.
  6. AMD on Windows gap: select the AMD GPU type on Windows with the field empty → log shows Using torch index: default (the pre-existing gap). Set a working ROCm-Windows wheel index in the field → the install now uses it.

Add an optional, persisted "Custom PyTorch Index URL" setting that
overrides the torch index URL derived from Invoke's pins for all
installs and updates.

This is an advanced escape hatch for cases the pins can't cover:
- Older Nvidia GPUs (e.g. 20xx) that need a different CUDA build than
  the pinned cu128 default.
- AMD on Windows, where the pins provide no rocm index at all and the
  installer would otherwise silently fall back to the default index.

The override only changes the index/build - the torch version is still
pinned by the invokeai package, which is reflected in the settings hint.

Also fix the store:set-key IPC handler to delete a key when its value is
undefined instead of calling store.set(key, undefined), which throws in
electron-store ("Use delete() to clear values"). This also fixes clearing
the existing installDir key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant