-
-
Notifications
You must be signed in to change notification settings - Fork 284
Add advanced image history filtering and architecture grouping #978
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
base: master
Are you sure you want to change the base?
Conversation
|
||
if (archLower.startsWith('flux-1') || arch.startsWith('Flux.1')) return 'Flux.1'; | ||
|
||
if (archLower.startsWith('stable-diffusion-xl')) return 'SDXL'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole function is a weird hack. T2IModelClassSorter is where data like this would be defined
let processedCount = 0; | ||
const totalModels = allModels.length; | ||
|
||
for (let modelName of allModels) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hhhhhh this will destroy people with large model sets, nopenopenope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I have about 200 models. definitely looks like something that would crush me if done this way. you probably should make a new api endpoint that feeds you this map in 1 call.
model:sdxl (model containing sdxl) | ||
controlnet:canny (controlnet type) | ||
sampler:euler (sampler name) | ||
aspectratio:16:9 (aspect ratio) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a massive chunk of text to slip into a title
attrib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also none of this should be in browsers.js
sampler:euler (sampler name) | ||
aspectratio:16:9 (aspect ratio) | ||
|
||
NUMERIC FILTERS (support >, <, =): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
symbols like this fed directly into an html attrib unescaped could cause problems
continue; | ||
} | ||
if (this.filter) { | ||
const searchParts = typeof parseSearchQuery !== 'undefined' ? parseSearchQuery(this.filter) : [{ type: 'text', value: this.filter }]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a hack
const modelName = model.name; | ||
const archGroup = data.architecture_group; | ||
const archType = data.type; | ||
if (typeof modelArchitectureMap !== 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
none of these defined check hacks should be here
@@ -397,6 +411,11 @@ class ModelBrowserWrapper { | |||
this.models[file.name] = file; | |||
if (this.subType == 'Stable-Diffusion') { | |||
modelIconUrlCache[file.name] = file.data.preview_image; | |||
if (file.data.architecture_group) { | |||
modelArchitectureMap[file.name] = file.data.architecture_group; | |||
} else if (file.data.architecture) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wonk format
setTimeout(() => { | ||
updateFilterButtons(); | ||
updateArchitectureDropdown(); | ||
}, 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wh
|
||
if (searchValue.startsWith('>')) { | ||
return parseInt(stepsValue) > parseInt(searchValue.substring(1).trim()); | ||
} else if (searchValue.startsWith('<')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function is a massive pile of copypasta
@@ -127,6 +132,244 @@ function buttonsForImage(fullsrc, src, metadata) { | |||
return buttons; | |||
} | |||
|
|||
function parseSearchQuery(query) { | |||
const namespaces = ['lora', 'prompt', 'model', 'controlnet', 'seed', 'steps', 'cfgscale', 'aspectratio', 'width', 'height', 'sampler', 'videoframes', 'fps', 'date']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weirdly specific, why not just a generic metadata parameter by name check?
@@ -135,6 +135,7 @@ | |||
<option value="@arch.ID" class="translate">@arch.Name</option> | |||
} | |||
</select></div> | |||
<div>Architecture Group: <input type="text" id="edit_model_architecture_group" class="modal_text_extra translate" placeholder="Custom Architecture group for Image History" /></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is... odd. I don't think this needs to exist.
improved image history search sounds great. I hope you can work through the review process to get it in a mergeable state @caith-h |
Adds:
• namespace-based search filtering
• orientation filtering
• image/video filtering <-- uses your video extension function, with a fallback to frame count parameter, for things like .webp or .gif
• architecture filtering
• automatic arch group detection based on model names (needs to be maintained if new model groups get released, that you actually care about)
• optional "Architecture Group" override in the model metadata. (relevant if you do subgroups for specific model series like the pony models or illustrious models)