Skip to content

[Studio] On Device models take 15–25 seconds to appear after startup #7849

Closed

Description

@Imagineer99

Problem

Immediately after Unsloth Studio starts, the model picker’s On Device tab remains empty/loading for a noticeable period even though downloaded and fine-tuned models are already present on disk. The models eventually appear without user intervention.

This makes startup look as though the local models are missing.

Reproduction

  1. Use a Hugging Face cache containing a substantial number of repositories.
  2. Start Unsloth Studio.
  3. Open the model selector immediately.
  4. Select On Device.
  5. Observe that downloaded/local models do not populate until the inventory scans finish.

The reproduced cache contained 405 repositories.

Measured behavior

A fresh UI load produced these server timings:

Endpoint First request
GET /api/hub/cached-models 15,238.72 ms
GET /api/hub/cached-gguf 15,240.30 ms
GET /api/hub/local 24,926.70 ms

The cached-model scan logged:

Cached model scan: inspected=405 skipped_gguf=21 skipped_no_weights=0 skipped_stt=0 returned=38

Opening/mounting the picker also queued a forced inventory refresh after the cold fetch. That produced another scan:

Endpoint Queued refresh
GET /api/hub/cached-models 8,553.29 ms
GET /api/hub/cached-gguf 8,550.02 ms
GET /api/hub/local 1,914.21 ms

Cause

The picker obtains On Device rows from three inventory sources:

  • cached Hugging Face models
  • cached GGUF models
  • local/custom/fine-tuned model locations

The backend inventory endpoints independently walk overlapping Hugging Face cache state. The local inventory collector also awaits its model directory, active HF cache, legacy/default/previous caches, LM Studio, and Ollama source scans sequentially.

On the frontend, HubModelPicker calls refreshInventory() when it mounts even though useChatPickerInventory({ enabled: true }) has already started the cold inventory requests. The force queue waits for the active request and then performs another full refresh.

Relevant areas:

  • studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
  • studio/frontend/src/features/hub/inventory/use-device-inventory.ts
  • studio/backend/hub/services/models/cache_inventory.py
  • studio/backend/hub/services/models/local_inventory.py

Expected behavior

Known On Device models should appear promptly after startup. Opening the picker should not queue a second full scan while the initial inventory request is still in flight.

For large caches, the UI should retain or restore the last known inventory while a background refresh validates it.

Potential improvements

  • Coalesce the picker mount refresh with an already-running cold inventory fetch instead of force-queuing another scan.
  • Reuse a shared HF cache scan result across cached-model, cached-GGUF, and local inventory consumers.
  • Parallelize independent local source scans where safe.
  • Cache the normalized inventory briefly and invalidate it through existing inventory-version events.
  • Continue showing the last known rows during startup/background revalidation.
  • Add a startup performance test with a synthetic large cache and assert that one picker mount performs only one inventory scan per source.

This is a local inventory performance/UX issue; model loading and GPU memory are not involved.

Activity

  1. added 2 commits that reference this issue on Aug 7, 2026
    e1ad460
    37b3dcf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions