coremltools icon indicating copy to clipboard operation
coremltools copied to clipboard

Is torch.compile supported?

Open nicknikolov opened this issue 1 year ago • 3 comments

Couldn't get it to work. Leaving torch.jit.trace on will crash and commenting it out coremltools complains

TypeError: @model must either be a PyTorch .pt or .pth file or a TorchScript object, received: <class 'torch.nn.modules.container.Sequential'>

Can provide more info if needed

nicknikolov avatar Jun 27 '23 11:06 nicknikolov

torch.compile hasn't been officially supported by coremltools.

If you need this feature, we can use this thread as a feature request ticket, and it would be great if you could attach a minimum code snippet that can reproduce the issue. Thanks!

junpeiz avatar Jun 27 '23 17:06 junpeiz

Would love to see this feature too!

mrdbourke avatar Jun 30 '23 23:06 mrdbourke

coremltools would need to be registered as a custom backend in torch.compile:

https://pytorch.org/docs/stable/dynamo/custom-backends.html

den-run-ai avatar Aug 10 '23 23:08 den-run-ai