How much host RAM does htop or any other tool report?
As the error message suggest, PyTorch cannot allocate the ~500MB of RAM, so I guess you might be indeed running out of memory or the process is not allowed to allocate more RAM for some reason.