{"record":{"id":"962095154e7d8e35","repo":"tensorflow/models","slug":"only-backbone-projection-or-backbone-can-be-us","errorCode":null,"errorMessage":"Only 'backbone_projection' or 'backbone' can be used to initialize the model.","messagePattern":"Only 'backbone_projection' or 'backbone' can be used to initialize the model\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/simclr/modeling/multitask_model.py","lineNumber":113,"sourceCode":"\n    return tasks\n\n  def initialize(self):\n    \"\"\"Loads the multi-task SimCLR model with a pretrained checkpoint.\"\"\"\n    ckpt_dir_or_file = self._config.init_checkpoint\n    if tf.io.gfile.isdir(ckpt_dir_or_file):\n      ckpt_dir_or_file = tf.train.latest_checkpoint(ckpt_dir_or_file)\n    if not ckpt_dir_or_file:\n      return\n\n    logging.info('Loading pretrained %s', self._config.init_checkpoint_modules)\n    if self._config.init_checkpoint_modules == 'backbone':\n      pretrained_items = dict(backbone=self._backbone)\n    elif self._config.init_checkpoint_modules == 'backbone_projection':\n      pretrained_items = dict(\n          backbone=self._backbone, projection_head=self._projection_head)\n    else:\n      raise ValueError(\n          \"Only 'backbone_projection' or 'backbone' can be used to \"\n          'initialize the model.')\n\n    ckpt = tf.train.Checkpoint(**pretrained_items)\n    status = ckpt.read(ckpt_dir_or_file)\n    status.expect_partial().assert_existing_objects_matched()\n    logging.info('Finished loading pretrained checkpoint from %s',\n                 ckpt_dir_or_file)\n\n  @property\n  def checkpoint_items(self):\n    \"\"\"Returns a dictionary of items to be additionally checkpointed.\"\"\"\n    return dict(backbone=self._backbone, projection_head=self._projection_head)\n","sourceCodeStart":95,"sourceCodeEnd":127,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/simclr/modeling/multitask_model.py#L95-L127","documentation":"Error \"Only 'backbone_projection' or 'backbone' can be used to initialize the model.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/simclr/modeling/multitask_model.py:113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}