Skip to content

Commit

Permalink
Add GPU selection to installer (#468)
Browse files Browse the repository at this point in the history
* Add GPU choice to installation options

* Allow users to force CPU mode via config.json

* Allow frontend to set cpu startup setting

* Allow frontend to restart the python server

* Use detected GPU to pre-select install options

* Allow frontend to confirm which platform it is on

* Add error wrapping for frontend settings checks

* Allow frontend to see last validated GPU

* Configure user-selected pytorch variant

* Remove risk of IPC async context issues

Removes non-async promise return from handlers at edge of IPC (where future changes may result in race conditions).

* Save CPU startup mode if picked during install

* Sync removed pkgs from CPU compiled reqs

* Remove circular dependency

Allows desktop change to be merged prior to frontend changes for this feature.

* Rename for clarity

* Rename for clarity

* Remove CPU mode bypasses hardware validation

* Remove CPU mode as a separate flag

Was duplication leftover from initial, unmerged design.
Now handled by launch args & selectedDevice only.

* Replace CPU mode launch override with launch args
  • Loading branch information
webfiltered authored Dec 14, 2024
1 parent b0fef40 commit e251941
Show file tree
Hide file tree
Showing 9 changed files with 480 additions and 17 deletions.
340 changes: 340 additions & 0 deletions assets/requirements/windows_cpu.compiled
Original file line number Diff line number Diff line change
@@ -0,0 +1,340 @@
# This file was autogenerated by uv via the following command:
# uv pip compile C:\source\desktop\assets\ComfyUI\requirements.txt C:\source\desktop\assets\ComfyUI\custom_nodes\ComfyUI-Manager\requirements.txt --emit-index-annotation --emit-index-url --index-strategy unsafe-best-match --override C:\source\desktop\assets\override.txt -o C:\source\desktop\assets\requirements.cpu.compiled
--index-url https://pypi.org/simple

aiohappyeyeballs==2.4.3
# via
# --override assets/override.txt
# aiohttp
# from https://pypi.org/simple
aiohttp==3.11.7
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
aiosignal==1.3.1
# via
# --override assets/override.txt
# aiohttp
# from https://pypi.org/simple
attrs==24.2.0
# via
# --override assets/override.txt
# aiohttp
# from https://pypi.org/simple
certifi==2024.8.30
# via
# --override assets/override.txt
# requests
# from https://pypi.org/simple
cffi==1.17.1
# via
# --override assets/override.txt
# cryptography
# pynacl
# soundfile
# from https://pypi.org/simple
charset-normalizer==3.4.0
# via
# --override assets/override.txt
# requests
# from https://pypi.org/simple
click==8.1.7
# via typer
# from https://pypi.org/simple
colorama==0.4.6
# via
# --override assets/override.txt
# click
# tqdm
# from https://pypi.org/simple
cryptography==44.0.0
# via pyjwt
# from https://pypi.org/simple
deprecated==1.2.15
# via pygithub
# from https://pypi.org/simple
einops==0.8.0
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# spandrel
# from https://pypi.org/simple
filelock==3.16.1
# via
# --override assets/override.txt
# huggingface-hub
# torch
# transformers
# from https://pypi.org/simple
frozenlist==1.5.0
# via
# --override assets/override.txt
# aiohttp
# aiosignal
# from https://pypi.org/simple
fsspec==2024.10.0
# via
# --override assets/override.txt
# huggingface-hub
# torch
# from https://pypi.org/simple
gitdb==4.0.11
# via gitpython
# from https://pypi.org/simple
gitpython==3.1.43
# via -r assets/ComfyUI/custom_nodes/ComfyUI-Manager/requirements.txt
# from https://pypi.org/simple
huggingface-hub==0.26.2
# via
# --override assets/override.txt
# -r assets/ComfyUI/custom_nodes/ComfyUI-Manager/requirements.txt
# tokenizers
# transformers
# from https://pypi.org/simple
idna==3.10
# via
# --override assets/override.txt
# requests
# yarl
# from https://pypi.org/simple
jinja2==3.1.4
# via
# --override assets/override.txt
# torch
# from https://pypi.org/simple
kornia==0.7.4
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
kornia-rs==0.1.7
# via
# --override assets/override.txt
# kornia
# from https://pypi.org/simple
markdown-it-py==3.0.0
# via rich
# from https://pypi.org/simple
markupsafe==3.0.2
# via
# --override assets/override.txt
# jinja2
# from https://pypi.org/simple
mdurl==0.1.2
# via markdown-it-py
# from https://pypi.org/simple
mpmath==1.3.0
# via
# --override assets/override.txt
# sympy
# from https://pypi.org/simple
multidict==6.1.0
# via
# --override assets/override.txt
# aiohttp
# yarl
# from https://pypi.org/simple
networkx==3.4.2
# via
# --override assets/override.txt
# torch
# from https://pypi.org/simple
numpy==2.1.3
# via
# --override assets/override.txt
# scipy
# spandrel
# torchsde
# torchvision
# transformers
# from https://pypi.org/simple
packaging==24.2
# via
# --override assets/override.txt
# huggingface-hub
# kornia
# transformers
# from https://pypi.org/simple
pillow==11.0.0
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# torchvision
# from https://pypi.org/simple
propcache==0.2.0
# via
# --override assets/override.txt
# aiohttp
# yarl
# from https://pypi.org/simple
psutil==6.1.0
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
pycparser==2.22
# via
# --override assets/override.txt
# cffi
# from https://pypi.org/simple
pygithub==2.5.0
# via -r assets/ComfyUI/custom_nodes/ComfyUI-Manager/requirements.txt
# from https://pypi.org/simple
pygments==2.18.0
# via rich
# from https://pypi.org/simple
pyjwt==2.10.1
# via pygithub
# from https://pypi.org/simple
pynacl==1.5.0
# via pygithub
# from https://pypi.org/simple
pyyaml==6.0.2
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# huggingface-hub
# transformers
# from https://pypi.org/simple
regex==2024.11.6
# via
# --override assets/override.txt
# transformers
# from https://pypi.org/simple
requests==2.32.3
# via
# --override assets/override.txt
# huggingface-hub
# pygithub
# transformers
# from https://pypi.org/simple
rich==13.9.4
# via
# -r assets/ComfyUI/custom_nodes/ComfyUI-Manager/requirements.txt
# typer
# from https://pypi.org/simple
safetensors==0.4.5
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# spandrel
# transformers
# from https://pypi.org/simple
scipy==1.14.1
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# torchsde
# from https://pypi.org/simple
sentencepiece==0.2.0
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
setuptools==75.6.0
# via
# --override assets/override.txt
# torch
# from https://pypi.org/simple
shellingham==1.5.4
# via typer
# from https://pypi.org/simple
smmap==5.0.1
# via gitdb
# from https://pypi.org/simple
soundfile==0.12.1
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
spandrel==0.4.0
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
sympy==1.13.1
# via
# --override assets/override.txt
# torch
# from https://pypi.org/simple
tokenizers==0.20.3
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# transformers
# from https://pypi.org/simple
torch==2.5.1
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# kornia
# spandrel
# torchaudio
# torchsde
# torchvision
# from https://pypi.org/simple
torchaudio==2.5.1
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
torchsde==0.2.6
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
torchvision==0.20.1
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# spandrel
# from https://pypi.org/simple
tqdm==4.67.1
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# huggingface-hub
# transformers
# from https://pypi.org/simple
trampoline==0.1.2
# via
# --override assets/override.txt
# torchsde
# from https://pypi.org/simple
transformers==4.46.3
# via
# --override assets/override.txt
# -r assets/ComfyUI/custom_nodes/ComfyUI-Manager/requirements.txt
# -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
typer==0.13.1
# via -r assets/ComfyUI/custom_nodes/ComfyUI-Manager/requirements.txt
# from https://pypi.org/simple
typing-extensions==4.12.2
# via
# --override assets/override.txt
# -r assets/ComfyUI/custom_nodes/ComfyUI-Manager/requirements.txt
# gitpython
# huggingface-hub
# multidict
# pygithub
# rich
# spandrel
# torch
# typer
# from https://pypi.org/simple
urllib3==2.2.3
# via
# --override assets/override.txt
# pygithub
# requests
# from https://pypi.org/simple
wrapt==1.17.0
# via deprecated
# from https://pypi.org/simple
yarl==1.18.0
# via
# --override assets/override.txt
# aiohttp
# from https://pypi.org/simple
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const IPC_CHANNELS = {
SHOW_DIRECTORY_PICKER: 'show-directory-picker',
INSTALL_COMFYUI: 'install-comfyui',
SHOW_CONTEXT_MENU: 'show-context-menu',
RESTART_CORE: 'restart-core',
GET_GPU: 'get-gpu',
} as const;

export enum ProgressStatus {
Expand Down
6 changes: 6 additions & 0 deletions src/install/installWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ export class InstallWizard {
'Comfy-Desktop.AutoUpdate': this.installOptions.autoUpdate,
'Comfy-Desktop.SendStatistics': this.installOptions.allowMetrics,
};

if (this.installOptions.device === 'cpu') {
settings['Comfy.Server.LaunchArgs'] ??= {};
settings['Comfy.Server.LaunchArgs']['cpu'] = '';
}

const settingsJson = JSON.stringify(settings, null, 2);
fs.writeFileSync(settingsPath, settingsJson);
log.info(`Wrote settings to ${settingsPath}: ${settingsJson}`);
Expand Down
Loading

0 comments on commit e251941

Please sign in to comment.