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/mobilebert/distillation.py:591
"""Checkpoints for model, stage_id, optimizer for preemption handling."""
return dict(
stage_id=self._stage_id,
volatiles=self._volatiles,
student_pretrainer=self._student_pretrainer,
teacher_pretrainer=self._teacher_pretrainer,
encoder=self._student_pretrainer.encoder_network)
def initialize(self, model):
"""Loads teacher's pretrained checkpoint and copy student's embedding."""
# This function will be called when no checkpoint found for the model,
# i.e., when the training starts (not preemption case).
# The weights of teacher pretrainer and student pretrainer will be
# initialized, rather than the passed-in `model`.
del model
logging.info('Begin to load checkpoint for teacher pretrainer model.')
ckpt_dir_or_file = self._task_config.teacher_model_init_checkpoint
if not ckpt_dir_or_file:
raise ValueError('`teacher_model_init_checkpoint` is not specified.')
if tf.io.gfile.isdir(ckpt_dir_or_file):
ckpt_dir_or_file = tf.train.latest_checkpoint(ckpt_dir_or_file)
# Makes sure the teacher pretrainer variables are created.
_ = self._teacher_pretrainer(self._teacher_pretrainer.inputs)
teacher_checkpoint = tf.train.Checkpoint(
**self._teacher_pretrainer.checkpoint_items)
teacher_checkpoint.read(ckpt_dir_or_file).assert_existing_objects_matched()
logging.info('Begin to copy word embedding from teacher model to student.')
teacher_encoder = self._teacher_pretrainer.encoder_network
student_encoder = self._student_pretrainer.encoder_network
embedding_weights = teacher_encoder.embedding_layer.get_weights()
student_encoder.embedding_layer.set_weights(embedding_weights)
View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/mobilebert/distillation.py:591 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/6e8c7269cb8f07a1.
Report an issue: GitHub.