xai-org/x-algorithm · error · ValueError
{mask_name}: seq len {is_candidate.shape[1]} != multi-hot {s
Error message
{mask_name}: seq len {is_candidate.shape[1]} != multi-hot {seq_len} What it means
The candidate mask's per-row sequence length must equal the sequence length of the multi-hot column (list_size). If the reshaped mask has a different second dimension, the element-wise np.where fold would broadcast incorrectly, so ValueError is raised naming the mask column and both lengths.
Source
Thrown at phoenix/xrex/data/conversion_labels.py:116
.to_numpy(zero_copy_only=False)
.astype(np.bool_)
.reshape(batch.num_rows, seq_len, vocab)
.copy()
)
mask_name = next(
(n for n in ("newEventMask", "newEventMaskSeq") if n in batch.schema.names), None
)
if mask_name is None:
raise ValueError("batch missing newEventMask; conversion-label folding is candidate-only")
mask_col = batch.column(mask_name)
is_candidate = (
mask_col.flatten()
.to_numpy(zero_copy_only=False)
.astype(np.bool_)
.reshape(batch.num_rows, mask_col.type.list_size)
)
if is_candidate.shape[1] != seq_len:
raise ValueError(f"{mask_name}: seq len {is_candidate.shape[1]} != multi-hot {seq_len}")
for name in action_cols:
idx = action_index_of(name)
if idx >= vocab:
raise ValueError(f"{name}: bit {idx} outside vocab {vocab}")
delays_col = batch.column(name)
delays = (
delays_col.flatten()
.to_numpy(zero_copy_only=False)
.astype(np.int64)
.reshape(batch.num_rows, delays_col.type.list_size)
)
if delays.shape[1] != seq_len:
raise ValueError(f"{name}: seq len {delays.shape[1]} != multi-hot {seq_len}")
bits[:, :, idx] = np.where(
is_candidate, delays_to_labels(delays, window_ms), bits[:, :, idx]
)
inner = pa.FixedSizeListArray.from_arrays(pa.array(bits.reshape(-1)), vocab)
outer = pa.FixedSizeListArray.from_arrays(inner, seq_len)View on GitHub (pinned to 24c60942c5)
Solutions
- Regenerate the dataset so mask and multi-hot share the same sequence length.
- Rebuild the batch with consistent FixedSizeList types before folding.
- Skip folding for batches whose schema lengths disagree.
Example fix
// before: mask seq 32, multihot seq 64 batch = fold_action_delays_into_multihot(batch, w) # ValueError // after: regenerate data with seq_len consistent (e.g. both 64) batch = fold_action_delays_into_multihot(batch_fixed, w)
Defensive patterns
Strategy: validation
Validate before calling
seq = batch.column(batch.schema.get_field_index(ACTION_MULTIHOT_COLUMN)).type.list_size
mask = next(n for n in ('newEventMask','newEventMaskSeq') if n in batch.schema.names)
assert batch.column(mask).type.list_size == seq Type guard
def seq_lens_consistent(batch) -> bool:
lens = {batch.schema.field(n).type.list_size for n in batch.schema.names
if pa.types.is_fixed_size_list(batch.schema.field(n).type)}
return len(lens) <= 1 Try / catch
try:
batch = fold_action_delays_into_multihot(batch, w)
except ValueError as e:
raise RuntimeError(f'bad batch schema: {e}') from e Prevention
- Pin sequence length in pipeline config and validate every FixedSizeList width on write.
- Reject mixed-schema batches at concatenation time.
When it happens
Trigger: Batch where newEventMask has seq len 32 but the multi-hot list_size is 64; schema evolution changing sequence length for one column but not the other; mixing columns from different feature versions into one batch.
Common situations: Mid-migration datasets where sequence length changed; concatenating batches with inconsistent FixedSizeList widths.
Related errors
- {name}: seq len {delays.shape[1]} != multi-hot {seq_len}
- {key}: got {arr.shape}/{arr.dtype}, manifest says {meta['sha
- Tensor {name!r}: checkpoint has shape {tuple(t.shape)}, but
- block-sparse arrays cover {bs_num_blocks} m-tiles but the ke
- {tensor_name}{context_clause} with shape {tensor.shape} cann
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/ae461716acc79593.
Report an issue: GitHub.