Someone had the same issue with a very similar torch version (2.2.1), and the fix seems to be to upgrade to torch>=2.3: https://github.com/pytorch/pytorch/issues/126632#issuecomment-2119140224