Commit Graph

2493 Commits

Author SHA1 Message Date
psychedelicious
eaddd6f533 refactor(mm): continue iterating on config 2025-10-13 10:30:06 +11:00
psychedelicious
7ca0a0a0fd tidy(mm): skip optimistic override handling for now 2025-10-13 10:30:06 +11:00
psychedelicious
d185b85fb7 feat(mm): port ip adapter to new api 2025-10-13 10:30:06 +11:00
psychedelicious
a35a49f585 feat(mm): port flux redux to new api 2025-10-13 10:30:06 +11:00
psychedelicious
3b606b6d63 feat(mm): make match helpers more succint 2025-10-13 10:30:05 +11:00
psychedelicious
d89472d3b1 feat(mm): port SigLIPDiffusersConfig to new api 2025-10-13 10:30:05 +11:00
psychedelicious
036ab04376 feat(mm): port CLIPVisionDiffusersConfig to new api 2025-10-13 10:30:05 +11:00
psychedelicious
e1a54badc1 fix(mm): fall back to UnknownModelConfig correctly 2025-10-13 10:30:05 +11:00
psychedelicious
bbecc86d0f tidy(mm): clarify that model id utils are private 2025-10-13 10:30:05 +11:00
psychedelicious
d4823b6869 fix(mm): abstractmethod bork 2025-10-13 10:30:05 +11:00
psychedelicious
3488975b2b refactor(mm): add model config parsing utils 2025-10-13 10:30:05 +11:00
psychedelicious
fd47da6842 refactor(mm): remove unused methods in config.py 2025-10-13 10:30:05 +11:00
psychedelicious
8399de9c25 refactor(mm): simplify model classification process
Previously, we had a multi-phase strategy to identify models from their
files on disk:
1. Run each model config classes' `matches()` method on the files. It
checks if the model could possibly be an identified as the candidate
model type. This was intended to be a quick check. Break on the first
match.
2. If we have a match, run the config class's `parse()` method. It
derive some additional model config attrs from the model files. This was
intended to encapsulate heavier operations that may require loading the
model into memory.
3. Derive the common model config attrs, like name, description,
calculate the hash, etc. Some of these are also heavier operations.

This strategy has some issues:
- It is not clear how the pieces fit together. There is some
back-and-forth between different methods and the config base class. It
is hard to trace the flow of logic until you fully wrap your head around
the system and therefore difficult to add a model architecture to the
probe.
- The assumption that we could do quick, lightweight checks before
heavier checks is incorrect. We often _must_ load the model state dict
in the `matches()` method. So there is no practical perf benefit to
splitting up the responsibility of `matches()` and `parse()`.
- Sometimes we need to do the same checks in `matches()` and `parse()`.
In these cases, splitting the logic is has a negative perf impact
because we are doing the same work twice.
- As we introduce the concept of an "unknown" model config (i.e. a model
that we cannot identify, but still record in the db; see #8582), we will
_always_ run _all_ the checks for every model. Therefore we need not try
to defer heavier checks or resource-intensive ops like hashing. We are
going to do them anyways.
- There are situations where a model may match multiple configs. One
known case are SD pipeline models with merged LoRAs. In the old probe
API, we relied on the implicit order of checks to know that if a model
matched for pipeline _and_ LoRA, we prefer the pipeline match. But, in
the new API, we do not have this implicit ordering of checks. To resolve
this in a resilient way, we need to get all matches up front, then use
tie-breaker logic to figure out which should win (or add "differential
diagnosis" logic to the matchers).
- Field overrides weren't handled well by this strategy. They were only
applied at the very end, if a model matched successfully. This means we
cannot tell the system "Hey, this model is type X with base Y. Trust me
bro.". We cannot override the match logic. As we move towards letting
users correct mis-identified models (see #8582), this is a requirement.

We can simplify the process significantly and better support "unknown"
models.

Firstly, model config classes now have a single `from_model_on_disk()`
method that attempts to construct an instance of the class from the
model files. This replaces the `matches()` and `parse()` methods.

If we fail to create the config instance, a special exception is raised
that indicates why we think the files cannot be identified as the given
model config class.

Next, the flow for model identification is a bit simpler:
- Derive all the common fields up-front (name, desc, hash, etc).
- Merge in overrides.
- Call `from_model_on_disk()` for every config class, passing in the
fields. Overrides are handled in this method.
- Record the results for each config class and choose the best one.

The identification logic is a bit more verbose, with the special
exceptions and handling of overrides, but it is very clear what is
happening.

The one downside I can think of for this strategy is we do need to check
every model type, instead of stopping at the first match. It's a bit
less efficient. In practice, however, this isn't a hot code path, and
the improved clarity is worth far more than perf optimizations that the
end user will likely never notice.
2025-10-13 10:30:05 +11:00
psychedelicious
0fd58681a2 feat(mm): make config_path optional 2025-10-13 10:30:05 +11:00
psychedelicious
250163e6b7 feat(mm): port t5 to new API 2025-10-13 10:30:05 +11:00
psychedelicious
4e2145c6c4 tidy(mm): patcher types and import paths 2025-10-13 10:30:05 +11:00
psychedelicious
8a6d5f4f6a fix(mm): vae class inheritance and config_path 2025-10-13 10:30:05 +11:00
psychedelicious
06dcd290df feat(mm): port vae to new API 2025-10-13 10:30:05 +11:00
psychedelicious
73b6fae00e fix(mm): tis use existing weight_files method 2025-10-13 10:30:05 +11:00
psychedelicious
4ae20f4876 fix(mm): loader for clip embed 2025-10-13 10:30:05 +11:00
psychedelicious
f852c03ba5 fix(mm): parsing for spandrel 2025-10-13 10:30:05 +11:00
psychedelicious
8a14175ab2 feat(mm): port spandrel to new API 2025-10-13 10:30:05 +11:00
psychedelicious
9469bb05fe tidy(mm): remove unused probes 2025-10-13 10:30:05 +11:00
psychedelicious
8036bb0e8f feat(mm): port TIs to new API 2025-10-13 10:30:05 +11:00
psychedelicious
e72c78f7d4 refactor: port MM probes to new api
- Add concept of match certainty to new probe
- Port CLIP Embed models to new API
- Fiddle with stuff
2025-10-13 10:30:05 +11:00
psychedelicious
7cdc821801 tests(mm): fix test for MM, leave the UnknownModelConfig class in the list of configs 2025-10-13 10:30:04 +11:00
psychedelicious
64aaf9880a feat(app): add setting to allow unknown models 2025-10-13 10:30:04 +11:00
psychedelicious
9e509ffb56 feat(mm): omit model description instead of making it "base type filename model" 2025-10-13 10:30:04 +11:00
psychedelicious
8474fd8342 feat(nodes): add unknown as model base 2025-10-13 10:30:04 +11:00
psychedelicious
b26ab0b3f1 refactor(ui): move model categorisation-ish logic to central location, simplify model manager models list 2025-10-13 10:30:03 +11:00
psychedelicious
4ae6c903e3 feat(mm): add UnknownModelConfig 2025-10-13 10:30:03 +11:00
Iq1pl
8c742a6e38 ruff format 2025-09-18 11:05:32 +10:00
Iq1pl
693373f1c1 Update ip_adapter.py
added support for NOOB-IPA-MARK1
2025-09-18 11:05:32 +10:00
psychedelicious
4880a1d946 feat(nodes): accept neg coords for bbox
This actually works fine for SAM.
2025-09-11 12:15:41 +10:00
psychedelicious
f8ad62b5eb tidy(backend) cleanup sam pipelines 2025-09-11 12:15:41 +10:00
psychedelicious
ec1a058dbe fix(backend): issue w/ multiple bbox and sam1 2025-09-11 12:15:41 +10:00
psychedelicious
d828502bc8 refactor(backend): simplify segment anything APIs
There was a really confusing aspect of the SAM pipeline classes where
they accepted deeply nested lists of different dimensions (bbox, points,
and labels).

The lengths of the lists are related; each point must have a
corresponding label, and if bboxes are provided with points, they must
be same length.

I've refactored the backend API to take a single list of SAMInput
objects. This class has a bbox and/or a list of points, making it much
simpler to provide the right shape of inputs.

Internally, the pipeline classes take rejigger these input classes to
have the correct nesting.

The Nodes still have an awkward API where you can provide both bboxes
and points of different lengths, so I added a pydantic validator that
enforces correct lenghts.
2025-09-11 12:15:41 +10:00
psychedelicious
a3625efd3a chore: ruff 2025-09-11 12:15:41 +10:00
Kent Keirsey
42b1adab22 init Sam2 2025-09-11 12:15:41 +10:00
Attila Cseh
df299bb37f python source code reformatted 2025-09-02 19:23:24 +10:00
Attila Cseh
631a04b48c LoRA default weight 2025-09-02 19:23:24 +10:00
psychedelicious
390faa592c chore: ruff 2025-08-28 10:17:00 -04:00
Mary Hipp
7a1c7ca43a add Video as new model type 2025-08-28 10:17:00 -04:00
Mary Hipp
504d8e32be add runway to backend 2025-08-28 10:17:00 -04:00
Mary Hipp
27a2cd19bd add Veo3 model support to backend 2025-08-28 10:17:00 -04:00
Mary Hipp Rogers
56697635dd Revert "add Veo3 model support to backend"
This reverts commit 49d569ec59.
2025-08-28 08:32:47 -04:00
Mary Hipp Rogers
a879880b42 Revert "add runway to backend"
This reverts commit f631b5178f.
2025-08-28 08:32:47 -04:00
Mary Hipp Rogers
9b9b35c315 Revert "add Video as new model type"
This reverts commit fb0a924918.
2025-08-28 08:32:47 -04:00
Mary Hipp Rogers
667e175ab7 Revert "chore: ruff"
This reverts commit 3ae99df091.
2025-08-28 08:32:47 -04:00
psychedelicious
3ae99df091 chore: ruff 2025-08-28 08:23:58 -04:00