YaoFANGUK / video-subtitle-remover

基于AI的图片/视频硬字幕去除、文本水印去除,无损分辨率生成去字幕、去水印后的图片/视频文件。无需申请第三方API,本地实现。AI-based tool for removing hard-coded subtitles and text-like watermarks from videos or Pictures.
Apache License 2.0
4.68k stars 612 forks source link

Error in removing subtitles #14

Closed Luxios22 closed 11 months ago

Luxios22 commented 11 months ago

Hi the following is the issue I've met, I have no idea what happened to give this error RuntimeError: GET was unable to find an engine to execute this computation and a bunch of /home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/ logs whose paths are not in my server. Could anybody help me on this?

python ./backend/main.py

Please input video file path: xxx.mp4
use GPU for acceleration
Subtitle Finding:   0%|                                                                                                                                                | 0/3545 [00:00<?, ?frame/s][Processing] start finding subtitles...
████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉| 3543/3545 [03:19<00Subtitle Finding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3545/3545 [03:19<00:00, 18.61frame/s][Finished] Finished finding subtitles...
Subtitle Finding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3545/3545 [03:19<00:00, 17.80frame/s]
Subtitle Removing:   0%|                                                                                                                             | 0/3545 [00:00<?, ?frame/s][Processing] start removing subtitles...
use normal mode
Traceback (most recent call last):
  File "./backend/main.py", line 684, in <module>
    sd.run()
  File "./backend/main.py", line 606, in run
    frame = self.lama_inpaint(frame, mask)
  File "/home/yangjun7/video-subtitle-remover/backend/inpaint/lama_inpaint.py", line 23, in __call__
    inpainted = self.model(image, mask)
  File "/home/yangjun7/miniconda3/envs/videoEnv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
RuntimeError: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript, serialized code (most recent call last):
  File "code/__torch__.py", line 11, in forward
    mask: Tensor) -> Tensor:
    model = self.model
    return (model).forward(mask, image, )
            ~~~~~~~~~~~~~~ <--- HERE
  File "code/__torch__/saicinpainting/training/trainers/default.py", line 13, in forward
    masked_img = torch.mul(image, torch.rsub(mask, 1))
    input = torch.cat([masked_img, mask], 1)
    _0 = torch.mul(mask, (generator).forward(input, ))
                          ~~~~~~~~~~~~~~~~~~ <--- HERE
    _1 = torch.mul(torch.rsub(mask, 1), image)
    return torch.add(_0, _1)
  File "code/__torch__/saicinpainting/training/modules/ffc.py", line 10, in forward
    input: Tensor) -> Tensor:
    model = self.model
    return (model).forward(input, )
            ~~~~~~~~~~~~~~ <--- HERE
class FFC_BN_ACT(Module):
  __parameters__ = []
  File "code/__torch__/torch/nn/modules/container/___torch_mangle_818.py", line 78, in forward
    _1 = getattr(self, "1")
    _0 = getattr(self, "0")
    _29 = (_1).forward((_0).forward(input, ), )
           ~~~~~~~~~~~ <--- HERE
    _32 = (_4).forward((_3).forward((_2).forward(_29, ), ), )
    _36, _37, = _32
  File "code/__torch__/saicinpainting/training/modules/ffc.py", line 28, in forward
    bn_l = self.bn_l
    ffc = self.ffc
    _0 = (bn_l).forward((ffc).forward(argument_1, ), )
                         ~~~~~~~~~~~~ <--- HERE
    _1 = (act_l).forward(_0, )
    _2 = (bn_g).forward()
  File "code/__torch__/saicinpainting/training/modules/ffc.py", line 47, in forward
    convg2l = self.convg2l
    convl2l = self.convl2l
    _4 = (convl2l).forward(argument_1, )
          ~~~~~~~~~~~~~~~~ <--- HERE
    _5 = (convg2l).forward()
    return torch.add(_4, CONSTANTS.c0)
  File "code/__torch__/torch/nn/modules/conv.py", line 11, in forward
    weight = self.weight
    _0 = torch.pad(argument_1, [0, 0, 0, 0], "reflect")
    _1 = torch._convolution(_0, weight, None, [1, 1], [0, 0], [1, 1], False, [0, 0], 1, False, False, True, True)
         ~~~~~~~~~~~~~~~~~~ <--- HERE
    return _1
class ConvTranspose2d(Module):

Traceback of TorchScript, original code (most recent call last):
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/conv.py(456): _conv_forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/conv.py(463): forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1178): _slow_forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1190): _call_impl
/home/enesmsahin/enes_workspace/lama/saicinpainting/training/modules/ffc.py(221): forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1178): _slow_forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1190): _call_impl
/home/enesmsahin/enes_workspace/lama/saicinpainting/training/modules/ffc.py(252): forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1178): _slow_forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1190): _call_impl
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/container.py(204): forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1178): _slow_forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1190): _call_impl
/home/enesmsahin/enes_workspace/lama/saicinpainting/training/modules/ffc.py(367): forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1178): _slow_forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1190): _call_impl
/home/enesmsahin/enes_workspace/lama/saicinpainting/training/trainers/default.py(70): forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1178): _slow_forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1190): _call_impl
/home/enesmsahin/enes_workspace/lama/bin/to_jit.py(24): forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1178): _slow_forward
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/nn/modules/module.py(1190): _call_impl
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/jit/_trace.py(976): trace_module
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/torch/jit/_trace.py(759): trace
/home/enesmsahin/enes_workspace/lama/bin/to_jit.py(60): main
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/hydra/core/utils.py(160): run_job
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/hydra/_internal/hydra.py(97): run
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/hydra/_internal/utils.py(368): <lambda>
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/hydra/_internal/utils.py(211): run_and_report
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/hydra/_internal/utils.py(367): _run_hydra
/home/enesmsahin/.conda/envs/sdiff/lib/python3.9/site-packages/hydra/main.py(49): decorated_main
/home/enesmsahin/enes_workspace/lama/bin/to_jit.py(78): <module>
RuntimeError: GET was unable to find an engine to execute this computation

Subtitle Removing:   0%|                                                                                                                             | 0/3545 [00:02<?, ?frame/s]
Luxios22 commented 11 months ago

Is there any hint for how to solve this issue?

YaoFANGUK commented 11 months ago

which pytorch version do you use?

Luxios22 commented 11 months ago

pip list | grep torch

pytorch-lightning       1.2.9
torch                   2.0.1
torchmetrics            0.2.0
torchvision             0.15.2