Tencent / Real-SR

Real-World Super-Resolution via Kernel Estimation and Noise Injection
Apache License 2.0
785 stars 118 forks source link

Inference on Image and CUDA out of memory #31

Open SanKumSan opened 2 years ago

SanKumSan commented 2 years ago

DVK

!python test.py -opt options/df2k/test_df2k.yml

{'name': 'Track1', 'suffix': None, 'model': 'srgan', 'distortion': 'sr', 'scale': 4, 'crop_border': None, 'gpu_ids': [0], 'datasets': {'test_1': {'name': 'DIV2K', 'mode': 'LR', 'dataroot_LR': '/content/drive/MyDrive/RealSR/Real-SR/codes/testimages/images', 'phase': 'test', 'scale': 4, 'data_type': 'img'}}, 'network_G': {'which_model_G': 'RRDBNet', 'in_nc': 3, 'out_nc': 3, 'nf': 64, 'nb': 23, 'upscale': 4, 'scale': 4}, 'path': {'pretrain_model_G': '/content/drive/MyDrive/RealSR/Real-SR/codes/pretrained_model/DF2K.pth', 'results_root': '/content/drive/MyDrive/RealSR/Real-SR/results/Track1', 'root': '/content/drive/MyDrive/RealSR/Real-SR', 'log': '/content/drive/MyDrive/RealSR/Real-SR/results/Track1'}, 'is_train': False} 22-06-09 05:38:07.840 - INFO: name: Track1 suffix: None model: srgan distortion: sr scale: 4 crop_border: None gpu_ids: [0] datasets:[ test_1:[ name: DIV2K mode: LR dataroot_LR: /content/drive/MyDrive/RealSR/Real-SR/codes/testimages/images phase: test scale: 4 data_type: img ] ] network_G:[ which_model_G: RRDBNet in_nc: 3 out_nc: 3 nf: 64 nb: 23 upscale: 4 scale: 4 ] path:[ pretrain_model_G: /content/drive/MyDrive/RealSR/Real-SR/codes/pretrained_model/DF2K.pth results_root: /content/drive/MyDrive/RealSR/Real-SR/results/Track1 root: /content/drive/MyDrive/RealSR/Real-SR log: /content/drive/MyDrive/RealSR/Real-SR/results/Track1 ] is_train: False

22-06-09 05:38:09.095 - INFO: Dataset [LRDataset - DIV2K] is created. 22-06-09 05:38:09.096 - INFO: Number of test images in [DIV2K]: 1 22-06-09 05:38:30.196 - INFO: Loading model for G [/content/drive/MyDrive/RealSR/Real-SR/codes/pretrained_model/DF2K.pth] ... 22-06-09 05:38:33.049 - INFO: Model [SRGANModel] is created. 22-06-09 05:38:33.049 - INFO: Testing [DIV2K]... Traceback (most recent call last): File "test.py", line 61, in model.test() File "/content/drive/MyDrive/RealSR/Real-SR/codes/models/SRGAN_model.py", line 205, in test self.fake_H = self.netG(self.var_L) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, kwargs) File "/usr/local/lib/python3.7/dist-packages/torch/nn/parallel/data_parallel.py", line 166, in forward return self.module(*inputs[0], *kwargs[0]) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(input, kwargs) File "/content/drive/MyDrive/RealSR/Real-SR/codes/models/modules/RRDBNet_arch.py", line 69, in forward fea = self.lrelu(self.upconv2(F.interpolate(fea, scale_factor=2, mode='nearest'))) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 447, in forward return self._conv_forward(input, self.weight, self.bias) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 444, in _conv_forward self.padding, self.dilation, self.groups) RuntimeError: CUDA out of memory. Tried to allocate 7.97 GiB (GPU 0; 14.76 GiB total capacity; 10.54 GiB already allocated; 2.23 GiB free; 11.29 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

13185742215 commented 2 months ago

the same question please