tensorflow/models · error · ValueError

`teacher_model_init_checkpoint` is not specified.

Error message

`teacher_model_init_checkpoint` is not specified.

What it means

Error "`teacher_model_init_checkpoint` is not specified." thrown in tensorflow/models.

Source

Thrown at official/projects/edgetpu/nlp/run_mobilebert_edgetpu_train.py:61

      distribution_strategy=experiment_params.runtime.distribution_strategy,
      all_reduce_alg=experiment_params.runtime.all_reduce_alg,
      num_gpus=experiment_params.runtime.num_gpus,
      tpu_address=experiment_params.runtime.tpu_address)

  with distribution_strategy.scope():
    teacher_model = model_builder.build_bert_pretrainer(
        pretrainer_cfg=experiment_params.teacher_model,
        quantization_friendly=False,
        name='teacher')
    student_model = model_builder.build_bert_pretrainer(
        pretrainer_cfg=experiment_params.student_model,
        quantization_friendly=True,
        name='student')

    # Load model weights.
    teacher_ckpt_dir_or_file = experiment_params.teacher_model_init_checkpoint
    if not teacher_ckpt_dir_or_file:
      raise ValueError('`teacher_model_init_checkpoint` is not specified.')
    utils.load_checkpoint(teacher_model, teacher_ckpt_dir_or_file)

    student_ckpt_dir_or_file = experiment_params.student_model_init_checkpoint
    if not student_ckpt_dir_or_file:
      # Makes sure the pretrainer variables are created.
      _ = student_model(student_model.inputs)
      logging.warn('No student checkpoint is provided, training might take '
                   'much longer before converging.')
    else:
      utils.load_checkpoint(student_model, student_ckpt_dir_or_file)

    runner = mobilebert_edgetpu_trainer.MobileBERTEdgeTPUDistillationTrainer(
        teacher_model=teacher_model,
        student_model=student_model,
        strategy=distribution_strategy,
        experiment_params=experiment_params,
        export_ckpt_path=model_dir)

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/edgetpu/nlp/run_mobilebert_edgetpu_train.py:61 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/9d317c6ffaa7eb09. Report an issue: GitHub.