I would like to ask how to save the personalization model during training on device.

43 views
Skip to first unread message

zirui lian

unread,
Apr 7, 2022, 12:09:46 AMApr 7
to TensorFlow Lite
To tflite team:
       I would like to ask how to save the personalization model during training on device. If this personalization model can be used for transmission, it may be possible to implement federated learning for user privacy and security, and I would like to ask if this feature is supported or will be supported soon.

Iosif Hamlatzis

unread,
Apr 7, 2022, 1:21:28 PMApr 7
to TensorFlow Lite, lianxia...@gmail.com
Regarding saving, I think it depends on how you use tflite. 

1. If you 're using SELECT_OPS, then you are using FLEX delegate. I assume the tflite team have implemented the save and restore ops
2. If you're using custom ops, then you'll have to implement save and restore custom ops your self. Depending whether you want compatibility with TF or not you can either implement the way save/restore are implemented in TF, obviously using what tflite offers you, or if you don't care for compatibility, then you can devise you're own implementation

Regardless case 1. or 2. when creating you .tflite model file, wou will need to add extra two subgraphs, one for saving and one for restoring. So you're model will have at least 4 subgraph. An inference subgraph, a training subgraph and the extra Save & Restore subgraph. The names are up to you, as long as call the correct signature runner.

Hope haven't forgoten something

iosif

Priyanshu Kumar

unread,
Nov 4, 2022, 2:18:29 AMNov 4
to TensorFlow Lite, i.ham...@gmail.com, lianxia...@gmail.com
Hi, 
I am facing trouble in saving the model on the device. I am getting an error "Failed to run on the given interpreter : model.ckpt Node number 14 (TfLiteFlexDelegate) failed to invoke" on calling the save signature. Node 14 does not exist in the save signature on inspecting the tflite model using Netron Model Viewer.


Does anyone have any idea what might be going wrong?

Haoliang Zhang

unread,
Nov 4, 2022, 11:58:36 AMNov 4
to Priyanshu Kumar, TensorFlow Lite, i.ham...@gmail.com, lianxia...@gmail.com
Tflite doesn’t have built in ops for save/restore yet. If you want to save the weights to a TF checkpoint, you will need to use select TF ops and link in flex delegate. If you don’t want to rely on flex delegate, then you will need to implement custom ops to handle the save/restore. Hope this helps!

--
You received this message because you are subscribed to the Google Groups "TensorFlow Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tflite+un...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tflite/198fb6cb-6167-4d71-91b4-d59d0df9098dn%40tensorflow.org.
--
Best,
Haoliang
Reply all
Reply to author
Forward
0 new messages