Closed fdavidsen closed 1 week ago
I want to convert this model to OpenVINO, so I start by doing jit trace with the following code.
import torch from face_alignment import FaceAlignment, LandmarksType class FaceAlignmentWrapper(torch.nn.Module): def __init__(self): super().__init__() self.model = FaceAlignment(LandmarksType.TWO_D, device='cpu') def forward(self, image): landmarks = self.model.get_landmarks_from_image(image) if landmarks: return torch.tensor(landmarks[0]) return torch.zeros((68, 2)) model = FaceAlignmentWrapper() scripted_model = torch.jit.trace(model, torch.randn(256, 256, 3)) scripted_model.save("face_alignment_scripted.pt")
However it gives me this error
RuntimeError: Cannot insert a Tensor that requires grad as a constant. Consider making it a parameter or input, or detaching the gradient
Is there any way to convert this model to OpenVINO?
I want to convert this model to OpenVINO, so I start by doing jit trace with the following code.
However it gives me this error
RuntimeError: Cannot insert a Tensor that requires grad as a constant. Consider making it a parameter or input, or detaching the gradient
Is there any way to convert this model to OpenVINO?