Skip to content

Commit

Permalink
simplify standalone command by removing redundant gpu options
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Aug 27, 2024
1 parent 577fdfc commit 9f1bda2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 82 deletions.
80 changes: 1 addition & 79 deletions comfy_cli/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,48 +568,6 @@ def standalone(
help="Create standalone Python for specified processor",
),
] = None,
nvidia: Annotated[
Optional[bool],
typer.Option(
show_default=False,
help="Create standalone Python for Nvidia gpu",
callback=g_gpu_exclusivity.validate,
),
] = None,
cuda_version: Annotated[CUDAVersion, typer.Option(show_default=True)] = CUDAVersion.v12_1,
amd: Annotated[
Optional[bool],
typer.Option(
show_default=False,
help="Create standalone Python for AMD gpu",
callback=g_gpu_exclusivity.validate,
),
] = None,
m_series: Annotated[
Optional[bool],
typer.Option(
show_default=False,
help="Create standalone Python for Mac M-Series gpu",
callback=g_gpu_exclusivity.validate,
),
] = None,
intel_arc: Annotated[
Optional[bool],
typer.Option(
hidden=True,
show_default=False,
help="(Beta support) Create standalone Python for Intel Arc gpu, based on https://github.com/comfyanonymous/ComfyUI/pull/3439",
callback=g_gpu_exclusivity.validate,
),
] = None,
cpu: Annotated[
Optional[bool],
typer.Option(
show_default=False,
help="Create standalone Python for CPU",
callback=g_gpu_exclusivity.validate,
),
] = None,
rehydrate: Annotated[
bool,
typer.Option(
Expand All @@ -623,48 +581,12 @@ def standalone(
platform = utils.get_os() if platform is None else platform
proc = utils.get_proc() if proc is None else proc

if cpu:
gpu = GPU_OPTION.CPU
elif nvidia:
gpu = GPU_OPTION.NVIDIA
elif amd:
gpu = GPU_OPTION.AMD
elif m_series:
gpu = GPU_OPTION.MAC_M_SERIES
elif intel_arc:
gpu = GPU_OPTION.INTEL_ARC
else:
if platform == constants.OS.MACOS:
gpu = ui.prompt_select_enum(
"What type of Mac do you have?",
[GPU_OPTION.MAC_M_SERIES, GPU_OPTION.MAC_INTEL],
)
else:
gpu = ui.prompt_select_enum(
"What GPU do you have?",
[GPU_OPTION.NVIDIA, GPU_OPTION.AMD, GPU_OPTION.INTEL_ARC, GPU_OPTION.CPU],
)

if gpu == GPU_OPTION.INTEL_ARC:
print("[bold yellow]Installing on Intel ARC is not yet completely supported[/bold yellow]")
env_check = env_checker.EnvChecker()
if env_check.conda_env is None:
print("[bold red]Intel ARC support requires conda environment to be activated.[/bold red]")
raise typer.Exit(code=1)
if intel_arc is None:
confirm_result = ui.prompt_confirm_action(
"Are you sure you want to try beta install feature on Intel ARC?", True
)
if not confirm_result:
raise typer.Exit(code=0)
print("[bold yellow]Installing on Intel ARC is in beta stage.[/bold yellow]")

if rehydrate:
sty = StandalonePython.FromTarball(fpath="python.tgz")
sty.rehydrate_comfy_deps()
else:
sty = StandalonePython.FromDistro(platform=platform, proc=proc)
sty.dehydrate_comfy_deps(comfyDir=comfy_path, gpu=gpu, extraSpecs=cli_spec)
sty.dehydrate_comfy_deps(comfyDir=comfy_path, extraSpecs=cli_spec)
sty.to_tarball()


Expand Down
4 changes: 1 addition & 3 deletions comfy_cli/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from rich.progress import Progress, TextColumn
from rich.table import Table

from comfy_cli.constants import GPU_OPTION, OS, PROC
from comfy_cli.constants import OS, PROC
from comfy_cli.typing import PathLike
from comfy_cli.utils import download_progress, get_os, get_proc
from comfy_cli.uv import DependencyCompiler
Expand Down Expand Up @@ -152,13 +152,11 @@ def install_comfy(self, *args: list[str], gpu_arg: str = "--nvidia"):
def dehydrate_comfy_deps(
self,
comfyDir: PathLike,
gpu: GPU_OPTION,
extraSpecs: Optional[list[str]] = None,
):
self.dep_comp = DependencyCompiler(
cwd=comfyDir,
executable=self.executable,
gpu=gpu,
outDir=self.rpath,
extraSpecs=extraSpecs,
)
Expand Down

0 comments on commit 9f1bda2

Please sign in to comment.