File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
official/vision/beta/serving Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- """Binary to convert a saved model to tflite model."""
15
+ r"""Binary to convert a saved model to tflite model.
16
+
17
+ It requires a SavedModel exported using export_saved_model.py with batch size 1
18
+ and input type `tflite`, and using the same config file used for exporting saved
19
+ model. It includes optional post-training quantization. When using integer
20
+ quantization, calibration steps need to be provided to calibrate model input.
21
+
22
+ To convert a SavedModel to a TFLite model:
23
+
24
+ EXPERIMENT_TYPE = XX
25
+ TFLITE_PATH = XX
26
+ SAVED_MOODEL_DIR = XX
27
+ CONFIG_FILE = XX
28
+ export_tflite --experiment=${EXPERIMENT_TYPE} \
29
+ --saved_model_dir=${SAVED_MOODEL_DIR} \
30
+ --tflite_path=${TFLITE_PATH} \
31
+ --config_file=${CONFIG_FILE} \
32
+ --quant_type=fp16 \
33
+ --calibration_steps=500
34
+ """
16
35
from absl import app
17
36
from absl import flags
18
37
from absl import logging
You can’t perform that action at this time.
0 commit comments