Skip to content

Conversation

psychedelicious
Copy link
Collaborator

@psychedelicious psychedelicious commented Oct 9, 2025

Summary

This PR:

  • Refactors the model manager's identification (aka probing/classification) system. The new system is an evolution of the classify API introduced in Model classification api #7742. All legacy probe logic has been ported over to the new system, too.
  • Introduces the concept of "unknown" models (i.e. a model that we couldn't positively identify) so that a failure to identify a model doesn't require the user to re-download the model.
  • Normalizes model storage into a flat directory structure.
  • Introduces correctness tests for model identification (aka probing/classification). Previously, we did not test for correctness except for a very small number of cases. There is a detailed guide for adding test cases, which is pretty easy.

It adds 3 migrations:

  • Update the models table, removing the UNIQUE constraint on the combination of name, base and model type. The only unique thing for models is now the model's path on disk.
  • Migrate model configs in the DB where necessary.

This PR was previously split into 3 smaller PRs:

TODO

  • Update the model manager UI to let users fix an incorrectly-identified model. This is partially working.
  • Add guide for adding support for a new model type (identification, loading, testing).

Related Issues / Discussions

Gajillions of related issues.

QA Instructions

  • Because this PR does both DB and model file storage migrations, it needs careful testing on backed-up Invoke installs. I will add more detail about how to test it when I do the next alpha release.
  • The new model identification system works differently from the legacy probe and it is likely some things won't identify correctly. We'll need to test installing a variety of models, ideally adding them to the new model identification test suite.

Merge Plan

This will need an alpha release before RC.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added api python PRs that change python files Root invocations PRs that change invocations backend PRs that change backend files services PRs that change app services frontend PRs that change frontend files python-tests PRs that change python tests labels Oct 9, 2025
@psychedelicious psychedelicious force-pushed the psyche/refactor/mm-3 branch 2 times, most recently from 5044e15 to e155f10 Compare October 10, 2025 01:21
Previously a path w/ any of the known weights suffixes would be seen as
a weights file, even if it was a directory. We now check to ensure the
candidate path is actually a file before adding it to the list of
weights.
Overhaul of model identification (probing) tests. Previously we didn't
test the correctness of probing except in a few narrow cases - now we
do.

See tests/model_identification/README.md for a detailed overview of the
new test setup. It includes instructions for adding a new test case. In
brief:

- Download the model you want to add as a test case
- Run a script against it to generate the test model files
- Fill in the expected model type/format/base/etc in the generated test
metadata JSON file

Included test cases:
- All starter models
- A handful of other models that I had installed
- Models present in the previous test cases as smoke tests, now also
tested for correctness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api backend PRs that change backend files frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files python-tests PRs that change python tests Root services PRs that change app services

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant