-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui): metadata recall backcompat #5782
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
api
python
PRs that change python files
frontend
PRs that change frontend files
labels
Feb 23, 2024
psychedelicious
force-pushed
the
feat/ui/metadata-backcompat-2
branch
2 times, most recently
from
February 25, 2024 23:27
ebfcbf1
to
907dcf7
Compare
psychedelicious
requested review from
blessedcoolant,
maryhipp,
hipsterusername and
brandonrising
as code owners
February 26, 2024 11:14
Gets the first model that matches the given name, base and type. Raises 404 if there isn't one. This will be used for backwards compatibility with old metadata.
Add concepts for metadata handlers. Handlers include parsers, recallers and validators for different metadata types: - Parsers parse a raw metadata object of any shape to a structured object. - Recallers load the parsed metadata into state. Recallers are optional, as some metadata types don't need to be loaded into state. - Validators provide an additional layer of validation before recalling the metadata. This is needed because a metadata object may be valid, but not able to be recalled due to some other requirement, like base model compatibility. Validators are optional. Sometimes metadata is not a single object but a list of items - like LoRAs. Metadata handlers may implement an optional set of "item" handlers which operate on individual items in the list. Parsers and validators are async to allow fetching additional data, like a model config. Recallers are synchronous. The these handlers are composed into a public API, exported as a `handlers` object. Besides the handlers functions, a metadata handler set includes: - A function to get the label of the metadata type. - An optional function to render the value of the metadata type. - An optional function to render the _item_ value of the metadata type.
…nd to multiple of 8 This allows image dimensions that are not multiples of 8 to still be recalled with best effort.
When we retrieve a list of models, upsert that data into the `getModelConfig` and `getModelConfigByAttrs` query caches. With this change, calls to those two queries are almost always going to be free, because their caches will already have all models in them. The exception is queries for models that no longer exist.
- Move some files around - Use util to extract key and base from model config
psychedelicious
force-pushed
the
feat/ui/metadata-backcompat-2
branch
from
February 26, 2024 11:16
db4d127
to
32a9ed2
Compare
LoRA model now at under `model` not `lora.
Model metadata includes the main model, VAE and refiner model. These used full model configs, as returned by the server, as their metadata type. LoRA and control adapter metadata only use the metadata identifier. This created a difference in handling. After parsing a model/vae/refiner, we have its name and can display it. But for LoRAs and control adapters, we only have the model key and must query for the full model config to get the name. This change makes main model/vae/refiner metadata only have the model key, like LoRAs and control adapters. The render function is now async so fetching can occur within it. All metadata fields with models now only contain the identifier, and fetch the model name to render their values.
These are the same as the existing control adapter types, but the model field is non-nullable, simplifying handling of these objects.
hipsterusername
approved these changes
Feb 26, 2024
maryhipp
approved these changes
Feb 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api
frontend
PRs that change frontend files
invocations
PRs that change invocations
python
PRs that change python files
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Main changes:
feat(api): add MM get_by_attrs route
Gets the first model that matches the given name, base and type. Raises 404 if there isn't one.
This will be used for backwards compatibility with old metadata.
feat(ui): refactor metadata handling (again)
Add concepts for metadata handlers. Handlers include parsers, recallers and validators for different metadata types:
Sometimes metadata is not a single object but a list of items - like LoRAs. Metadata handlers may implement an optional set of "item" handlers which operate on individual items in the list.
Parsers and validators are async to allow fetching additional data, like a model config. Recallers are synchronous.
The these handlers are composed into a public API, exported as a
handlers
object. Besides the handlers functions, a metadata handler set includes:QA Instructions, Screenshots, Recordings
Recalling metadata should work, both both v3 and v4. I will be doing another pass over this functionality soon - please report any issues you run into.
TODO (future PR):
msw
for this but haven't gotten to it yet.Merge Plan
This PR can be merged when approved.