Anonymous
Not applicable

@Sanjay Jain​ :

The error message suggests that there is not enough available memory on the GPU to allocate for the PyTorch model. This error can occur if the model is too large to fit into the available memory on the GPU, or if the GPU memory is being used by other processes in addition to the PyTorch model.

You can try to implement below and see what works for you

  • Can you try the brute force way of increasing the instance type with more memory
  • Try decreasing the batch size used for the PyTorch model. A smaller batch size would require less memory on the GPU, and may help avoid the out of memory error. You can experiment with different batch sizes to find the optimal trade-off between model performance and memory usage
  • Try to Set max_split_size_mb to a smaller value to avoid fragmentation
  • There is a DataParallel module in PyTorch, which allows you to distribute the model across multiple GPUs. This would help in running the PyTorch model on multiple GPUs in parallel

I hope all these suggestions help!

View solution in original post