{"record":{"id":"a08def36a3c2747b","repo":"tensorflow/models","slug":"task-not-supported","errorCode":null,"errorMessage":"Task {} not supported.","messagePattern":"Task (.+?) not supported\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/serving/export_tflite_lib.py","lineNumber":57,"sourceCode":"    A tf.data.Dataset instance.\n\n  Raises:\n    ValueError: If task is not supported.\n  \"\"\"\n  if task is None:\n    if isinstance(params.task,\n                  configs.image_classification.ImageClassificationTask):\n\n      task = tasks.image_classification.ImageClassificationTask(params.task)\n    elif isinstance(params.task, configs.retinanet.RetinaNetTask):\n      task = tasks.retinanet.RetinaNetTask(params.task)\n    elif isinstance(params.task, configs.maskrcnn.MaskRCNNTask):\n      task = tasks.maskrcnn.MaskRCNNTask(params.task)\n    elif isinstance(params.task,\n                    configs.semantic_segmentation.SemanticSegmentationTask):\n      task = tasks.semantic_segmentation.SemanticSegmentationTask(params.task)\n    else:\n      raise ValueError('Task {} not supported.'.format(type(params.task)))\n  # Ensure batch size is 1 for TFLite model.\n  params.task.train_data.global_batch_size = 1\n  params.task.train_data.dtype = 'float32'\n  logging.info('Task config: %s', params.task.as_dict())\n  return task.build_inputs(params=params.task.train_data)\n\n\ndef representative_dataset(\n    params: cfg.ExperimentConfig,\n    task: Optional[base_task.Task] = None,\n    calibration_steps: int = 2000) -> Iterator[List[tf.Tensor]]:\n  \"\"\"\"Creates representative dataset for input calibration.\n\n  Args:\n    params: An ExperimentConfig.\n    task: An optional task instance. If it is None, task will be built according\n      to the task type in params.\n    calibration_steps: The steps to do calibration.","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/serving/export_tflite_lib.py#L39-L75","documentation":"Error \"Task {} not supported.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/serving/export_tflite_lib.py:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported task for TFLite export (e.g. 'classification', 'detection', 'segmentation').","Check the task name passed to the TFLite export library."],"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"}