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

OutOfMemoryError when trying to fine-tune llama3.1 #25

Open
korneevm opened this issue Aug 6, 2024 · 5 comments
Open

OutOfMemoryError when trying to fine-tune llama3.1 #25

korneevm opened this issue Aug 6, 2024 · 5 comments

Comments

@korneevm
Copy link

korneevm commented Aug 6, 2024

Hi Phil, thanks for the great repo and examples!

Everything worked well when I played with llama3-70b using your guide, but now I'm stuck when fine-tuning llama3.1-70b.

I've done all the steps from the https://www.philschmid.de/sagemaker-train-deploy-llama3 article and then managed to fix problems with incompatible package versions and start the training process. But on the "Loading checkpoint shards" step I'm getting an error:

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 3.91 GiB. GPU 2 has a total capacty of 39.39 GiB of which 1.05 GiB is free. Including non-PyTorch memory, this process has 0 bytes memory in use. Of the allocated memory 36.82 GiB is allocated by PyTorch, and 109.46 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

I've tried to overcome this problem but no success. Maybe you could point out what I'm missing.

@philschmid
Copy link
Owner

what instance are you trying to use?

@korneevm
Copy link
Author

korneevm commented Aug 6, 2024

ml.p4d.24xlarge like in tutorial

@korneevm
Copy link
Author

korneevm commented Aug 9, 2024

I've tried using ml.p4de.24xlarge for training and it worked well. I've had to make some minor adjustments in code - I can make PR if you are interested

@philschmid
Copy link
Owner

Yes could you share what you needed to change?

@imadoualid
Copy link

@korneevm can u share your changes plz ?

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