Skip to content

IndexError: list index out of range #81

@mdymxy

Description

@mdymxy

Bug description

Traceback (most recent call last):
  File "D:/python/flops/cs3.py", line 5, in <module>
    summary(model, (3, 224, 224), max_depth=2)
  File "D:\ProgramData\Anaconda3\envs\torch10\lib\site-packages\torchscan\crawler.py", line 297, in summary
    module_info = crawl_module(module, input_shape)
  File "D:\ProgramData\Anaconda3\envs\torch10\lib\site-packages\torchscan\crawler.py", line 62, in crawl_module
    cuda_overhead = get_process_gpu_ram(os.getpid()) - (torch.cuda.memory_reserved() / 1024**2)
  File "D:\ProgramData\Anaconda3\envs\torch10\lib\site-packages\torchscan\process\memory.py", line 49, in get_process_gpu_ram
    if ram_str[1].startswith("process"):
IndexError: list index out of range

Code snippet to reproduce the bug

from torchvision.models import densenet121
from torchscan import summary

model = densenet121().eval().cuda()
summary(model, (3, 224, 224), max_depth=2)

Error traceback

Traceback (most recent call last):
  File "D:/python/flops/cs3.py", line 5, in <module>
    summary(model, (3, 224, 224), max_depth=2)
  File "D:\ProgramData\Anaconda3\envs\torch10\lib\site-packages\torchscan\crawler.py", line 297, in summary
    module_info = crawl_module(module, input_shape)
  File "D:\ProgramData\Anaconda3\envs\torch10\lib\site-packages\torchscan\crawler.py", line 62, in crawl_module
    cuda_overhead = get_process_gpu_ram(os.getpid()) - (torch.cuda.memory_reserved() / 1024**2)
  File "D:\ProgramData\Anaconda3\envs\torch10\lib\site-packages\torchscan\process\memory.py", line 49, in get_process_gpu_ram
    if ram_str[1].startswith("process"):
IndexError: list index out of range

Environment

python 3.8.16
torch 1.13.1+cu116
torchaudio 0.13.1+cu116
torchscan 0.1.2
torchtoolbox 0.1.8.2
torchvision 0.14.1+cu116

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions