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

CUDA out of memory on Google Colab when trying to run beginners notebook #136

Open
mithril9 opened this issue Dec 10, 2023 · 3 comments
Open

Comments

@mithril9
Copy link

Hi,

I keep getting

OutOfMemoryError: CUDA out of memory. Tried to allocate 508.00 MiB. GPU 0 has a total capacty of 15.77 GiB of which 30.12 MiB is free. Process 44331 has 15.74 GiB memory in use. Of the allocated memory 14.89 GiB is allocated by PyTorch, and 1.11 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

When trying to run

model = AutoModel.from_pretrained( model_name, quantization_config=q_config, trust_remote_code=True, device='cuda' )

I have paid for 100 compute units and am using A100 GPU as the session type. I also tried changing the batch size from 4 to 1 but that didn't help.

@mithril9
Copy link
Author

The above is when trying to run your beginners Colab notebook.

@mithril9 mithril9 changed the title CUDA out of memory on Google Colab when trying to run notebook CUDA out of memory on Google Colab when trying to run beginners notebook Dec 10, 2023
@Weiyao-Li
Copy link
Member

Please try to reduce batch size or torch.cuda.empty_cache() to adjust. You can also use nvidia-smi to oversee what's going on and adjust the model based on your GPU. I ran the beginner script before. You may also refer to my repo and articles here:https://github.com/AI4Finance-Foundation/FinGPT-Research. Hope this will help.

@edwarts
Copy link

edwarts commented Jun 20, 2024

I have the same issue when running on my 4090, out of memory.

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