tensorflow/models · error · ValueError
distill_ground_truth_ratio has to be within [0, 1].
Error message
distill_ground_truth_ratio has to be within [0, 1].
What it means
Error "distill_ground_truth_ratio has to be within [0, 1]." thrown in tensorflow/models.
Source
Thrown at official/projects/mobilebert/distillation.py:164
transfer_teacher_layers = layer_wise_config.transfer_teacher_layers
num_teacher_layers = (
self._task_config.teacher_model.encoder.mobilebert.num_blocks)
num_student_layers = (
self._task_config.student_model.encoder.mobilebert.num_blocks)
if transfer_teacher_layers and len(
transfer_teacher_layers) != num_student_layers:
raise ValueError('The number of `transfer_teacher_layers` %s does not '
'match the number of student layers. %d' %
(transfer_teacher_layers, num_student_layers))
if not transfer_teacher_layers and (num_teacher_layers !=
num_student_layers):
raise ValueError('`transfer_teacher_layers` is not specified, and the '
'number of teacher layers does not match '
'the number of student layers.')
ratio = progressive.pretrain_distill_config.distill_ground_truth_ratio
if ratio < 0 or ratio > 1:
raise ValueError('distill_ground_truth_ratio has to be within [0, 1].')
# A non-trainable layer for feature normalization for transfer loss
self._layer_norm = tf_keras.layers.LayerNormalization(
axis=-1,
beta_initializer='zeros',
gamma_initializer='ones',
trainable=False)
# Build the teacher and student pretrainer model.
self._teacher_pretrainer = self._build_pretrainer(
self._task_config.teacher_model, name='teacher')
self._student_pretrainer = self._build_pretrainer(
self._task_config.student_model, name='student')
base_task.Task.__init__(
self, params=task_config, logging_dir=logging_dir)
policies.ProgressivePolicy.__init__(self)
View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/mobilebert/distillation.py:164 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/2346221dd8009a9d.
Report an issue: GitHub.