For some reason, this problem was resolved when I switched to running an instance with TensorFlow 2.3 instead of 2.7.