WenjiaWang0312 / TextZoom

[ECCV2020] A super-resolution dataset of paired LR-HR scene text images
440 stars 76 forks source link

RuntimeError: "index_select_out_cuda_impl" not implemented for 'Float' #44

Closed xingyiz closed 3 years ago

xingyiz commented 3 years ago

I tried running the code on Google Colab, and this is the error that popped up. I downloaded the original TextZoom dataset from the link in the README and this was the command I ran

!python3 main.py --batch_size=64 --STN --mask --gradient --vis_dir='vis'

The error is as follows:

load pred_trained aster model from demo.pth
/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at  /pytorch/c10/core/TensorImpl.h:1156.)
  return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3982: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
  "Default grid_sample and affine_grid behavior has changed "
[2021-07-06 09:57:37]   Epoch: [0][100/271] vis_dir=vis 5.031   
[2021-07-06 09:58:05]   Epoch: [0][200/271] vis_dir=vis 4.133   
======================================================
evaling hard
Traceback (most recent call last):
  File "main.py", line 44, in <module>
    main(config, args)
  File "main.py", line 18, in main
    Mission.train()
  File "/gdrive/My Drive/tsrn/TextZoom/src/interfaces/super_resolution.py", line 93, in train
    metrics_dict = self.eval(model, val_loader, image_crit, iters, aster, aster_info)
  File "/gdrive/My Drive/tsrn/TextZoom/src/interfaces/super_resolution.py", line 141, in eval
    aster_output_lr = aster(aster_dict_lr)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1051, 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 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/gdrive/My Drive/tsrn/TextZoom/src/model/recognizer/recognizer_builder.py", line 93, in forward
    rec_pred, rec_pred_scores = self.decoder.beam_search(encoder_feats, beam_width, self.eos)
  File "/gdrive/My Drive/tsrn/TextZoom/src/model/recognizer/attention_recognition_head.py", line 112, in beam_search
    state = state.index_select(1, predecessors.squeeze())
RuntimeError: "index_select_out_cuda_impl" not implemented for 'Float'

Any idea how to resolve this?

xingyiz commented 3 years ago

After downgrading my pytorch version and cudnn to 1.5.0 and 10.1 respectively with pip install torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html I managed to run it without the error. Thanks!