tensorflow/models · error · ValueError

A global init_checkpoint and a backbone init_checkpoint cann

Error message

A global init_checkpoint and a backbone init_checkpoint cannot be specified at the same time.

What it means

Error "A global init_checkpoint and a backbone init_checkpoint cannot be specified at the same time." thrown in tensorflow/models.

Source

Thrown at official/projects/pix2seq/tasks/pix2seq_task.py:114

  def initialize(self, model: tf_keras.Model):
    """Loading pretrained checkpoint."""
    if self._task_config.init_checkpoint_modules == 'backbone':
      raise ValueError(
          'init_checkpoint_modules=backbone is no longer supported. Specify'
          ' backbone checkpoints in each backbone config.'
      )

    if self._task_config.init_checkpoint_modules not in ['all', 'partial', '']:
      raise ValueError(
          'Unsupported init_checkpoint_modules: '
          f'{self._task_config.init_checkpoint_modules}'
      )

    if self._task_config.init_checkpoint and any(
        [b.init_checkpoint for b in self._task_config.model.backbones]
    ):
      raise ValueError(
          'A global init_checkpoint and a backbone init_checkpoint cannot be'
          ' specified at the same time.'
      )

    if self._task_config.init_checkpoint:
      global_ckpt_file = self._get_ckpt(self._task_config.init_checkpoint)
      ckpt = tf.train.Checkpoint(**model.checkpoint_items)
      status = ckpt.restore(global_ckpt_file).expect_partial()
      if self._task_config.init_checkpoint_modules != 'partial':
        status.assert_existing_objects_matched()
      logging.info(
          'Finished loading pretrained checkpoint from %s', global_ckpt_file
      )
    else:
      # This case means that no global checkpoint was provided. Possibly,
      # backbone-specific checkpoints were.
      for backbone_config, backbone in zip(
          self._task_config.model.backbones, model.backbones

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/pix2seq/tasks/pix2seq_task.py:114 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/a0ad2883d76e69d4. Report an issue: GitHub.