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

Running on Mac M1 Max #3

Open
mattdesl opened this issue Oct 17, 2023 · 2 comments
Open

Running on Mac M1 Max #3

mattdesl opened this issue Oct 17, 2023 · 2 comments

Comments

@mattdesl
Copy link

mattdesl commented Oct 17, 2023

I have a MBP M1 Max that should be able to run this (in theory) using the mps backend but am struggling. By default, the diffvg is being run with use_gpu=True hardcoded inside diffsketcher_pipeline.py (init_diffvg call). There is no CUDA support in diffvg, and it doesn't seem easy to just have diffvg use the mps device (if you know a way, that would be very helpful). After setting this variable to False so that diffvg is initialized with CPU, I get another error that the model expects all tensors to use the same device (now that the first step uses mps and the second uses cpu).

To fix, I can pass -cpu flag when running the main python script, but then the image is generated extremely slowly. Can we somehow make it use mps for the first phase, then switch device to cpu for remainder of work if CUDA is not supported?

EDIT: It seems there is some memory constraint that occurs when trying to use a full -cpu pipeline, as it just faults and stops without a clear error. My next question would be, perhaps we could split the work up: first I run the mps phase for generating the image, then I re-run a new script to run the second phase with model set to a new cpu device for diffvg.

@ximinng
Copy link
Owner

ximinng commented Oct 18, 2023

HI, mattdesl,

Sorry, I haven't used diffvg with mps backend on Mac either, so I may not be able to advise you on that.
Regarding the use of CPU interrupts, it is possible that your program is being killed or interrupted due to excessive memory usage.
I have conducted experiments on the A800 and V100, and there should be no issues with these devices. I recommend that you run our algorithm on a machine with an Nvidia GPU.

Have a nice day~

@ximinng
Copy link
Owner

ximinng commented Mar 25, 2024

try docker

docker run --name svgdreamer --gpus all -it --ipc=host ximingxing/svgrender:v1 /bin/bash

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

No branches or pull requests

2 participants