Skip to content

Update subcore.py#35

Open
harmeetsingh-work wants to merge 1 commit into
ltdrdata:mainfrom
harmeetsingh-work:patch-1
Open

Update subcore.py#35
harmeetsingh-work wants to merge 1 commit into
ltdrdata:mainfrom
harmeetsingh-work:patch-1

Conversation

@harmeetsingh-work

Copy link
Copy Markdown

Making it compatible with apple silicon.

Making it compatible with apple silicon.

@ltdrdata ltdrdata left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch affects not only the functionality used in subpack but also impacts all instances of torch.load across ComfyUI.

It seems appropriate to conditionally call with map_location only when it is silicon.

https://github.com/ltdrdata/ComfyUI-Impact-Subpack/blob/74db20c95eca152a6d686c914edc0ef4e4762cb8/modules/subcore.py#L139C5-L139C18

@harmeetsingh-work

Copy link
Copy Markdown
Author

@ltdrdata the code change:

device = torch.device("mps" if torch.backends.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu")
orig_torch_load = torch.load(map_location=device)

It loads 'mps' if mps(apple silicon) is available else 'cuda' if cuda is available else it will use 'cpu'.

@ltdrdata

ltdrdata commented Mar 9, 2025

Copy link
Copy Markdown
Owner

It loads 'mps' if mps(apple silicon) is available else 'cuda' if cuda is available else it will use 'cpu'.

If it is not MPS, no device should be applied. It should be determined by the callsite.
Therefore, it should not be applied to orig_torch_load.

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.

2 participants