Unsupported Ops in the model before optimization [tensorflowjs_converter] Ops: PartitionedCall
System information
- TensorFlow.js version (you are using): 3.14.0
- Are you willing to contribute it (Yes/No): Yes
Describe the feature and the current behavior/state.
Unsupported Op: PartitionedCall
Traceback (most recent call last):
File "/home/jeff/.local/bin/tensorflowjs_converter", line 8, in <module>
sys.exit(pip_main())
File "/home/jeff/.local/lib/python3.8/site-packages/tensorflowjs/converters/converter.py", line 813, in pip_main
main([' '.join(sys.argv[1:])])
File "/home/jeff/.local/lib/python3.8/site-packages/tensorflowjs/converters/converter.py", line 817, in main
convert(argv[0].split(' '))
File "/home/jeff/.local/lib/python3.8/site-packages/tensorflowjs/converters/converter.py", line 803, in convert
_dispatch_converter(input_format, output_format, args, quantization_dtype_map,
File "/home/jeff/.local/lib/python3.8/site-packages/tensorflowjs/converters/converter.py", line 523, in _dispatch_converter
tf_saved_model_conversion_v2.convert_tf_saved_model(
File "/home/jeff/.local/lib/python3.8/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 764, in convert_tf_saved_model
_convert_tf_saved_model(output_dir, saved_model_dir=saved_model_dir,
File "/home/jeff/.local/lib/python3.8/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 660, in _convert_tf_saved_model
optimize_graph(frozen_graph, signature,
File "/home/jeff/.local/lib/python3.8/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 156, in optimize_graph
raise ValueError('Unsupported Ops in the model before optimization\n' +
ValueError: Unsupported Ops in the model before optimization
PartitionedCall
Will this change the current api? How? I don't believe so, as it should be adding an op used with a yolov5 model in conversion to tensorflowjs
Who will benefit with this feature? In addition to myself, I suspect anyone with an object detection model trained in yolov5 will as well.
Any Other info. If there is an ignore flag for this, or a custom association on conversion, I will certainly give it a try.
Hi @github-jeff , can you share the saved_model file for us to reproduce the problem? thanks
Unfortunately the content of the model has some proprietary functionality. But I can say there are several layers of overlapping boxes that happen commonly. Basically I identify an object and other specific parts of the same object as well. Not unlike identifying a snowman and then also identifying a carrot, hat, and coal.
I also tried just using the web model version directly and that seems to work just fine.
For those following along:
cd to yolov5 root directory
python3 export.py --weights .../best.pt --include tfjs
This will spit out web_model directory with a bunch of bin files and a model.json file. Put that in the public directory and reference it from code something like:
const tf = require('@tensortflow/tfjs')
const weights = '/web_model/model.json'
const names = ['snowman', 'hat', 'carrot', 'coal']
class Snowman extends React.Component {
state = {
model: null,
preview: "",
predictions: []
}
componentDidMount() {
tf.loadGraphModel(weights).then(model => {
this.setState({
model: model
});
});
}
//etc.
}
What is PartitionCall? I cannot seem to find a reference for it.
@github-jeff what is the TensorFlow python version you are using, we have a bug with the converter if you are using TensorFlow 2.10.0. We will release a fix soon, if you are using 2.10.0, you need to downgrade the TensorFlow to 2.9.0 and below.
@pyu10055 Thank you for taking a look. I am currently using tensorflow/tfjs 3.11.0 in a javascript/react app. I was attempting to use the latest revision 3.15.0 with npm but that failed with the PartitionCall. I think there is a tangential relationship between this and a tensor shape miss-match error. See stackoverflow question. In any case, downgrading to 3.11.0 worked for this application. I did not step through 3.12 - 3.14 to see when the breaking change occurred yet, and only picked 3.11.0 as a guess based solely on there being a good bit of conversation in the forums around that version.
@github-jeff It is interesting that 3.11.0 works, but not anything higher. The partitionCall is the Tensorflow function start node in the saved model, when the function can not be inlined by our converter, this error happens.
It would be great if you can share a model that does not contain your proprietary functions but still shows the conversion errors.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.
Sorry for the delay. I had put this one on the shelf. Let me see if I can strip it down but still illustrate the concern.
Many thanks!
On Tue, May 31, 2022, 5:26 PM google-ml-butler[bot] < @.***> wrote:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.
— Reply to this email directly, view it on GitHub https://github.com/tensorflow/tfjs/issues/6233#issuecomment-1142654484, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE5LSJDOUWG7C3AXS5M6BZ3VMZ7XPANCNFSM5QZKD4TQ . You are receiving this because you were mentioned.Message ID: @.***>
Hi, @github-jeff
Apologize for the delayed response and we are re-visiting our older issues and checking whether those issues have been resolved or not as of now so May I know are you still facing the same issue ? If yes, could you please give it try with latest version of Tensorflow 2.12 and check whether your issue is resolving or not ?
If issue still persists please help us with your saved_model folder to replicate that issue from our end ? Thank you!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.
Closing as stale. Please @mention us if this needs more attention.