-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Add model preview feature #2211
Open
MindOfMatter
wants to merge
16
commits into
lllyasviel:main
Choose a base branch
from
MindOfMatter:features/add_model_previewer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add model preview feature #2211
MindOfMatter
wants to merge
16
commits into
lllyasviel:main
from
MindOfMatter:features/add_model_previewer
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#2029
Overview
This PR introduces a significant update to the model preview functionality in the application. The update allows for dynamic generation of model previews based on the last successful image generation attempt. This feature enhances the user experience by providing more relevant and up-to-date previews for models and configurations.
Key Changes
Dynamic Model Preview Generation:
Previews are now generated based on the last successful image attempt, offering a more accurate representation of the current model configuration.
Supports checkpoints and loras models.
Preview Management via JSON:
Previews are managed through preview_log.json files located in the models/checkpoints and models/loras directories.
The JSON files map model filenames to their latest preview images in the output folder.
UI Integration and Tooltip Enhancement:
The UI dynamically loads and displays these previews.
Tooltips are updated to show the latest previews or model filenames.
Configurable via config.py:
New settings in config.py allow for enabling/disabling the cleanup and addition of model previews.
The feature can be controlled via use_cleanup_model_previews and use_add_model_previews settings.
JavaScript and CSS Enhancements:
Refactored JavaScript code for handling model and style previews.
CSS updates for better display and interaction with the new preview functionality.
Error Handling and Debugging:
Added verbose debug outputs for better tracking and resolution of issues.
Ensures robust handling of file existence and JSON data integrity.
Configuration and Usage
Enabling/Disabling Feature:
In config.py, set use_cleanup_model_previews and use_add_model_previews to True or False as needed.
Adding Previews:
Previews are automatically added to the preview_log.json file after each successful generation.
Preview Cleanup:
On app start, the feature cleans up any non-existent outputs referenced in the JSON file.
UI Display:
Previews are displayed in the UI, offering a real-time glimpse of the model's output capabilities.
Additional Notes
First Version Limitation:
In the initial version, an app restart may be required to reflect changes in the previews.
Future Enhancements:
Plans to further refine the feature, including real-time updates without the need for a restart.
How to Test
Generating Images:
Use the application to generate images and observe the automatic update of previews in the UI.
JSON File Updates:
Check preview_log.json files for the correct mapping of model names to the latest image paths.
UI Interaction:
Hover over model names in the UI to see updated previews or tool
Tested until 2 week ago from my dev branch of fork project :
MindOfMatter/Fooocus-MindOfMatter-Edition#14