tensorflow/models · error · ValueError

At most one of `hub_module_url` and `init_checkpoint` can be

Error message

At most one of `hub_module_url` and `init_checkpoint` can be specified.

What it means

Error "At most one of `hub_module_url` and `init_checkpoint` can be specified." thrown in tensorflow/models.

Source

Thrown at official/projects/lra/lra_dual_encoder_task.py:85


@task_factory.register_task_cls(DualEncoderConfig)
class DualEncoderTask(base_task.Task):
  """Task object for DualEncoderTask."""

  def __init__(self, params: cfg.TaskConfig, logging_dir=None, name=None):
    super().__init__(params, logging_dir, name=name)
    if params.metric_type not in METRIC_TYPES:
      raise ValueError('Invalid metric_type: {}'.format(params.metric_type))
    self.metric_type = params.metric_type
    if hasattr(params.train_data, 'label_field'):
      self.label_field = params.train_data.label_field
    else:
      self.label_field = 'label_ids'

  def build_model(self):
    if self.task_config.hub_module_url and self.task_config.init_checkpoint:
      raise ValueError(
          'At most one of `hub_module_url` and '
          '`init_checkpoint` can be specified.'
      )
    if self.task_config.hub_module_url:
      encoder_network = utils.get_encoder_from_hub(
          self.task_config.hub_module_url
      )
    else:
      encoder_network = encoders.build_encoder(self.task_config.model.encoder)
    encoder_cfg = self.task_config.model.encoder.get()

    return lra_dual_encoder.LRADualEncoder(
        network=encoder_network,
        max_seq_length=self.task_config.model.max_seq_length,
        num_classes=self.task_config.model.num_classes,
        initializer=tf_keras.initializers.TruncatedNormal(
            stddev=encoder_cfg.initializer_range
        ),

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/lra/lra_dual_encoder_task.py:85 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/b3e2e4fe6cefa2c9. Report an issue: GitHub.