Open kintzhao opened 1 year ago
The error message you encountered, "OutOfMemoryError: CUDA out of memory," indicates that the GPU memory allocated for your PyTorch application has been fully utilized. This error typically occurs when the GPU does not have enough memory to accommodate the requested operation.
Reduce batch size and then run again.
Also, The error message suggests setting max_split_size_mb to avoid fragmentation. You can refer to the PyTorch documentation for Memory Management and the PYTORCH_CUDA_ALLOC_CONF environment variable for more details on configuring memory management.
OutOfMemoryError Traceback (most recent call last) Cell In[14], line 4 2 yolo = yolo_nas_l.predict(url, conf=0.25) 3 print(yolo) ----> 4 yolo.show()
File ~/.local/lib/python3.8/site-packages/super_gradients/training/models/prediction_results.py:179, in ImagesDetectionPrediction.show(self, box_thickness, show_confidence, color_mapping) 171 def show(self, box_thickness: int = 2, show_confidence: bool = True, color_mapping: Optional[List[Tuple[int, int, int]]] = None) -> None: 172 """Display the predicted bboxes on the images. 173 174 :param box_thickness: Thickness of bounding boxes. (...) 177 Default is None, which generates a default color mapping based on the number of class names. 178 """ --> 179 for prediction in self._images_prediction_lst: 180 prediction.show(box_thickness=box_thickness, show_confidence=show_confidence, color_mapping=color_mapping)
File ~/.local/lib/python3.8/site-packages/super_gradients/training/pipelines/pipelines.py:133, in Pipeline._generate_prediction_result(self, images, batch_size) 131 else: 132 for batch_images in generate_batch(images, batch_size): --> 133 yield from self._generate_prediction_result_single_batch(batch_images)
File ~/.local/lib/python3.8/site-packages/super_gradients/training/pipelines/pipelines.py:158, in Pipeline._generate_prediction_result_single_batch(self, images) 156 with eval_mode(self.model): ... 458 _pair(0), self.dilation, self.groups) --> 459 return F.conv2d(input, weight, bias, self.stride, 460 self.padding, self.dilation, self.groups)
OutOfMemoryError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 5.77 GiB total capacity; 4.58 GiB already allocated; 196.81 MiB free; 3.46 GiB allowed; 4.61 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output
settings...
yolo_nas_l.to(device).predict(input_video_path).save(output_video_path)
Predicting Video: 0%| | 0/123 [00:00<?, ?it/s]
OutOfMemoryError Traceback (most recent call last) Cell In[13], line 15 3 device=0 5 # # 设置要限制的GPU设备索引 6 # device_index = 0 # 假设使用第一个GPU设备 7 (...) 13 14 # torch.backends.cuda.max_split_size_mb = 1024 ---> 15 yolo_nas_l.to(device).predict(input_video_path).save(output_video_path)
File ~/.local/lib/python3.8/site-packages/super_gradients/training/models/detection_models/customizable_detector.py:171, in CustomizableDetector.predict(self, images, iou, conf) 163 """Predict an image or a list of images. 164 165 :param images: Images to predict. (...) 168 If None, the default value associated to the training is used. 169 """ 170 pipeline = self._get_pipeline(iou=iou, conf=conf) --> 171 return pipeline(images)
File ~/.local/lib/python3.8/site-packages/super_gradients/training/pipelines/pipelines.py:78, in Pipeline.call(self, inputs, batch_size) 63 """Predict an image or a list of images. 64 ... --> 157 torch_inputs = torch.Tensor(np.array(preprocessed_images)).to(self.device) 158 model_output = self.model(torch_inputs) 159 predictions = self._decode_model_output(model_output, model_input=torch_inputs)
OutOfMemoryError: CUDA out of memory. Tried to allocate 150.00 MiB (GPU 0; 5.77 GiB total capacity; 4.57 GiB already allocated; 179.81 MiB free; 3.46 GiB allowed; 4.61 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF