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

24GB graphics card memory is not enough #5

Open
Miraclerice opened this issue Jul 8, 2024 · 7 comments
Open

24GB graphics card memory is not enough #5

Miraclerice opened this issue Jul 8, 2024 · 7 comments

Comments

@Miraclerice
Copy link

Hello, I tried to use 3090 to run your network, and found that the video memory was insufficient. The picture size is the same. Is there any way to reduce the video memory usage? I see that your server is 4090, which is also 24GB. If you have time, please reply

@MungoMeng
Copy link
Owner

Please make sure that the "use_checkpoint" is set as "True".
Turning on the checkpoint function will reduce more than 50% GPU memory consumption.

@Miraclerice
Copy link
Author

Please make sure that the "use_checkpoint" is set as "True". Turning on the checkpoint function will reduce more than 50% GPU memory consumption.

Thank you very much for your answer. I keep the parameter setting of the network, 'use_checkpoint' defaults to True. Is there any other setting

use_checkpoint: bool = True):

@MungoMeng
Copy link
Owner

This might be because using the checkpointing function in 4090 can reduce more GPU memory than 3090.
Perhaps you can reduce the 'enc_channels' and 'dec_channels' a little bit.

@Miraclerice
Copy link
Author

Ok, I'll try. Thank you

@ZhaiJiaKai
Copy link

好的,我试试。谢谢

Hello, have you solved this problem? I also encountered the same problem when training. I used 4090

@2250432015
Copy link

Hello, I am currently engaged in training the CorrMLP model for medical image registration (OASIS dataset) on an NVIDIA RTX 3090. After several adjustments, I have managed to run the model with the parameters set to enc_channels: int = 8, dec_channels: int = 12, which allows the model to operate without running out of memory. However, as shown in the attached figure, these adjustments have had a significant impact on the model's accuracy.
image
image

I am seeking your expert advice on how to fine-tune the model to achieve a better balance between memory usage and accuracy. Specifically, I would like to know if there are recommended areas within the network structure that could be modified to reduce memory consumption without drastically affecting the model's performance.

@MungoMeng
Copy link
Owner

The default channel number settings are enc_channels: int = 8, dec_channels: int = 16 (as shown in Figure 1 in the paper) when using 24GB 4090 GPU. In these settings, our memory comsumption is ~20GB:
image
image

I am not sure why your model with enc_channels: int = 8, dec_channels: int = 12 has used 24GB memory. My PyTorch Version is 1.13 with Cuda 11.7, which might incur some differences when using checkpoint technique? Or do you use the images with size (144,192,160)? -- Larger size will result in more memory consumption.

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

4 participants