{"record":{"id":"c361678d3f898fa3","repo":"tensorflow/models","slug":"saved-model-dir-model-or-concrete-function","errorCode":null,"errorMessage":"`saved_model_dir`, `model` or `concrete_function` must be specified.","messagePattern":"`saved_model_dir`, `model` or `concrete_function` must be specified\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/serving/export_tflite_lib.py","lineNumber":133,"sourceCode":"\n  Returns:\n    A converted TFLite model with optional PTQ.\n\n  Raises:\n    ValueError: If `representative_dataset_path` is not present if integer\n      quantization is requested, or `saved_model_dir`, `concrete_function` or\n      `model` are not provided.\n  \"\"\"\n  if saved_model_dir:\n    converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)\n  elif concrete_function is not None:\n    converter = tf.lite.TFLiteConverter.from_concrete_functions(\n        [concrete_function]\n    )\n  elif model is not None:\n    converter = tf.lite.TFLiteConverter.from_keras_model(model)\n  else:\n    raise ValueError(\n        '`saved_model_dir`, `model` or `concrete_function` must be specified.'\n    )\n\n  if quant_type:\n    if quant_type.startswith('int8'):\n      converter.optimizations = [tf.lite.Optimize.DEFAULT]\n      converter.representative_dataset = functools.partial(\n          representative_dataset,\n          params=params,\n          task=task,\n          calibration_steps=calibration_steps)\n      if quant_type.startswith('int8_full'):\n        converter.target_spec.supported_ops = [\n            tf.lite.OpsSet.TFLITE_BUILTINS_INT8\n        ]\n      if quant_type == 'int8_full':\n        converter.inference_input_type = tf.uint8\n        converter.inference_output_type = tf.uint8","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/serving/export_tflite_lib.py#L115-L151","documentation":"Error \"`saved_model_dir`, `model` or `concrete_function` must be specified.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/serving/export_tflite_lib.py:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide one of saved_model_dir, model, or concrete_function to the TFLite converter.","Pass the trained Keras model directly if no SavedModel directory exists."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}