with torch.no_grad() will save some memory during evaluation and testing, but you won’t be able to train the model.
4GB won’t be enough for a lot of common models, so you would either have to use a cloud runtime (e.g. Colab, Kaggle, or any cloud provider) or buy a bigger device.