XuelianCheng / LEAStereo

Hierarchical Neural Architecture Searchfor Deep Stereo Matching (NeurIPS 2020)
MIT License
256 stars 51 forks source link

CUDA Out Of Memory #31

Closed ArduinoHocam closed 2 years ago

ArduinoHocam commented 2 years ago

Hi, In my case I tried to validate the Middlebury 2014 (Quarter) model using ./predict_md.sh script. I tried with RTX 3070 or 1660Ti GPUs, everytime I get the CUDA oom error. Any idea why this happen? btw, because of the apex size, I have to use following versions (inside the conda env): python=3.7 pytorch=1.7.1 torchvision=0.8.2 cudatoolkit=11.0 and my nvcc -V returns 11.0

Error:

(leastereo) alisvndk@alisvndk-G3-3500:~/Desktop/LEA/LEAStereo(master)$ ./predict_md.sh 
Namespace(cell_arch_fea='run/sceneflow/best/architecture/feature_genotype.npy', cell_arch_mat='run/sceneflow/best/architecture/matching_genotype.npy', crop_height=1008, crop_width=1512, cuda=True, data_path='./dataset/MiddEval3/testQ/', fea_block_multiplier=4, fea_filter_multiplier=8, fea_num_layers=6, fea_step=3, kitti2012=0, kitti2015=0, mat_block_multiplier=4, mat_filter_multiplier=8, mat_num_layers=12, mat_step=3, maxdisp=408, middlebury=1, net_arch_fea='run/sceneflow/best/architecture/feature_network_path.npy', net_arch_mat='run/sceneflow/best/architecture/matching_network_path.npy', resume='./run/MiddEval3/best/best.pth', save_path='./predict/middlebury/images/', sceneflow=0, test_list='./dataloaders/lists/middeval3_test.list')
===> Building LEAStereo model
Feature network path:[1 0 1 0 0 0]
Matching network path:[1 1 2 2 1 2 2 2 1 1 0 1] 

Total Params = 1.81MB
Feature Net Params = 0.10MB
Matching Net Params = 1.71MB
Traceback (most recent call last):
  File "predict.py", line 48, in <module>
    mult_adds = comp_multadds(model, input_size=(3,opt.crop_height, opt.crop_width)) #(3,192, 192))
  File "/home/alisvndk/Desktop/LEA/LEAStereo/utils/multadds_count.py", line 21, in comp_multadds
    _ = model(input_data, input_data)
  File "/home/alisvndk/anaconda3/envs/leastereo/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/alisvndk/Desktop/LEA/LEAStereo/retrain/LEAStereo.py", line 32, in forward
    cost = x.new().resize_(x.size()[0], x.size()[1]*2, int(self.maxdisp/3),  x.size()[2],  x.size()[3]).zero_() 
RuntimeError: CUDA out of memory. Tried to allocate 5.49 GiB (GPU 0; 5.81 GiB total capacity; 66.60 MiB already allocated; 285.50 MiB free; 4.00 GiB reserved in total by PyTorch)

Could you please give me a hand about this problem? Thanks.

ArduinoHocam commented 2 years ago

This is duplicate of the :https://github.com/XuelianCheng/LEAStereo/issues/14 As far as I understand, your repository requires a lot of memory. ./predict_md.sh will not work on my machines. RTX3070 ? You can close the issue.