Skip to content

Defer heavy model imports to reduce cold start and RAM at boot #6

@rosspeili

Description

@rosspeili

Problem

OPSIIE_0_3_80_XP.py imports transformers (BLIP), diffusers, torch, torchaudio, face_recognition, DeepFace, etc. at module top (lines ~10–41). docs/ARCHITECTURE.md already calls out “heavy imports first.” This hurts time-to-interactive and headless/CI scenarios.

Goal

Lazy-import or factory-init for expensive stacks (e.g. BLIP URL vision, Stable Diffusion /video, music) on first use, with clear logging when a stack is loading.

Acceptance criteria

  • Measure before/after: time from process start to first prompt (document in PR).
  • No user-visible command regression without an opt-in “preload” if you add one.
  • Document any new first-hit latency in docs/TROUBLESHOOTING.md or architecture doc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions