sgl-project/sglang · critical · ValueError
Only 'absolute' position_embedding_type is supported
Error message
Only 'absolute' position_embedding_type is supported
What it means
Model construction error for BERT: only the 'absolute' position_embedding_type is implemented; relative-position variants are rejected.
Solutions
- Set "position_embedding_type": "absolute" in config.json
- Use a BERT checkpoint that was trained with absolute position embeddings
Example fix
// before "position_embedding_type": "sinusoidal" // after "position_embedding_type": "absolute"
Defensive patterns
Strategy: validation
Validate before calling
assert config.position_embedding_type == "absolute"
Prevention
- Use absolute-position BERT checkpoints with this code path
When it happens
Trigger: Loading a BERT config with position_embedding_type set to "sinusoidal", "relative_key", etc.
Common situations: Using a non-standard BERT variant checkpoint; configs produced by conversions that default to a different embedding type.
Related errors
- adaln out_features mismatch
- AfmoeConfig must define `num_experts`.
- Attention backend ' ' is not supported by this attention…
- audio_cap must be non-negative, got
- audio_out_channels must be divisible by tp_size for…
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/78a888946f9e6007.
Report an issue: GitHub.
Appendix: source
Thrown at python/sglang/srt/models/bert.py:47
super().__init__()
self.size = config.hidden_size
self.word_embeddings = VocabParallelEmbedding(
config.vocab_size, config.hidden_size
)
self.position_embeddings = VocabParallelEmbedding(
config.max_position_embeddings, config.hidden_size
)
self.token_type_embeddings = VocabParallelEmbedding(
config.type_vocab_size, config.hidden_size
)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.position_ids = nn.Parameter(
torch.empty((1, config.max_position_embeddings)),
)
self.position_embedding_type = config.position_embedding_type
if self.position_embedding_type != "absolute":
raise ValueError(
"Only 'absolute' position_embedding_type" + " is supported"
)
def forward(
self,
input_ids: torch.Tensor,
positions: torch.Tensor,
forward_batch: ForwardBatch,
) -> torch.Tensor:
input_shape = input_ids.size()
# Input embeddings.
inputs_embeds = self.word_embeddings(input_ids)
# Position embeddings.
position_embeddings = self.position_embeddings(positions)
token_type_ids = forward_batch.token_type_idsView on GitHub (pinned to 0132848349)