tensorflow/models · error · ValueError
Model has to be mobilenet-edgetpu model or searchedmodel wit
Error message
Model has to be mobilenet-edgetpu model or searchedmodel with given saved model path.
What it means
Error "Model has to be mobilenet-edgetpu model or searchedmodel with given saved model path." thrown in tensorflow/models.
Source
Thrown at official/projects/edgetpu/vision/tasks/image_classification.py:113
def build_model(self):
"""Builds model for MobileNet-EdgeTPU Task."""
model_config = self.task_config.model
model_params = model_config.model_params.as_dict()
model_name = model_params['model_name']
registered_models = get_models()
if model_name in registered_models:
logging.info('Load MobileNet-EdgeTPU-V1/V2 model.')
logging.info(model_params)
model = registered_models[model_name](**model_params)
elif model_name == 'mobilenet_edgetpu_search':
if self.task_config.saved_model_path is None:
raise ValueError('If using MobileNet-EdgeTPU-Search model, please'
'specify the saved model path via the'
'--params_override flag.')
logging.info('Load saved model (model from search) directly.')
model = load_searched_model(self.task_config.saved_model_path)
else:
raise ValueError('Model has to be mobilenet-edgetpu model or searched'
'model with given saved model path.')
return model
def initialize(self, model: tf_keras.Model):
"""Loads pretrained checkpoint."""
if not self.task_config.init_checkpoint:
return
ckpt_dir_or_file = self.task_config.init_checkpoint
if tf.io.gfile.isdir(ckpt_dir_or_file):
ckpt_dir_or_file = tf.train.latest_checkpoint(ckpt_dir_or_file)
# Restoring checkpoint.
if self.task_config.init_checkpoint_modules == 'all':
ckpt = tf.train.Checkpoint(**model.checkpoint_items)
status = ckpt.read(ckpt_dir_or_file)
status.expect_partial().assert_existing_objects_matched()View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/edgetpu/vision/tasks/image_classification.py:113 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/15ecdeb0cfb6bcf5.
Report an issue: GitHub.