PROFESSIONAL-MACHINE-LEARNING-ENGINEER practice question 19 of 35
You need to train a computer vision model that predicts the type of government ID present in a given image using a GPU-powered virtual machine on…
Full set: 283 questionsThe ResourceExhaustedError: out of Memory (oom) indicates that the GPU's VRAM is insufficient to hold the model, its gradients, and the current batch of data simultaneously. The batch size directly determines the number of images and their corresponding activation maps processed in a single forward/backward pass. Reducing the batch size is the most direct and common method to decrease the memory required per training step, thereby resolving the OOM error without altering the model's architecture or the input data's resolution. This allows the training process to fit within the available GPU memory.
A. Change the optimizer: The current optimizer, SGD, is already one of the most memory-efficient. Changing it, especially to an adaptive one like Adam, would likely increase memory usage.
C. Change the learning rate: The learning rate is a hyperparameter that controls the optimization step size; it has no direct impact on the amount of memory allocated for tensors.
D. Reduce the image shape: While this would reduce memory usage, it is a more drastic step that alters the input data, potentially losing critical information and degrading model performance. ---
1. Google Cloud Documentation: In the official documentation for Vertex AI Training, when discussing GPU usage, it is explicitly recommended to "try reducing the perreplicabatchsize" if you encounter out-of-memory errors.
Source: Google Cloud, Vertex AI Documentation, "Use GPUs for training". Section: "Recommendations for using GPUs".
2. TensorFlow Official Documentation: The TensorFlow guide on GPU usage explains that all tensors for an operation must fit in GPU memory. The size of the data batch is a primary contributor to the memory footprint of a training step. Reducing the batch size directly reduces this footprint.
Source: TensorFlow, "Use a GPU". Section: "Limiting GPU memory growth".
3. Stanford University Courseware (CS231n): Course materials on training neural networks explain that during the forward pass, activations for every neuron in the batch are stored. During the backward pass, gradients are stored. The memory required for these scales linearly with the batch size.
Source: Stanford CS231n: Convolutional Neural Networks for Visual Recognition, "Training Neural Networks, Part 1" notes. Section: "Batch Normalization".
Keep practicing
Take the free PROFESSIONAL-MACHINE-LEARNING-ENGINEER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PROFESSIONAL-MACHINE-LEARNING-ENGINEER practice questions
- Question 1You work for an advertising company and want to understand the effectiveness of your comp…
- Question 2You developed a custom model by using Vertex Al to forecast the sales of your company s p…
- Question 3You are an ML engineer at a global shoe store. You manage the ML models for the company's…
- Question 5During batch training of a neural network, you notice that there is an oscillation in the…
- Question 6You want to rebuild your ML pipeline for structured data on Google Cloud. You are using P…
- Question 7Your team is building a convolutional neural network (CNN)-based architecture from scratc…
