unslothai/unsloth · info · SttLoadCancelledError

STT model loading was cancelled so training could start.

Error message

STT model loading was cancelled so training could start.

What it means

Raised by _raise_if_load_cancelled when the load-cancel event for an in-progress STT model load is set. Its purpose, per the message, is to abort model loading so GPU/CPU memory is freed for training to start — load paths check the event at defined checkpoints.

Source

Thrown at studio/backend/core/inference/stt_sidecar.py:1229

    def _begin_load(self, owner: Optional[threading.Event] = None) -> threading.Event:
        event = owner if owner is not None else threading.Event()
        with self._load_state_lock:
            self._load_cancel_event = event
            self._load_owner_cancel_event = owner
            self._loading = True
        return event

    def _end_load(self, event: threading.Event) -> None:
        with self._load_state_lock:
            if self._load_cancel_event is event:
                self._load_cancel_event = None
                self._load_owner_cancel_event = None
                self._loading = False

    @staticmethod
    def _raise_if_load_cancelled(event: threading.Event) -> None:
        if event.is_set():
            raise SttLoadCancelledError("STT model loading was cancelled so training could start.")

    @property
    def keep_alive_seconds(self) -> float:
        return self._keep_alive_seconds

    def _cancel_idle_unload_locked(self) -> None:
        self._idle_generation += 1
        timer = self._idle_timer
        self._idle_timer = None
        if timer is not None:
            timer.cancel()

    def _schedule_idle_unload_locked(self) -> None:
        self._cancel_idle_unload_locked()
        if self._engine is None or self._keep_alive_seconds <= 0:
            return
        generation = self._idle_generation
        timer = threading.Timer(

View on GitHub (pinned to 203007d190)

Solutions

  1. Nothing is wrong: catch SttLoadCancelledError and retry load() after training starts or finishes, since memory priority resolved the conflict.
  2. If loads are cancelled constantly, schedule STT loads when no training run is queued instead of racing them.
  3. Give the sidecar its own device/resource budget so training admission does not need to cancel loads.

Example fix

# before
engine = sidecar.load(model)  # raises SttLoadCancelledError under training
# after
try:
    engine = sidecar.load(model)
except SttLoadCancelledError:
    schedule_retry_after_training(); return
Defensive patterns

Strategy: retry

Try / catch

try:
    engine = sidecar.load(model)
except SttLoadCancelledError:
    engine = None  # retry after training settles
    schedule_stt_load_retry()

Prevention

When it happens

Trigger: A training job requests GPU while load() is mid-flight: the training scheduler sets the sidecar's load cancel event, and the next checkpoint inside load (after download check, after _pick_device, around model build) raises SttLoadCancelledError.

Common situations: Studio apps where dictation and training share one GPU; user starts training while a Whisper model is still loading; preemption logic that cancels STT loads whenever a training run is admitted.

Related errors


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