tensorflow/models · error · ValueError
Decoder version cannot be None, specify v3 or v4.
Error message
Decoder version cannot be None, specify v3 or v4.
What it means
Guard in build_yolo_decoder: the decoder config's version field is None. Version selects which YOLO decoder topology (v3 or v4) to build; None is the sentinel for a fully custom decoder, but this factory implements only the standard topologies, so it cannot proceed. The config must pin a version or supply an explicit YoloDecoder config instead of the factory path.
Solutions
- Set decoder.version to 'v3' or 'v4' in the experiment YAML
- For a custom architecture, bypass the factory and specify an explicit YoloDecoder config in the yaml
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/yolo/modeling/decoders/yolo_decoder.py:601 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/fdbbccb03ebb2c61.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/yolo/modeling/decoders/yolo_decoder.py:601
input_specs: A `dict` of input specifications. A dictionary consists of
{level: TensorShape} from a backbone.
model_config: A OneOfConfig. Model config.
l2_regularizer: A `tf_keras.regularizers.Regularizer` instance. Default to
None.
**kwargs: Additional kwargs arguments.
Returns:
A `tf_keras.Model` instance of the Yolo FPN/PAN decoder.
"""
decoder_cfg = model_config.decoder.get()
norm_activation_config = model_config.norm_activation
activation = (
decoder_cfg.activation if decoder_cfg.activation != 'same' else
norm_activation_config.activation)
if decoder_cfg.version is None: # custom yolo
raise ValueError('Decoder version cannot be None, specify v3 or v4.')
if decoder_cfg.version not in YOLO_MODELS:
raise ValueError(
'Unsupported model version please select from {v3, v4}, '
'or specify a custom decoder config using YoloDecoder in you yaml')
if decoder_cfg.type is None:
decoder_cfg.type = 'regular'
if decoder_cfg.type not in YOLO_MODELS[decoder_cfg.version]:
raise ValueError('Unsupported model type please select from '
'{yolo_model.YOLO_MODELS[decoder_cfg.version].keys()}'
'or specify a custom decoder config using YoloDecoder.')
base_model = YOLO_MODELS[decoder_cfg.version][decoder_cfg.type].copy()
cfg_dict = decoder_cfg.as_dict()
for key in base_model:View on GitHub (pinned to e006f5f0d5)