Open jeethu opened 1 month ago
I can reproduce this issue.
I think this is a bug in the Core ML Framework. The ct.convert
call works if you convert_to
either neuralnetwork
or milinternal
. It's loading the converted mlprogram that's the issue; if you pass skip_model_load=True
, the ct.convert
call also succeeds.
@TobyRoseman I'm going to give your suggestion a shot! With the wrapper library https://github.com/huggingface/exporters, which myself and others get the very same segmentation fault trying to convert any 'large' model. Gets all the way to the end and then the process gets killed.
Similar issue opened on that repo here.
Edit: this worked! Converted a 'large' model, no process killed.
πDescribing the bug
Stack Trace
To Reproduce
class Model(torch.nn.Module): def init(self, n_features): super().init() self.norm = torch.nn.BatchNorm3d(n_features)
model = Model(32).eval() features = torch.randn((1, 32, 16, 64, 64))
with torch.no_grad(): mlmodel = ct.convert( torch.jit.trace(model, features), inputs=[ct.TensorType(name="x", shape=features.shape)], outputs=[ct.TensorType(name="out")], convert_to="mlprogram", )