{"record":{"id":"a0ad2883d76e69d4","repo":"tensorflow/models","slug":"a-global-init-checkpoint-and-a-backbone-init-check","errorCode":null,"errorMessage":"A global init_checkpoint and a backbone init_checkpoint cannot be specified at the same time.","messagePattern":"A global init_checkpoint and a backbone init_checkpoint cannot be specified at the same time\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/pix2seq/tasks/pix2seq_task.py","lineNumber":114,"sourceCode":"\n  def initialize(self, model: tf_keras.Model):\n    \"\"\"Loading pretrained checkpoint.\"\"\"\n    if self._task_config.init_checkpoint_modules == 'backbone':\n      raise ValueError(\n          'init_checkpoint_modules=backbone is no longer supported. Specify'\n          ' backbone checkpoints in each backbone config.'\n      )\n\n    if self._task_config.init_checkpoint_modules not in ['all', 'partial', '']:\n      raise ValueError(\n          'Unsupported init_checkpoint_modules: '\n          f'{self._task_config.init_checkpoint_modules}'\n      )\n\n    if self._task_config.init_checkpoint and any(\n        [b.init_checkpoint for b in self._task_config.model.backbones]\n    ):\n      raise ValueError(\n          'A global init_checkpoint and a backbone init_checkpoint cannot be'\n          ' specified at the same time.'\n      )\n\n    if self._task_config.init_checkpoint:\n      global_ckpt_file = self._get_ckpt(self._task_config.init_checkpoint)\n      ckpt = tf.train.Checkpoint(**model.checkpoint_items)\n      status = ckpt.restore(global_ckpt_file).expect_partial()\n      if self._task_config.init_checkpoint_modules != 'partial':\n        status.assert_existing_objects_matched()\n      logging.info(\n          'Finished loading pretrained checkpoint from %s', global_ckpt_file\n      )\n    else:\n      # This case means that no global checkpoint was provided. Possibly,\n      # backbone-specific checkpoints were.\n      for backbone_config, backbone in zip(\n          self._task_config.model.backbones, model.backbones","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/pix2seq/tasks/pix2seq_task.py#L96-L132","documentation":"Error \"A global init_checkpoint and a backbone init_checkpoint cannot be specified at the same time.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/pix2seq/tasks/pix2seq_task.py:114 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"}