Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: MAC_M_SERIES enum not found #161

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions comfy_cli/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,14 @@ def install(
elif amd:
gpu = GPU_OPTION.AMD
elif m_series:
gpu = GPU_OPTION.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.M_SERIES, GPU_OPTION.MAC_INTEL],
[GPU_OPTION.MAC_M_SERIES, GPU_OPTION.MAC_INTEL],
)
else:
gpu = ui.prompt_select_enum(
Expand Down Expand Up @@ -616,14 +616,14 @@ def standalone(
elif amd:
gpu = GPU_OPTION.AMD
elif m_series:
gpu = GPU_OPTION.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.M_SERIES, GPU_OPTION.MAC_INTEL],
[GPU_OPTION.MAC_M_SERIES, GPU_OPTION.MAC_INTEL],
)
else:
gpu = ui.prompt_select_enum(
Expand Down
2 changes: 1 addition & 1 deletion comfy_cli/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def pip_install_comfyui_dependencies(
result = subprocess.run([sys.executable, "-m", "pip", "install", "torch-directml"], check=True)

# install torch for Mac M Series
if gpu == GPU_OPTION.M_SERIES:
if gpu == GPU_OPTION.MAC_M_SERIES:
result = subprocess.run(
[
sys.executable,
Expand Down
2 changes: 1 addition & 1 deletion comfy_cli/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class GPU_OPTION(str, Enum):
NVIDIA = "nvidia"
AMD = "amd"
INTEL_ARC = "intel_arc"
M_SERIES = "mac_m_series"
MAC_M_SERIES = "mac_m_series"
MAC_INTEL = "mac_intel"


Expand Down
12 changes: 7 additions & 5 deletions comfy_cli/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import requests

from comfy_cli.constants import OS, PROC
from comfy_cli.constants import GPU_OPTION, 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 @@ -92,6 +92,8 @@ def FromTarball(fpath: PathLike, name: PathLike = "python"):

old_rpath = fpath.parent / old_name
rpath = fpath.parent / name
# clean the expanded destination
shutil.rmtree(rpath, ignore_errors=True)
shutil.move(old_rpath, rpath)
return StandalonePython(rpath=rpath)

Expand Down Expand Up @@ -138,25 +140,25 @@ def run_comfy_cli(self, *args: list[str]):
def install_comfy(self, *args: list[str], gpu_arg: str = "--nvidia"):
self.run_comfy_cli("--here", "--skip-prompt", "install", "--fast-deps", gpu_arg, *args)

def compile_comfy_deps(self, comfyDir: PathLike, gpu: str, outDir: Optional[PathLike] = None):
def compile_comfy_deps(self, comfyDir: PathLike, gpu: GPU_OPTION, outDir: Optional[PathLike] = None):
outDir = self.rpath if outDir is None else outDir

self.dep_comp = DependencyCompiler(cwd=comfyDir, executable=self.executable, gpu=gpu, outDir=outDir)
self.dep_comp.compile_comfy_deps()

def install_comfy_deps(self, comfyDir: PathLike, gpu: str, outDir: Optional[PathLike] = None):
def install_comfy_deps(self, comfyDir: PathLike, gpu: GPU_OPTION, outDir: Optional[PathLike] = None):
outDir = self.rpath if outDir is None else outDir

self.dep_comp = DependencyCompiler(cwd=comfyDir, executable=self.executable, gpu=gpu, outDir=outDir)
self.dep_comp.install_core_plus_ext()

def precache_comfy_deps(self, comfyDir: PathLike, gpu: str, outDir: Optional[PathLike] = None):
def precache_comfy_deps(self, comfyDir: PathLike, gpu: GPU_OPTION, outDir: Optional[PathLike] = None):
outDir = self.rpath if outDir is None else outDir

self.dep_comp = DependencyCompiler(cwd=comfyDir, executable=self.executable, gpu=gpu, outDir=outDir)
self.dep_comp.precache_comfy_deps()

def wheel_comfy_deps(self, comfyDir: PathLike, gpu: str, outDir: Optional[PathLike] = None):
def wheel_comfy_deps(self, comfyDir: PathLike, gpu: GPU_OPTION, outDir: Optional[PathLike] = None):
outDir = self.rpath if outDir is None else outDir

self.dep_comp = DependencyCompiler(cwd=comfyDir, executable=self.executable, gpu=gpu, outDir=outDir)
Expand Down
6 changes: 2 additions & 4 deletions comfy_cli/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def Wheel(
return _check_call(cmd, cwd)

@staticmethod
def Resolve_Gpu(gpu: Union[GPU_OPTION, str, None]):
def Resolve_Gpu(gpu: Union[GPU_OPTION, None]):
if gpu is None:
try:
tver = metadata.version("torch")
Expand All @@ -277,16 +277,14 @@ def Resolve_Gpu(gpu: Union[GPU_OPTION, str, None]):
return None
except metadata.PackageNotFoundError:
return None
elif isinstance(gpu, str):
return GPU_OPTION[gpu.upper()]
else:
return gpu

def __init__(
self,
cwd: PathLike = ".",
executable: PathLike = sys.executable,
gpu: Union[GPU_OPTION, str, None] = None,
gpu: Union[GPU_OPTION, None] = None,
outDir: PathLike = ".",
outName: str = "requirements.compiled",
reqFilesCore: Optional[list[PathLike]] = None,
Expand Down
Loading