hustvl / ViTMatte

[Information Fusion (Vol.103, Mar. '24)] Boosting Image Matting with Pretrained Plain Vision Transformers
MIT License
371 stars 37 forks source link

Error after reinstall OS. #36

Open NicTanghe opened 3 months ago

NicTanghe commented 3 months ago

ERROR: ViTMatte1.Inference1: Exception caught processing model: The following operation failed in the TorchScript interpreter. Traceback of TorchScript, serialized code (most recent call last): File .../torch.py, line 13, in forward image_and_trimap = {"image": image, "trimap": trimap} model = self.model _0 = ((model).forward(image_and_trimap, ))["phas"]


    return torch.contiguous(_0)
  File .../vitmatte.py, line 21, in forward
    images, H, W, = _0
    backbone = self.backbone
    features = (backbone).forward(images, )
                ~~~~~~~~~~~~~~~~~ <--- HERE
    decoder = self.decoder
    outputs = (decoder).forward(features, images, )
  File .../vit.py, line 21, in forward
    _0 = __torch__.modeling.backbone.utils.get_abs_pos
    patch_embed = self.patch_embed
    x0 = (patch_embed).forward(x, )
          ~~~~~~~~~~~~~~~~~~~~ <--- HERE
    pos_embed = self.pos_embed
    pretrain_use_cls_token = self.pretrain_use_cls_token
  File .../utils.py, line 10, in forward
    x: Tensor) -> Tensor:
    proj = self.proj
    x0 = (proj).forward(x, )
          ~~~~~~~~~~~~~ <--- HERE
    return torch.permute(x0, [0, 2, 3, 1])
def get_abs_pos(abs_pos: Tensor,
  File .../conv.py, line 23, in forward
    weight = self.weight
    bias = self.bias
    _0 = (self)._conv_forward(input, weight, bias, )
          ~~~~~~~~~~~~~~~~~~~ <--- HERE
    return _0
  def _conv_forward(self: __torch__.torch.nn.modules.conv.Conv2d,
  File .../conv.py, line 29, in _conv_forward
    weight: Tensor,
    bias: Optional[Tensor]) -> Tensor:
    _1 = torch.conv2d(input, weight, bias, [16, 16], [0, 0], [1, 1])
         ~~~~~~~~~~~~ <--- HERE
    return _1

Traceback of TorchScript, original code (most recent call last):
  File "nuke_vitmatte.py", line 72, in forward
        }

        return self.model(image_and_trimap)["phas"].contiguous()
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
  File .../vitmatte.py, line 42, in forward
        images, H, W = self.preprocess_inputs(batched_inputs)
BoBosan90 commented 2 months ago

I have the same issue on my nuke indie 15.1v1.