tensorflow/models · error · ValueError
Unsupported `label_type`. Given: %s, expected `int` or `floa
Error message
Unsupported `label_type`. Given: %s, expected `int` or `float`.
What it means
Error "Unsupported `label_type`. Given: %s, expected `int` or `float`." thrown in tensorflow/models.
Source
Thrown at official/nlp/finetuning/binary_helper.py:277
Args:
task: `Task` instance.
model: `keras.Model` instance.
input_file: Input test data file path.
output_file: Output test data file path.
predict_batch_size: Batch size for prediction.
seq_length: Input sequence length.
class_names: List of string class names.
label_type: String denoting label type ('int', 'float'), defaults to 'int'.
min_float_value: If set, predictions will be min-clipped to this value (only
for regression when `label_type` is set to 'float'). Defaults to `None`
(no clipping).
max_float_value: If set, predictions will be max-clipped to this value (only
for regression when `label_type` is set to 'float'). Defaults to `None`
(no clipping).
"""
if label_type not in ('int', 'float'):
raise ValueError('Unsupported `label_type`. Given: %s, expected `int` or '
'`float`.' % label_type)
data_config = sentence_prediction_dataloader.SentencePredictionDataConfig(
input_path=input_file,
global_batch_size=predict_batch_size,
is_training=False,
seq_length=seq_length,
label_type=label_type,
drop_remainder=False,
include_example_id=True)
predictions = sentence_prediction.predict(task, data_config, model)
if label_type == 'float':
min_float_value = (-sys.float_info.max
if min_float_value is None else min_float_value)
max_float_value = (
sys.float_info.max if max_float_value is None else max_float_value)
View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/nlp/finetuning/binary_helper.py:277 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/6fbd7e001f0d6c5c.
Report an issue: GitHub.