lllyasviel / Fooocus

Focus on prompting and generating
GNU General Public License v3.0
41.18k stars 5.8k forks source link

App crashes everytime when I change base model #979

Closed koriekhov closed 10 months ago

koriekhov commented 11 months ago

Describe the problem First of all, thank you for best SD App ! I really like it.

Unfortunately for several last versions I've noticed that App crashes each time, when I want to switch to another base model. Pretty sure, there is a local issue with system/env/app. but not sure how to resolve it.

Step to reproduce:

  1. Set Prompt
  2. Generate image
  3. Change model (For example, from Juggernaut to Realvis)
  4. Press Generate
  5. App crashes

Below log with successfull image generation and crash:

F:\Portable\Fooocus_alt>.\python_embeded\python.exe -s Fooocus\entry_with_update.py --preset lcm --listen Fast-forward merge Update succeeded. [System ARGV] ['Fooocus\entry_with_update.py', '--preset', 'lcm', '--listen'] Loaded preset: F:\Portable\Fooocus_alt\Fooocus\presets\lcm.json Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec 6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)] Fooocus version: 2.1.821 Running on local URL: http://0.0.0.0:7865

To create a public link, set share=True in launch(). Total VRAM 4096 MB, total RAM 24278 MB Trying to enable lowvram mode because your GPU seems to have 4GB or less. If you don't want this use: --normalvram Set vram state to: LOW_VRAM Disabling smart memory management Device: cuda:0 NVIDIA GeForce RTX 3050 Laptop GPU : native VAE dtype: torch.bfloat16 Using pytorch cross attention Refiner unloaded. model_type EPS adm 2816 Using pytorch attention in VAE Working with z of shape (1, 4, 32, 32) = 4096 dimensions. Using pytorch attention in VAE extra keys {'cond_stage_model.clip_g.transformer.text_model.embeddings.position_ids', 'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_l.text_projection'} Base model loaded: F:\Projects\AI\Support\Models\SDModels\Checkpoints\juggernautXL_version6Rundiffusion.safetensors Request to load LoRAs [['None', 1.0], ['None', 1.0], ['None', 1.0], ['None', 1.0], ['None', 1.0]] for model [F:\Projects\AI\Support\Models\SDModels\Checkpoints\juggernautXL_version6Rundiffusion.safetensors]. Fooocus V2 Expansion: Vocab with 642 words. Fooocus Expansion engine loaded for cpu, use_fp16 = False. Requested to load SDXLClipModel Requested to load GPT2LMHeadModel Loading 2 new models App started successful. Use the app with http://localhost:7865/ or 0.0.0.0:7865 Enter LCM mode. [Fooocus] Downloading LCM components ... [Parameters] Adaptive CFG = 1.0 [Parameters] Sharpness = 0.0 [Parameters] ADM Scale = 1.0 : 1.0 : 0.0 [Parameters] CFG = 1.0 [Parameters] Seed = 6447904152150015596 [Parameters] Sampler = lcm - lcm [Parameters] Steps = 8 - 8 [Fooocus] Initializing ... [Fooocus] Loading models ... Refiner unloaded. Request to load LoRAs [('None', 1), ('None', 1), ('None', 1), ('None', 1), ('None', 1), ('F:\Projects\AI\Support\Models\LORA\sdxl_lcm_lora.safetensors', 1.0)] for model [F:\Projects\AI\Support\Models\SDModels\Checkpoints\juggernautXL_version6Rundiffusion.safetensors]. Loaded LoRA [F:\Projects\AI\Support\Models\LORA\sdxl_lcm_lora.safetensors] for model [F:\Projects\AI\Support\Models\SDModels\Checkpoints\juggernautXL_version6Rundiffusion.safetensors] with 788 keys at weight 1.0. Requested to load SDXLClipModel Loading 1 new model unload clone 1 [Fooocus] Processing prompts ... [Fooocus] Preparing Fooocus text #1 ... [Prompt Expansion] stop sign, surreal background, beautiful composition, intricate, elegant, sharp focus, highly detailed, formal, professional color, charming, pretty, attractive, best, bright, romantic, new, fancy, enhanced, inspired, awarded, deep, clear, focused, magical, novel, perfect, successful, epic, artistic, winning, cinematic, incredible detail, gorgeous, dramatic [Fooocus] Encoding positive #1 ... Preparation time: 4.82 seconds Using lcm scheduler. [Sampler] refiner_swap_method = joint [Sampler] sigma_min = 0.39970141649246216, sigma_max = 14.614640235900879 Requested to load SDXL Loading 1 new model loading in lowvram mode 1753.5350065231323 [Fooocus Model Management] Moving model(s) has taken 8.40 seconds 100%|████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:14<00:00, 1.75s/it] Image generated with private log at: F:\Projects\AI\Support\Output\txt2img\2023-11-18\log.html Generating and saving time: 25.19 seconds Total time: 31.04 seconds Enter LCM mode. [Fooocus] Downloading LCM components ... [Parameters] Adaptive CFG = 1.0 [Parameters] Sharpness = 0.0 [Parameters] ADM Scale = 1.0 : 1.0 : 0.0 [Parameters] CFG = 1.0 [Parameters] Seed = 1951280960864050886 [Parameters] Sampler = lcm - lcm [Parameters] Steps = 8 - 8 [Fooocus] Initializing ... [Fooocus] Loading models ... Refiner unloaded. model_type EPS adm 2816 Using pytorch attention in VAE Working with z of shape (1, 4, 32, 32) = 4096 dimensions. Using pytorch attention in VAE

F:\Portable\Fooocus_alt>pause Press any key to continue . . .

mashb1t commented 10 months ago

You can find the steps to correctly set up swap here: https://github.com/lllyasviel/Fooocus/blob/main/troubleshoot.md#system-swap