Open jmcc113 opened 8 months ago
Loading an untrusted PyTorch model is a security risk. So I'm unable to reproduce your results. It would be great if you could give us a minimal example (i.e. one which doesn't require loading an external model).
Does the output match if you convert with fixed shapes?
Loading an untrusted PyTorch model is a security risk. So I'm unable to reproduce your results. It would be great if you could give us a minimal example (i.e. one which doesn't require loading an external model).
Does the output match if you convert with fixed shapes?
This model is from Hugging Face. I'm not sure which layer causes this bug, so it's difficult for me to construct a minimal example. But the output of fixed-shape-model is correct.
I'm not sure which layer causes this bug, so it's difficult for me to construct a minimal example.
I completely understand. Unfortunately, without a minimal example, it's difficult for me to help you.
Since the fixed shape works, the issue is almost certainly related to flexible shape. For debugging purposes, there's a few more things you could try.
1 - Verify that the traced PyTorch model still works for shapes within the range of the flexible shape but different than the shapes it was traced on.
2 - See if the model converts correct with fixed input_ids
shape, but a flexible attention_mask
shape.
3 - See if the model converts correct with fixed attention_mask
shape, but a flexible input_ids
shape.
1 - Verify that the traced PyTorch model still works for shapes within the range of the flexible shape but different than the shapes it was traced on.
2 - See if the model converts correct with fixed
input_ids
shape, but a flexibleattention_mask
shape.3 - See if the model converts correct with fixed
attention_mask
shape, but a flexibleinput_ids
shape.
input_ids
shape, but a flexible attention_mask
shape, I get an error:
Traceback (most recent call last):
File "/Users/jinmuchuan/projects/BCEmbedding/model.py", line 48, in <module>
out_dict = mlmodel.predict(inputs_on_device)
File "/opt/homebrew/anaconda3/envs/bce/lib/python3.10/site-packages/coremltools/models/model.py", line 596, in predict
return MLModel._get_predictions(self.__proxy__, verify_and_convert_input_dict, data)
File "/opt/homebrew/anaconda3/envs/bce/lib/python3.10/site-packages/coremltools/models/model.py", line 648, in _get_predictions
return proxy.predict(data)
RuntimeError: {
NSLocalizedDescription = "Failed to build the model execution plan using a model architecture file '/private/var/folders/sn/xnnh_7q94y9fx18c0g26rt716qppp1/T/tmpf0e8pl49.mlmodelc/model.mil' with error code: -7.";
}
attention_mask
shape, but a flexible input_ids
shape, I get NAN.
πDescribing the bug
When I using EnumeratedShape or RangeDim to generate a flexible-input-shape model to inference, the result is all nan.
Stack Trace
To Reproduce
System environment (please complete the following information):