-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
ExtraNetworks: Performance Updates and Improvements #15530
base: dev
Are you sure you want to change the base?
ExtraNetworks: Performance Updates and Improvements #15530
Conversation
…l load of tree view.
…tml. maybe should only update the data json. also maybe look into sharing data json between img2img and txt2img to reduce size of dom.
153a22f
to
8bf4548
Compare
@w-e-w Hey I'm sorry for goin AWOL for a bit. By all means go ahead and make improvements to this PR. I'm a bit tied up at the moment so I can't really dedicate any time to this project until I get things sorted irl first. Also your understanding of how the model cards are loaded (loaded in chunks) is correct. |
Thanks I don't know if AUTO has reviewed this or not |
seems to have found another issue same for the field as well, the first time that it displays the cars it is not sorted only until I update the icons does it get sorted if I wanted to show in descending order I actually have to click it twice the following is more to the realm of future improvements as opposed to issues some thoughts about sorting categories is it useful to have both on the other hand I think the actual useful time related sorting method would be some sort of usage time and it might be possible to also create a favorites list type system in order for user to choose the specific models that they use most often and have it listed in front |
this also has the added effect of moving the controls the right side as it was previously blocked by a invisible duplicate element
the order of the card icons got swapped somehow
|
move template from local var to self.button_row_tpl
found a potential issue but maybe not that serious and can be fixed later if it's really a problem basically it takes time for the UI to scan for available models this can happens if model scanning is taking unusually long in short basically on an issue takes around~ 50 seconds for me to load the model without #16556 they also seems to be a timeout for the page to load the cards, before it shows I use Chrome's built-in throttling feature to simulate bad connection (3G profile), the pages loades but the images seems to have failed but I think that is out of scope for this PR as the pr is already too big |
|
found a strange issue regarding clicking on extra networks cards from what I can tell when I clicking on the left 1/3 of the a card 2024-11-01.15_41_43_689.chrome.mp4this issue seems to be only on chromium based browsers but not Firefox
|
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.
Current known issues
-
Clicking on cards seems to be 1/3 broken on chromium based browsers
see comment -
Default order field
andDefault order
after page loads
user will have to manually click on the category to refresh it
see comment
the extra networks will controls will disappear
video 2024-11-02.01_38_06_551.chrome.mp4there seems to be some logic that hides all controls when a extra networks tab is selected even those that are not of the current tab (txt2img / img2img tab) |
#15530 (comment)
Description
This PR is a complete overhaul of the code that I previously wrote for the ExtraNetworksTreeView PR (#14588) in response to the negative feedback such as in #15164 and various issues that have been posted.
The goal of this PR is to improve performance and reduce resource use across ExtraNetworks tabs.
I have tested these changes with up to 100,000 models at a time. With this many models, the initial load is slow but as soon as the server fully generates the dataset it performs very well. Before, my browser would just crash if I even tried to load the page with more than 50k models. The real limiting factor here is the server (though it takes quite a bit to reach the limit). Right now,
ui_extra_networks.py
is generating the HTML for all of the files it discovers in any of the models directories. It then waits for requests from the client and sends only the requested items HTML back to the client. This way the client doesn't have massive amounts of DOM elements constantly loaded. So as long as the device running the server can load the generated HTML for every single item in the models folders then it should be fine. I don't see this being an issue until some psycho comes along with 10 million models but I don't really think we should be pandering to such a niche audience. Even then, I think other things will crash before this new code does.Sorry ahead of time... this is a big one.
The following has changed:
utils.js
file and added a lot of helpful utility functions that could probably be used elsewhere if needed.resizeHandle.js
handle is double clicked.UI Changes
Below is an example of what the new format looks like:
Controls
The controls have been grouped with a header to hopefully make their intent more obvious.
Directory View
Directory view buttons have been styled a bit better and now the selected directory will be highlighted.
Tree View
Slightly modified the appearance of the tree view and simplified the code that generates it. Also directories in the tree view are no longer expanded when the item itself is clicked. Now the user must click the chevron on a directory in order to expand it.
Checklist:
Additional Notes
Someone suggested that we use emojis for the controls in the extra networks tabs. Personally I hate emojis and they look disgusting. On top of that, I couldn't find any that really fit the purpose of each of the controls. If someone has a theme (like lobo or whatever) then they can handle replacing these SVGs if they want. The SVGs are all easy to query so they can handle a find/replace if they want.
One thing that I couldn't figure out is how to manually trigger the gradio loading icon within the extra networks pane (see below):
This loading page appears whenever the page is reloaded or refreshed but I would have liked to have been able to manually trigger it to show up and stay there until the data is fully loaded but I couldn't figure out where this loading pane was even coming from. I'd really like to be able to put one in the Tree View and one in the Cards View. Then I would trigger each manually whenever I need to load more data.
Also at some point someone requested that clicking one of the directory view buttons to filter cards should only show direct children of that directory and not any of the nested directory content. What was the consensus on this? Should that be the behavior or do we prefer to show all nested items? The current behavior is the same as it always has been and it is a pretty simple implementation where clicking a button simply adds that path to the search box and updates the filter based on the search box text. Changing the behavior of clicking directory buttons would definitely require a bit of redesign and I think this change has already had enough scope creep as is.
Needs Testing
I would like to have this feature undergo a bit more testing than the last time in order to avoid having so many people get upset at the same time. I'd really appreciate feedback for this PR so that we can catch as many problems as possible before merging.
I have really only tested in the following environment: