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

Inference stuck in "Generating preview images for step 1" on single niftii file #104

Open
szaccount opened this issue Feb 15, 2025 · 8 comments

Comments

@szaccount
Copy link

When I run inference of the model on a single niftii file (on cpu only) it seems to be stuck indefinitely in step "Generating preview images for step 1".

Image

Image

Is it because its cpu only? I didn't see anything about it in the documentation.

Thanks in advance.

@NathanMolinier
Copy link
Collaborator

Hi @szaccount ! Thanks for testing our method ! If I understand correctly, it is running but it is taking an abnormal amount of time when you arrive at this step ?

It looks like it may be caused by the parallel processing. Could you rerun your code with the flag:

--max-workers 1

@szaccount
Copy link
Author

@NathanMolinier Yes, but also unlike the previous steps, in the step it is stuck in, it doesn't progress at all (stays on 0%).
I tried your suggestion but it had the same result, of no progress. Could it be that for large files, GPU option has to be activated in order to process the information?

@NathanMolinier
Copy link
Collaborator

That's strange indeed, personally I mostly use the GPU but it should also work with CPU. Let me try to reproduce the error. In the meantime, maybe you can try the integration of TotalSpineSeg inside the spinalcordtoolbox.

With the function sct_deepseg -task totalspineseg

@Volkopat
Copy link

+1
I have tested this with various studies on GPU mode, however while testing CPU, its always stuck when trying to generate previews.

@NathanMolinier
Copy link
Collaborator

I'm not able to reproduce the error unfortunately, what operating system are you using ? I tried on a linux machine and on my personal macos laptop and the inference worked in both cases with only cpu torch installation. I tried also with both python 3.9 and 3.10. Can you provide more information about your experiments ?

@szaccount
Copy link
Author

I am using Ubuntu 22.04 and python 3.10.12. Also, tried to run the line specified to install pytorch ("python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --upgrade") and now when tried to run inference, get the error:

Image

(in earlier stage then before - Generating preview images for input)

@NathanMolinier
Copy link
Collaborator

NathanMolinier commented Feb 24, 2025

This issue is actually raised by nnunet due to an error with the last pytorch 2.6 update. I will update the readme to account for this error. Could you reinstall pytorch with this command:

pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu118 --upgrade

I updated the command

@szaccount
Copy link
Author

Hey @NathanMolinier, indeed this solved the last bug but now it returned to the original problem of it being stuck indefinitely in "Generating preview images for step 1:" stage. Perhaps it is an issue of file size? Do you have an example for the input file you used that I will be able to experiment as well? Thanks.

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

3 participants