New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding some Boosted tree ops to the 'allowed' list #50801
Comments
In order to do code changes i have tried to build tensorflow from source in my mac , But it gave me an error in the last step where we install the wheel file of tensorflow through pip, i have raised the following case for this #50829 .Please let me know how i can proceed. |
Hello, i was able to build from source in a linux machine(Ubuntu 18.04.5). However i am getting this errror after i add the necessary ops required in the code. `Hello from TensorFlow C library version 2.6.0-rc1 2021-07-28 11:52:42.331907: W tensorflow/core/framework/op_kernel.cc:1692] OP_REQUIRES failed at quantile_ops.cc:461 : Not found: Container localhost does not exist. (Could not find resource: localhost/boosted_trees/QuantileAccumulator/) Attaching the diff file here : tf_diff.txt PS: I am using Tensorflow c api and the code is attached here: boosted_tree_tflite.c Thank you, |
Here are a couple of suggested solutions:
Let me know if this works. |
Hi Meghna, Thanks for the response.
Does it mean i have to essentially train the model in the same device and then load the model in the same device for it to work? |
I think the environment is fine, but the Boosted trees implementation may be using streaming mechanisms that isn't supported by TFLite on-device. Looks like #41226 faces a similar issue. I'll look into this further and get back to you. |
@Koushik667 could you share the reproducible steps for creating the above TensorFlow model to debug? |
Sure, I have created a sample program for the titanic dataset which takes only 2 input numerical features for simplicity. Dataset csv files: Here is the python program to create the tensorflow model which uses above csv files Here is the converter code which converts TensorFlow model generated to TensorFlow lite :converter_code.txt Here is the diff file which applied after building from source : tf_diff.txt Here is the C code which loads and runs the tensorflow lite model : I run this code using this command: Also attaching tensorflow and tensorflow lite models in zip file : |
Could you format the above script in a format of the CoLab if possible? |
Sure, |
@abattery Please let me know if you need anything from my side. |
Hi @abattery @MeghnaNatraj , Can you please let me know if this issue is solvable or not? or if it is a work in progress? |
@renjie-liu Any comments on this issue? |
Adding Karim who may have a better idea |
@karimnosseir Any updates on this issue? |
Hi @MeghnaNatraj, Can you please comment on what can be done for this issue? |
These ops were removed from TF so TFLite doesn't support it either. |
Please make sure that this is a feature request. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template
System information
Describe the feature and the current behavior/state.
Currently, we cant convert tensorflow boosted tree model to tensorflow lite using tf.lite.TFLiteConverter.from_saved_model even after having
converter.target_spec.supported_ops = [
tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
tf.lite.OpsSet.SELECT_TF_OPS
# enable TensorFlow ops.
]
I am getting this error,
`ConverterError: :0: error: loc("boosted_trees"): 'tf.BoostedTreesEnsembleResourceHandleOp' op is neither a custom op nor a flex op
:0: error: loc("boosted_trees/BoostedTreesPredict"): 'tf.BoostedTreesPredict' op is neither a custom op nor a flex op
:0: error: loc("boosted_trees/head/predictions/str_classes"): 'tf.AsString' op is neither a custom op nor a flex op
:0: error: failed while converting: 'main': Ops that need custom implementation (enabled via setting the -emit-custom-ops flag):
tf.AsString {device = "", fill = "", precision = -1 : i64, scientific = false, shortest = false, width = -1 : i64}
tf.BoostedTreesEnsembleResourceHandleOp {container = "", device = "", shared_name = "boosted_trees/"}
tf.BoostedTreesPredict {device = "", logits_dimension = 7 : i64, num_bucketized_features = 18 : i64}
`
Will this change the current api? How?
Not sure
Who will benefit with this feature?
Anyone who want to use boosted tree tensorflow lite model will be benifted.
Any Other info.
Thanks to @MeghnaNatraj and @abattery for responding to case #50667 .After referring this [https://www.tensorflow.org/lite/guide/op_select_allowlist#add_tensorflow_core_operators_to_the_allowed_list], i have raised this feature request to add the unsupported ops.
The text was updated successfully, but these errors were encountered: