OK, so it shouldn’t be a “scope” issue.
What happens if you swap the training and validation calls? If you are also running OOM, this would mean that the validation call uses too much memory and there wouldn’t be any interaction with the training loop.