tensorflow memory_error ai_generated true

ResourceExhaustedError: OOM when allocating tensor

ID: tensorflow/oom-gpu

Also available as: JSON · Markdown
80%Fix Rate
85%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2 active

Root Cause

GPU memory exhausted during training or inference.

generic

Workarounds

  1. 90% success Enable memory growth: tf.config.experimental.set_memory_growth(gpu,True)
  2. 88% success Reduce batch size or model size

Dead Ends

Common approaches that don't work:

  1. Set allow_growth=False with pre-allocated 100% 75% fail

    Other processes cant use GPU

  2. Move to CPU entirely 70% fail

    Orders of magnitude slower