
Answer-first summary for fast verification
Answer: Decrease the batch size to reduce memory consumption during training, accepting a potential increase in training time., Resize the input images to smaller dimensions to lessen memory load, which may slightly reduce the model's accuracy.
The 'ResourceExhaustedError: Out Of Memory (OOM)' error indicates the model is attempting to use more GPU memory than is available. The most straightforward and cost-effective solutions are to reduce the batch size (B) and resize the input images (D). Reducing the batch size decreases the number of samples processed simultaneously, lowering memory demand. Resizing images reduces the memory needed per image. While upgrading the GPU (A) or changing optimizers (C) might help, they are less direct or more costly solutions. Gradient checkpointing (E) is a more advanced technique that may not be necessary if simpler solutions suffice.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You are tasked with training a high-accuracy computer vision model on a GPU-powered virtual machine in Google Compute Engine to classify government ID types from images. The model is expected to handle a wide variety of ID formats with high precision. During the training phase, you encounter a 'ResourceExhaustedError: Out Of Memory (OOM)' when allocating tensor. Given the constraints of minimizing cost while ensuring the model's performance does not degrade significantly, what are the two most effective actions to resolve this issue? Choose two correct options.
A
Increase the virtual machine's GPU memory by upgrading to a higher-tier GPU, ensuring the model can handle larger batch sizes without memory issues.
B
Decrease the batch size to reduce memory consumption during training, accepting a potential increase in training time.
C
Modify the optimizer settings to 'adam' from 'sgd' to better manage resources, as 'adam' is known for its memory efficiency.
D
Resize the input images to smaller dimensions to lessen memory load, which may slightly reduce the model's accuracy.
E
Implement gradient checkpointing to trade off computation time for memory usage, allowing for larger effective batch sizes.