Skip to content

feat: SCRIBERR_ENABLED_MODELS to skip initializing unused models - #474

Open
Swahjak wants to merge 1 commit into
rishikanthc:mainfrom
Swahjak:feat/enabled-models-env
Open

feat: SCRIBERR_ENABLED_MODELS to skip initializing unused models#474
Swahjak wants to merge 1 commit into
rishikanthc:mainfrom
Swahjak:feat/enabled-models-env

Conversation

@Swahjak

@Swahjak Swahjak commented Aug 20, 2026

Copy link
Copy Markdown

Closes #473

Motivation

On startup ModelRegistry.InitializeModels calls PrepareEnvironment on every registered adapter, regardless of which model the user actually runs. For a setup that only transcribes through an OpenAI-compatible endpoint, first boot still installs the Python environments (uv sync, torch/CUDA) and downloads the weights for WhisperX, Parakeet, Canary, Voxtral, PyAnnote and Sortformer — several GB of disk and a long wait for models that will never be used.

What this adds

A new environment variable, SCRIBERR_ENABLED_MODELS, holding a comma separated list of model IDs:

# cloud transcription only, no local model environments
SCRIBERR_ENABLED_MODELS=openai_whisper

# local WhisperX with PyAnnote diarization
SCRIBERR_ENABLED_MODELS=whisperx,pyannote

Valid IDs are the registered adapter IDs: whisperx, parakeet, canary, voxtral, openai_whisper, pyannote, sortformer.

Behaviour

  • Unset or empty: nothing changes. Every registered model is prepared on startup exactly as today, so existing installs are unaffected.
  • When set, InitializeModels only calls PrepareEnvironment on adapters whose ID is in the list. Skipped adapters get no uv sync, no weight download, no PrepareEnvironment call at all — just a log line saying they were skipped.
  • Skipped adapters stay registered. They remain resolvable through GetTranscriptionAdapter / GetDiarizationAdapter and stay listed in the UI and API, so nothing breaks if a model is looked up by capability.
  • To keep a skipped model from failing when someone does select it, EnsureModelReady(ctx, modelID) prepares such a model on demand right before the job runs it (once, guarded by a mutex so concurrent jobs cannot install the same environment twice). For models that were initialized at startup, and whenever the variable is unset, this is a no-op.

Implementation

  • internal/config: parses SCRIBERR_ENABLED_MODELS into Config.EnabledModels alongside the other env vars.
  • cmd/server/main.go: passes it to the registry in registerAdapters.
  • internal/transcription/registry: SetEnabledModels, the init-time filter, and EnsureModelReady for on-demand preparation.
  • internal/transcription/unified_service.go: calls EnsureModelReady before transcription and before separate diarization.
  • README: new row in the environment variable table plus a short section explaining the trade-off.

Testing

  • go build ./... and go vet ./... clean.
  • New internal/transcription/registry/registry_test.go covers the default (all models prepared), the filtered case (disabled model never prepared but still registered), and on-demand preparation happening exactly once.
  • go test ./internal/... ./tests/... passes apart from TestListTranscriptionJobsDeltaSync, which fails on unmodified main as well.
  • The Docker-based model download path was not exercised locally.

InitializeModels prepared every registered adapter on startup, so a
cloud-only setup still installed the local Python environments and
downloaded weights for WhisperX, Parakeet, Canary, Voxtral, PyAnnote and
Sortformer.

SCRIBERR_ENABLED_MODELS takes a comma separated list of model IDs and
limits startup preparation to those models. Unset or empty keeps the
current behaviour of preparing everything. Skipped models stay
registered and are prepared on demand the first time a job uses them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: configurable model init to skip unused local transcription/diarization models

1 participant