Comfy-Org/ComfyUI · error · NotImplementedError
Scalar feature is not implemented yet.
Error message
Scalar feature is not implemented yet.
What it means
The Cosmos model forward() accepts an optional scalar_feature tensor, but the code path is intentionally unimplemented: passing anything other than None immediately raises NotImplementedError. Scalar (per-timestep conditioning vector) features from upstream NVIDIA Cosmos configs are simply not wired into this ComfyUI port.
Source
Thrown at comfy/ldm/cosmos/model.py:384
data_type, DataType
), f"Expected DataType, got {type(data_type)}. We need discuss this flag later."
original_shape = x.shape
x_B_T_H_W_D, rope_emb_L_1_1_D, extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D = self.prepare_embedded_sequence(
x,
fps=fps,
padding_mask=padding_mask,
latent_condition=latent_condition,
latent_condition_sigma=latent_condition_sigma,
)
# logging affline scale information
affline_scale_log_info = {}
timesteps_B_D, adaln_lora_B_3D = self.t_embedder[1](self.t_embedder[0](timesteps.flatten()).to(x.dtype))
affline_emb_B_D = timesteps_B_D
affline_scale_log_info["timesteps_B_D"] = timesteps_B_D.detach()
if scalar_feature is not None:
raise NotImplementedError("Scalar feature is not implemented yet.")
affline_scale_log_info["affline_emb_B_D"] = affline_emb_B_D.detach()
affline_emb_B_D = self.affline_norm(affline_emb_B_D)
if self.use_cross_attn_mask:
if crossattn_mask is not None and not torch.is_floating_point(crossattn_mask):
crossattn_mask = (crossattn_mask - 1).to(x.dtype) * torch.finfo(x.dtype).max
crossattn_mask = crossattn_mask[:, None, None, :] # .to(dtype=torch.bool) # [B, 1, 1, length]
else:
crossattn_mask = None
if self.blocks["block0"].x_format == "THWBD":
x = rearrange(x_B_T_H_W_D, "B T H W D -> T H W B D")
if extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D is not None:
extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D = rearrange(
extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D, "B T H W D -> T H W B D"
)
crossattn_emb = rearrange(crossattn_emb, "B M D -> M B D")View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Do not pass scalar_feature; forward only timesteps, x, and crossattn/latent conditioning that this model consumes.
- If porting a Cosmos variant that needs scalar features, extend forward() yourself (embed scalar_feature and add it to affline_emb_B_D) — no stock path supports it.
- Filter unknown conditioning keys at the custom-node boundary instead of forwarding upstream kwargs blindly.
Example fix
# before
out = model(x, timesteps, scalar_feature=feat, **upstream_kwargs)
# after
kwargs = {k: v for k, v in upstream_kwargs.items() if k != "scalar_feature"}
out = model(x, timesteps, **kwargs) Defensive patterns
Strategy: validation
Validate before calling
kwargs.pop("scalar_feature", None) # unsupported conditioning key; never forward it
out = model(x, timesteps, **kwargs) Prevention
- Filter conditioning kwargs at the node boundary instead of forwarding upstream model kwargs verbatim.
- Treat NotImplementedError from model forwards as an API contract signal: the input is not supported, do not retry.
When it happens
Trigger: Calling the Cosmos model forward with scalar_feature as a non-None tensor, e.g. when a custom node forwards upstream model kwargs verbatim and the checkpoint config declares scalar features (some Cosmos predict/video-world-model variants).
Common situations: Porting a Cosmos variant that uses scalar conditioning (e.g. camera or motion scalar inputs); a custom node that passes a conditioning dict through as **kwargs without filtering unsupported keys.
Related errors
- Input img and txt tensors must have 3 dimensions.
- Input txt tensors must have 3 dimensions.
- Unknown block type: {self.block_type}
- Unknown x_format {self.blocks[0].x_format}
- HiDreamO1Transformer requires input_ids and position_ids in
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/11ab319642a4d816.
Report an issue: GitHub.