Out of memory error with ChemGPT-1.2B #56
Replies: 2 comments 2 replies
-
Hello @PatWalters, for I conducted some small tests and you would need a minimum of 25GB of GPU memory. Although the model itself can fit on your GPU, additional memory space is needed during training for data, model output, optimizer states, gradients, etc. (You can find a great explanation here: https://huggingface.co/docs/transformers/perf_train_gpu_one) The tutorial snippet can be optimized in the following ways: 1. Instead of padding the entire dataset, pad the inputs during batching to reduce the amount of padding and overall GPU memory usage. I have made some modifications to your gist to implement (1) and utilize PyTorch Lightning, which makes investigating (2) and (3) easier. You can find the modified version here: https://gist.github.com/maclandrol/8bd3e50cdfc345fa095e7c96bc3643b3 As a side note, we have recently added two new models ( featurizer = PretrainedHFTransformer("GPT2-Zinc480M-87M", notation="smiles", dtype=torch.float, preload=True) A quick test without any tuning for |
Beta Was this translation helpful? Give feedback.
-
Thank you! I'll give that a try. |
Beta Was this translation helpful? Give feedback.
-
I've been trying to use ChemGPT-1.2B, but I get an out of memory error. Can someone show me the trick to running ChemGPT-1.2B on a GPU without running out of memory? I put together a gist with an example of what I've been doing. The code is a minor modification of the molfeat "Finetuning a pretrained transformer" example.
https://gist.github.com/PatWalters/63caca95bfc808fa7580df2a3bb525b2
Beta Was this translation helpful? Give feedback.
All reactions