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

cannot get_mask when I vary the cuda device #6

Closed
ada-cheng opened this issue Oct 14, 2023 · 3 comments
Closed

cannot get_mask when I vary the cuda device #6

ada-cheng opened this issue Oct 14, 2023 · 3 comments

Comments

@ada-cheng
Copy link

Hello Junyi, GREAT JOB! It seems that everything works well when calling get_features in extractor_sd.py using cuda:3
but the inference process failed even I change
def inference(model, aug, image, vocab, label_list):
from
demo = StableDiffusionSeg(inference_model, demo_metadata, aug)

pred = demo.predict(np.array(image))
to
demo = StableDiffusionSeg(inference_model, demo_metadata, aug)

demo.model = demo.model.to(torch.device("cuda:3"))

pred = demo.predict(np.array(image))

I guess the main problem lies in wrongly loading the decoder part of the model, but I'm not sure how to fix it.

@ada-cheng
Copy link
Author

ada-cheng commented Oct 14, 2023

also I guess I loaded the model to the expected cuda
model, aug = load_model(diffusion_ver=VER, image_size=SIZE, num_timesteps=TIMESTEP, block_indices=tuple(INDICES), decoder_only=False)
model = model.to(device)
since I have added these lines in the pck_spair_pascal file.

@Junyi42
Copy link
Owner

Junyi42 commented Oct 14, 2023

Hi, thanks for the interest in our work!

Interestingly, I met a similar problem when I first played with the ODISE repo😂. And here's the issue I raised in their repo. I ended up getting around this problem by setting the CUDA_VISIBLE_DEVICES instead of the torch.to(device) (e.g., you can add another line os.environ["CUDA_VISIBLE_DEVICES"]=3 on top of the script). Hopefully it could be helpful for you.

Best,
Junyi

@ada-cheng
Copy link
Author

ada-cheng commented Oct 14, 2023

image

Great! I've successfully obtained the rainbow mask. I'm truly grateful for your assistance.

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