babysor/MockingBird · error · NotImplementedError
Support only linear or conv1d.
Error message
Support only linear or conv1d.
What it means
The transformer Encoder constructor raises NotImplementedError when positionwise_layer_type is neither 'linear' nor 'conv1d'.
Source
Thrown at models/ppg_extractor/encoder/encoder.py:158
)
elif positionwise_layer_type == "conv1d":
positionwise_layer = MultiLayeredConv1d
positionwise_layer_args = (
attention_dim,
linear_units,
positionwise_conv_kernel_size,
dropout_rate,
)
elif positionwise_layer_type == "conv1d-linear":
positionwise_layer = Conv1dLinear
positionwise_layer_args = (
attention_dim,
linear_units,
positionwise_conv_kernel_size,
dropout_rate,
)
else:
raise NotImplementedError("Support only linear or conv1d.")
if selfattention_layer_type == "selfattn":
logging.info("encoder self-attention layer type = self-attention")
encoder_selfattn_layer = MultiHeadedAttention
encoder_selfattn_layer_args = (
attention_heads,
attention_dim,
attention_dropout_rate,
)
elif selfattention_layer_type == "rel_selfattn":
assert pos_enc_layer_type == "rel_pos"
encoder_selfattn_layer = RelPositionMultiHeadedAttention
encoder_selfattn_layer_args = (
attention_heads,
attention_dim,
attention_dropout_rate,
)
else:View on GitHub (pinned to 28dc5e14f1)
Solutions
- Use 'linear' or 'conv1d'
- Fix typos in the YAML config
Example fix
# before positionwise_layer_type: dwconv # after positionwise_layer_type: linear
Defensive patterns
Strategy: validation
Validate before calling
assert positionwise_layer_type in ('linear', 'conv1d') Try / catch
try:
Encoder(**enc_args)
except NotImplementedError as e:
raise ConfigError(str(e)) from e Prevention
- Validate enums before model construction
- Reject unknown keys in config rather than passing them through
When it happens
Trigger: Constructing the ppg_extractor Encoder with positionwise_layer_type like 'dwconv' or a typo.
Common situations: Copying conformer/ESPnet configs that reference unsupported positionwise layer types.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Support only linear or conv1d.
- unknown pos_enc_layer:
- unknown input_layer:
- unknown encoder_attn_layer:
- unknown pos_enc_layer:
AI-assisted analysis of babysor/MockingBird@28dc5e14f1 (2026-08-27).
Data as JSON: /api/errors/5308ad3cd2f52bbb.
Report an issue: GitHub.