RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 3.82 GiB total capacity; 2.20 GiB already allocated; 27.88 MiB free; 2.32 GiB reserved in total by PyTorch)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- computer-vision, machine-learning
Hướng nghiên cứu
Bắt đầu với test_torch_encoding.py và lần theo lệnh gọi bị lỗi qua encoding/models/sseg/base.py, encoding/models/sseg/deeplab.py và đường dẫn ResNet được hiển thị trong traceback. Tái hiện lỗi CUDA out-of-memory đã nêu với model và GPU được chỉ định, sau đó xác định liệu batch_size có được entry point này hỗ trợ hay không và hành vi nào nên được xem là đã được giải quyết.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
How can I pass the batch_size to an script that is making use of encoding python package?
(torchenc) mona@goku:~$ python test_torch_encoding.py --batch_size 8
Traceback (most recent call last):
File "test_torch_encoding.py", line 15, in <module>
output = model.evaluate(img)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch_encoding-1.2.2b20210130-py3.8-linux-x86_64.egg/encoding/models/sseg/base.py", line 101, in evaluate
pred = self.forward(x)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch_encoding-1.2.2b20210130-py3.8-linux-x86_64.egg/encoding/models/sseg/deeplab.py", line 47, in forward
c1, c2, c3, c4 = self.base_forward(x)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch_encoding-1.2.2b20210130-py3.8-linux-x86_64.egg/encoding/models/sseg/base.py", line 96, in base_forward
c3 = self.pretrained.layer3(c2)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch/nn/modules/container.py", line 117, in forward
input = module(input)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch_encoding-1.2.2b20210130-py3.8-linux-x86_64.egg/encoding/models/backbone/resnet.py", line 95, in forward
out = self.conv2(out)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch_encoding-1.2.2b20210130-py3.8-linux-x86_64.egg/encoding/nn/splat.py", line 50, in forward
x = self.bn0(x)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch/nn/modules/batchnorm.py", line 131, in forward
return F.batch_norm(
File "/home/mona/venv/torchenc/lib/python3.8/site-packages/torch/nn/functional.py", line 2056, in batch_norm
return torch.batch_norm(
RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 3.82 GiB total capacity; 2.20 GiB already allocated; 27.88 MiB free; 2.32 GiB reserved in total by PyTorch)
code is:
(torchenc) mona@goku:~$ cat test_torch_encoding.py
import torch
import encoding
# Get the model
model = encoding.models.get_model('DeepLab_ResNeSt269_PContext', pretrained=True).cuda()
model.eval()
# Prepare the image
url = 'https://github.com/zhanghang1989/image-data/blob/master/' + \
'encoding/segmentation/pcontext/2010_001829_org.jpg?raw=true'
filename = 'example.jpg'
img = encoding.utils.load_image(encoding.utils.download(url, filename)).cuda().unsqueeze(0)
# Make prediction
output = model.evaluate(img)
predict = torch.max(output, 1)[1].cpu().numpy() + 1
# Get color pallete for visualization
mask = encoding.utils.get_mask_pallete(predict, 'pascal_voc')
mask.save('output.png')
I am not sure how you pass batch_size to code but I just followed https://github.com/zhanghang1989/PyTorch-Encoding/issues/224 would your code work at all with a GeForce 1650 Ti GPU?
Thanks a lot for your help.
- I get the error even with batch size of 1:
(torchenc) mona@goku:~$ python test_torch_encoding.py --batch_size 1
- Ngôn ngữ chính
- Python
- Star
- 2k
- Fork
- 448
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của zhanghang1989/PyTorch-Encoding
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
zhanghang1989/PyTorch-Encoding#432 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
zhanghang1989/PyTorch-Encoding#430 · 3 bình luận · 2 reaction ·
-
,Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 1/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
zhanghang1989/PyTorch-Encoding#426 · 1 bình luận ·
Tất cả issue của zhanghang1989/PyTorch-Encoding
Issue tương tự
-
area/i18n comp/desktop P3 type/feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NousResearch/hermes-agent#134377 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue needs-triage priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
melodic-software/claude-code-plugins#6499 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Typo in latest release v21.1.3Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ssciwr/clang-format-wheel#167 ·
-
conda skeleton cran has SSL_NO_VERIFY check inverted and TLS verification off by defaultCó thể đã có người làm @matthewfeickert đã nhận hôm nay. Đang mởtype::bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
conda/conda-build#6202 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày