unslothai/unsloth · error · HTTPException

dataset_streaming is not supported with train_on_completions

Error message

dataset_streaming is not supported with train_on_completions yet.

What it means

HTTP 422 when dataset_streaming=true and train_on_completions is set: completion-only masking over streamed batches is not implemented yet, so the combination is explicitly rejected (a 'yet' limitation, not a permanent design rule).

Source

Thrown at studio/backend/routes/training.py:1352

                    detail = "dataset_streaming is not supported for vision or audio datasets.",
                )
            if request.is_embedding:
                raise HTTPException(
                    status_code = 400,
                    detail = "dataset_streaming is not supported for embedding training; the embedding loader needs the full dataset.",
                )
            if _hw.DEVICE == _hw.DeviceType.MLX:
                raise HTTPException(
                    status_code = 400,
                    detail = "dataset_streaming is not yet supported on Apple Silicon (MLX); the MLX loader materializes the full dataset.",
                )
            if request.max_steps is None or request.max_steps <= 0:
                raise HTTPException(
                    status_code = 422,
                    detail = "dataset_streaming requires max_steps > 0 because streaming datasets have no known length.",
                )
            if request.train_on_completions:
                raise HTTPException(
                    status_code = 422,
                    detail = "dataset_streaming is not supported with train_on_completions yet.",
                )
            if request.eval_steps > 0:
                train_split = request.train_split or "train"
                if not request.eval_split or request.eval_split == train_split:
                    raise HTTPException(
                        status_code = 422,
                        detail = "dataset_streaming with evaluation requires a separate eval_split.",
                    )
            # Streaming is HF-only: reject when the request also carries a local dataset path or an
            # S3 config, since those sources cannot be streamed via HF's loader.
            if request.local_datasets:
                raise HTTPException(
                    status_code = 400,
                    detail = (
                        "dataset_streaming is HF-only; remove local_datasets / S3 source. "
                        "Streaming is not supported with local file paths."

View on GitHub (pinned to 203007d190)

Solutions

  1. Disable dataset_streaming and keep train_on_completions (dataset is materialized)
  2. Or keep streaming and drop train_on_completions for this run
  3. Track backend releases - the 'yet' indicates planned support

Example fix

// before
{"dataset_streaming": true, "train_on_completions": true}  // 422

// after
{"dataset_streaming": false, "train_on_completions": true}
Defensive patterns

Strategy: validation

Validate before calling

def streaming_config_valid(p: dict) -> bool:
    if not p.get("dataset_streaming"):
        return True
    return not p.get("train_on_completions")

Try / catch

resp = client.post("/training/start", payload)
if resp.status_code == 422 and "train_on_completions" in resp.text:
    # pick one: materialize dataset OR train on full sequences
    payload["dataset_streaming"] = False
    resp = client.post("/training/start", payload)

Prevention

When it happens

Trigger: POST /training/start with dataset_streaming: true and train_on_completions: true.

Common situations: Trying to stream a large instruction dataset while training on completions only (common for chat fine-tuning); combining two memory-saving options that are not yet compatible.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/18a1b7571de57d6c. Report an issue: GitHub.