nanoGPT icon indicating copy to clipboard operation
nanoGPT copied to clipboard

finetuning - Out of Memory Error

Open Xiaoshan-jun opened this issue 1 year ago • 2 comments

I tried to run the finetuning by

$ python train.py config/finetune_shakespeare.py

Seems like finetune requires a lot of memory. Is there anyway to lower the memory requirement. The batch size is already 1.

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 100.00 MiB (GPU 0; 23.68 GiB total capacity; 21.67 GiB already allocated; 85.06 MiB free; 21.92 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Xiaoshan-jun avatar Mar 15 '23 21:03 Xiaoshan-jun

Your GPU memory is too small, suggest to switch to CPU.

judyhappy avatar Mar 20 '23 09:03 judyhappy

For test, you may use smaller model (gpt2-large).

ramiil avatar Mar 20 '23 13:03 ramiil