-
Notifications
You must be signed in to change notification settings - Fork 27k
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
fix very slow loading speed of .safetensors files #11260
Conversation
… with memmap disabled for #11260
I was testing this change (on the dev branch) because the slow .safetensors loading was a common issue I ran into, but while the loading is now properly fast, each .safetensors model load now involves, at some point, a ~5 second complete freeze of my PC (graphically, sound continues to play). Is this expected? |
Nope that's not expected and never happened on my PC |
Any idea what might be the issue? Or how I could help diagnose it? EDIT: Ok, it seems it's not specifically my whole PC freezes, but rather it seems to be the browser. I'm gonna do some testing, including a different browser, and see what I can find. |
Ok, so this appears to be rathe bizzare. |
… with memmap disabled for AUTOMATIC1111#11260
* 🐛 Allow Script to have metaclass * update the description of --add-stop-rout * fix: adding elem_id for img2img resize to and resize by tabs * Add use_main_prompt parameter to use proper metadata for batch run grids or individual images * PNG info support at img2img batch * use ui params when retreiving png info fails Don't want to interrupt the process since batches can be huge. This makes more sense to me than using the previous images parameters * resolve linter * feat(extensions): add toggle all checkbox to Installed tab Small QoL addition. While there is the option to disable all extensions with the radio buttons at the top, that only acts as an added flag and doesn't really change the state of the extensions in the UI. An use case for this checkbox is to disable all extensions except for a few, which is important for debugging extensions. You could do that before, but you'd have to uncheck and recheck every extension one by one. * alternate fix for catch errors when retrieving extension index AUTOMATIC1111#11290 * send tensors to the correct device when loading from safetensors file with memmap disabled for AUTOMATIC1111#11260 * fix and rework AUTOMATIC1111#11113 * Add options to change colors in grid * add 'before_hr callback' script callback * fixing --subpath on newer gradio version * Revision * Fix lint * Move change colors options to Saving images/grids * add callback after_extra_networks_activate * Correctly remove end parenthesis with ctrl+up/down * rename --add-stop-route to --api-server-stop * sync default value of process_focal_crop_entropy_weight between ui and api * add stars * starts left * fix can't get current hash * add extensions Update Created dates with sorting * fix for AUTOMATIC1111#11534: canvas zoom and pan extension hijacking shortcut keys * Change default seed_resize to 0 * Hotfix: call processing close to cleanup API generation calls * fixing the copy/paste function, correct code * Fix launch script to be runnable from any directory * Update webui.sh * Add SD_WEBUI_LOG_LEVEL envvar * Add job argument to State.begin() * API: use finally: for state.end() * Add a status logger in modules.shared * Use read_info_from_image in postprocessing Avoids bad keys such as `exif` ending up in the "PNG info" passed forward * read_info_from_image: add `photoshop` to ignored * read_info_from_image: add type * read_info_from_image: don't mutate info in passed-in image * Handle cleanup in case there's an exception thrown * Use contextlib for closing the generation process * Check seed_resize_from <= 0 * made the blur function optional, added exclusion buttons * Allow gif for extra network previews * Fix throwing exception when trying to resize image with I;16 mode * Fix warning of 'has_mps' is deprecated from PyTorch * fix(api): convert to "RGB" if image mode is "RGBA" * Fix UnicodeEncodeError when writing to file CLIP Interrogator Batch Mode The code snippet print(interrogation_function(img), file=open(os.path.join(ii_output_dir, f"{left}.txt"), 'a')) raises a UnicodeEncodeError with the message "'charmap' codec can't encode character '\u016b' in position 129". This error occurs because the default encoding used by the open() function cannot handle certain Unicode characters. To fix this issue, the encoding parameter needs to be explicitly specified when opening the file. By using an appropriate encoding, such as 'utf-8', we can ensure that Unicode characters are properly encoded and written to the file. The updated code should be modified as follows: python Copy code print(interrogation_function(img), file=open(os.path.join(ii_output_dir, f"{left}.txt"), 'a', encoding='utf-8')) By making this change, the code will no longer raise the UnicodeEncodeError and will correctly handle Unicode characters during the file write operation. * Added a prompt for users using poor scaling Added a JavaScript file that detects browser scaling and prompts users when scale is not 100% * Add a link to an index-able/crawl-able wiki mirroring service of the wiki At the moment, the wiki is editable by GitHub users, so it is blocked from indexing. If you are searching for something related to this repo, Google and other search engines will not use the content for it. This link hack just sticks a link on the README so search engines may prioritize it. At the moment, 0 pages from GitHub are index and only 7 pages from my proxy service are. If you add this, the rest should get indexed. An indexable page looks like this: https://github-wiki-see.page/m/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings. It is not meant to be read, just indexed, and users are expected to click through to the GitHub copy. https://github-wiki-see.page/ has more information about the situation. I built the tool and I'm happy to answer any questions I can. Similar: https://github.com/MiSTer-devel/Main_MiSTer#main_mister-main-binary-and-wiki-repo:~:text=For%20the%20purposes%20of%20getting%20google%20to%20crawl%20the%20wiki%2C%20here%27s%20a%20link%20to%20the%20(not%20for%20humans)%20crawlable%20wiki * fix problem with extra network saving images as previews losing generation info add a description for save_image_with_geninfo * lint fix for AUTOMATIC1111#11492 * whitespace for AUTOMATIC1111#11477 * fix for AUTOMATIC1111#11478 * additional changes for merge conflict for AUTOMATIC1111#11337 * additional changes for merge conflict for AUTOMATIC1111#11337 * third time's the charm * small rework for img2img PNG info * for AUTOMATIC1111#10650: change key to alt+arrows, enable by default * use natural sort for shared.walk_files and shared.listfiles, as well as for dirs in extra networks * rework AUTOMATIC1111#10436 to use shared.walk_files * added torch.mps.empty_cache() to torch_gc() changed a bunch of places that use torch.cuda.empty_cache() to use torch_gc() instead * Fix typo: checkpoint_alisases * pin version for torch for Navi3 according to comment from AUTOMATIC1111#11228 * move github proxy to settings, System page. * fix for eslint * add option SWIN_torch_compile to accelerate SwinIR upscale using torch.compile() * Revert Pull Request AUTOMATIC1111#11244 Revert "Add github mirror for the download extension" This reverts commit 9ec2ba2. Revert "Update code style" This reverts commit de022c4. Revert "Update call method" This reverts commit e9bd18c. Revert "move github proxy to settings, System page." This reverts commit 4981c7d. * Use closing() with processing classes everywhere Follows up on AUTOMATIC1111#11569 * add cmd_args: --timeout-keep-alive * set timeout_keep_alive * Fix MPS cache cleanup Importing torch does not import torch.mps so the call failed. * Allow using alt in the prompt fields again * getting SD2.1 to run on SDXL repo * Save img2img batch with images.save_image() * fix: check fill size none zero when resize (fixes AUTOMATIC1111#11425) * Add correct logger name * Don't do MPS GC when there's a latent that could still be sampled * use submit blur for quick settings textbox * SDXL support * linter * fix importlib.machinery issue on github's autotests #yolo * mute unneeded SDXL imports for tests too * get attention optimizations to work * lint * fix CLIP doing the unneeded normalization revert SD2.1 back to use the original repo add SDXL's force_zero_embeddings to negative prompt * lora support * fix broken img2img * add XL support for live previews: approx and TAESD * repair --no-half for SDXL * mute SDXL imports in the place there SDXL is imported for the first time instead of launch.py * add support for SDXL loras with te1/te2 modules * thank you linter * handles model hash cache.json error * initial SDXL refiner support * linter * raise maximum Negative Guidance minimum sigma due to request in PR discussion * do not run workflow items twice for PRs from this repo update names * repair medvram and lowvram * edit names more * add more relevant fields to caching conds * add cheap VAE approximation coeffs for SDXL * add a message about unsupported samplers * restyle time taken/VRAM display * Added [none] filename token. * fix an issue in live previews that happens when you use SDXL with fp16 VAE * disable rich exception output in console for API by default, use WEBUI_RICH_EXCEPTIONS env var to enable * add padding and identification to generation log section (Failed to find Loras, Used embeddings, etc...) * add textual inversion hashes to infotext * cache git extension repo information * suppress printing TI embedding into console by default * remove "## " from changelog.md version * allow replacing extensions index with environment variable * Warns merge into master * user metadata system for custom networks * eslint * add lora user metadata editor dialog inspired by MrKuenning's mockup from AUTOMATIC1111#7458 * fix styles for dark people * Update shared.py * 404 when thumb file not found * allow refreshing single card after editing user metadata instead of all cards * speedup extra networks listing * fix bogus metadata for extra networks appearing out of cache fix description editing for checkpoint not immediately appearing on cards * add resolution calculation from buckets for lora user metadata page * nuke thumbs extra networks view mode (use settings tab to change width/height/scale to get thumbs) * minor restyling for extra networks * possible fix for FP16 VAE failing in img2img SDXL * fix cache loading wrong entries from old cache files * changelog for future 1.5.0 * lora extension rework to include other types of networks * linter * fix * IA3 support * Lokr support * XYZ always_discard_next_to_last_sigma Co-authored-by: Franck Mahon <franck.mahon@gmail.com> * reversible boolean_choice order * lowercase * support specifying te and unet weights separately update lora code support full module * some backwards compatibility linter * delay writing cache to prevent writing the same thing over and over * add alias to lyco network read networks from LyCORIS dir if it exists add credits * move generate button below the picture for mobile clients * hide cards for networks of incompatible stable diffusion version in Lora extra networks interface * skip installing packages with pip if theyare already installed record time it took to launch * Fix wrong key name in lokr module * use "is not None" for Tensor * Add support for `--upcast-sampling` with SD XL * remove duplicate * also make None a valid option for options API for AUTOMATIC1111#11854 * lint * add a bit more metadata info for the lora user metadata page * return sd_model_checkpoint to None * changelog for 1.5.0 * fix the issue with /sdapi/v1/options failing (this time for sure!) fix automated tests downloading CLIP model * linter fix * add backwards compatibility --lyco-dir-backcompat option, use that for LyCORIS directory instead of hardcoded value prevent running preload.py for disabled extensions * Make possible to install web ui without venv with --novenv flag When passing `--novenv` flag to webui.sh it can skip venv. Might be useful for installing in Docker since messing with venv in Docker might be a bit complicated. Example usage: `webui.sh --novenv` Hope this gets approved and pushed into future versions of Web UI * fix incorrect multiplier for Loras * Replace argument with env variable * improve var naming * missing p save_image before-highres-fix * bugfix: model name was added together with directory name to infotext and to [model_name] filename pattern * bugfix: model name was added together with directory name to infotext and to [model_name] filename pattern * automatically switch to 32-bit float VAE if the generated picture has NaNs. * Update sd_models_xl.py Fix width/height not getting fed into the conditioning * repair --medvram for SD2.x too after SDXL update --------- Co-authored-by: huchenlei <chenlei.hu@mail.utoronto.ca> Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com> Co-authored-by: George Gu <minggu@amazon.com> Co-authored-by: stablegeniusdiffuser <stablediffuser23@gmail.com> Co-authored-by: Ferdinand Weynschenk <flweynschenk@gmail.com> Co-authored-by: Martín (Netux) Rodríguez <send.email@netux.site> Co-authored-by: AUTOMATIC <16777216c@gmail.com> Co-authored-by: Beinsezii <39478211+Beinsezii@users.noreply.github.com> Co-authored-by: NoCrypt <57245077+NoCrypt@users.noreply.github.com> Co-authored-by: hako-mikan <122196982+hako-mikan@users.noreply.github.com> Co-authored-by: catalpaaa <caojingzifang@gmail.com> Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com> Co-authored-by: hunshcn <hunsh.cn@gmail.com> Co-authored-by: Akiba <akiba@anzu.link> Co-authored-by: gshawn3 <133769806+gshawn3@users.noreply.github.com> Co-authored-by: ramyma <ramy.mahmoudi@gmail.com> Co-authored-by: Danil Boldyrev <daswerq123@gmail.com> Co-authored-by: onyasumi <kugelblitz3@outlook.com> Co-authored-by: Frank Tao <48634762+onyasumi@users.noreply.github.com> Co-authored-by: Aarni Koskela <akx@iki.fi> Co-authored-by: semjon00 <semjon.00@gmail.com> Co-authored-by: Hao-Wu <haowu.wuhao@gmail.com> Co-authored-by: jovijovi <mageyul@hotmail.com> Co-authored-by: Neil Mahseth <neilmahaseth@gmail.com> Co-authored-by: gitama2023 <138025603+gitama2023@users.noreply.github.com> Co-authored-by: Nelson Chen <crazysim@gmail.com> Co-authored-by: SiYu Wu <wu.siyu@hotmail.com> Co-authored-by: wfjsw <wfjsw@users.noreply.github.com> Co-authored-by: TangJicheng <tangjch15@gmail.com> Co-authored-by: 王怀宗 <whz@meitu.com> Co-authored-by: Marcus Adams <rawlogic@gmail.com> Co-authored-by: Leon Feng <523684+leon0707@users.noreply.github.com> Co-authored-by: Franck Mahon <franck.mahon@gmail.com> Co-authored-by: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Co-authored-by: brkirch <brkirch@users.noreply.github.com> Co-authored-by: Leon Feng <best.sum@gmail.com> Co-authored-by: kopyl <oleggggg1997@gmail.com> Co-authored-by: Janek Mann <janekm@gmail.com>
Description
Screenshots/videos:
No
Checklist: