ITADN

ubuntu 22.04 CUDA out of memory

#20Closedj2l 创建于 2023-11-22
bug
J
j2lcommented
**Describe the bug** Not sure why it happens but it seems that too much memory is reserved. Do you know how to free some? `Tried to allocate 4.04 GiB (GPU 0; 11.76 GiB total capacity; 7.74 GiB already allocated; 2.91 GiB free; 7.88 GiB reserved in total by PyTorch)` ``` Layer Divider Extension : applying configs to model.. Traceback (most recent call last): File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 422, in run_predict output = await app.get_blocks().process_api( File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1323, in process_api result = await self.call_function( File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1051, in call_function prediction = await anyio.to_thread.run_sync( File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, *args) File "/home/pm/stable-diffusion-webui/extensions/stable-diffusion-webui-Layer-Divider-master/scripts/layer_divider_modules/sam.py", line 74, in generate_mask_app masks = self.mask_generator.generate(image) File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/automatic_mask_generator.py", line 163, in generate mask_data = self._generate_masks(image) File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/automatic_mask_generator.py", line 206, in _generate_masks crop_data = self._process_crop(image, crop_box, layer_idx, orig_size) File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/automatic_mask_generator.py", line 245, in _process_crop batch_data = self._process_batch(points, cropped_im_size, crop_box, orig_size) File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/automatic_mask_generator.py", line 279, in _process_batch masks, iou_preds, _ = self.predictor.predict_torch( File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/predictor.py", line 238, in predict_torch masks = self.model.postprocess_masks(low_res_masks, self.input_size, self.original_size) File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/modeling/sam.py", line 161, in postprocess_masks masks = F.interpolate(masks, original_size, mode="bilinear", align_corners=False) File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/functional.py", line 3950, in interpolate return torch._C._nn.upsample_bilinear2d(input, output_size, align_corners, scale_factors) torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 4.04 GiB (GPU 0; 11.76 GiB total capacity; 7.74 GiB already allocated; 2.91 GiB free; 7.88 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 ``` **OS you are using:** - OS: ubuntu 22.04
关闭于 2023-12-14 2 条评论