Open baicenxiao opened 12 months ago
I don't think this is an issue with the coremltools Python package. This looks like an issue with the on device Core ML Framework.
I don't see anything obviously wrong with your Python code. Unless you think this issue is somehow related to converting your PyTorch model to Core ML, you should submit this bug using the Feedback Assistant. Before doing that, I recommend verifying that it is still an issue on the most recent version of the OS.
Thanks @TobyRoseman for the response.
It is still an issue even on the most recent version of iOS (17.1). Using the converted model for inference works fine, the problem happens only when trying to update the model.
Here is the zipped mlmodel file in case it is helpful for debugging. updatable_classification11.mlmodel.zip
Since the converted model works for inference, I think that's even more reason to suspect it's an issue with the Core ML Framework. Did you submit this issue using the Feedback Assistant?
Just submitted this issue using the Feedback Assistant.
❓Question
I converted a simple nerual network containing LSTM from Pytorch to mlmodel, and set only the last fully-connected layer to be updatable. Using this updatable model, I can run prediction, but model training gives error
libc++abi: terminating due to uncaught exception of type Espresso::invalid_argument_error: Espresso exception: "Invalid argument": generic_expand_dims_kernel: Output rank cannot be more than 5 in expand_dims:transpose_1_expanded
. Does it mean that, once LSTM is in the network, I cannot fine-tune the last layer even if it is just a fully-connected layer? Is there any temporary solution? Thanks.I use
torch==1.13.1
andcoremltools==7.0
Here is the network structure:
Here is the Pytorch code:
Here is my swift prediction code which works:
Here is training code which raises the error message
libc++abi: terminating due to uncaught exception of type Espresso::invalid_argument_error: Espresso exception: "Invalid argument": generic_expand_dims_kernel: Output rank cannot be more than 5 in expand_dims:expand_dims_0
: