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/fffner/fffner_prediction.py:81

      default_factory=cfg.DataConfig
  )


@task_factory.register_task_cls(FFFNerPredictionConfig)
class FFFNerTask(base_task.Task):
  """Task object for FFFNer."""

  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
    self.label_field_is_entity = 'is_entity_label'
    self.label_field_entity_type = 'entity_type_label'

  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()
    if self.task_config.model.encoder.type == 'xlnet':
      assert False, 'Not supported yet'
    else:
      return fffner_classifier.FFFNerClassifier(
          # encoder_network.inputs
          network=encoder_network,
          num_classes_is_entity=self.task_config.model.num_classes_is_entity,
          num_classes_entity_type=self.task_config.model
          .num_classes_entity_type,
          initializer=tf_keras.initializers.TruncatedNormal(
              stddev=encoder_cfg.initializer_range),

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/fffner/fffner_prediction.py:81 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/c788ff32067da0e5. Report an issue: GitHub.