lllyasviel / Fooocus

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

[Bug]: Seconds worth of PC freezing and stuttering while Foocus is "Moving model to GPU ..." #2708

Closed FrankHovis closed 6 months ago

FrankHovis commented 6 months ago

Checklist

What happened?

When at the point of "Moving model to GPU ...", PC goes super laggy and stuttery. Any sound playing freezes and buzzes, mouse pointer jerks about.

Steps to reproduce the problem

Press the Generate button.

What should have happened?

Not freeze computer

What browsers do you use to access Fooocus?

Mozilla Firefox

Where are you running Fooocus?

Locally

What operating system are you using?

Windows 11

Console logs

D:\>.\python_embeded\python.exe -s Fooocus\entry_with_update.py --preset realistic
Already up-to-date
Update succeeded.
[System ARGV] ['Fooocus\\entry_with_update.py', '--preset', 'realistic']
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Fooocus version: 2.3.1
Loaded preset: D:\Fooocus\presets\realistic.json
[Cleanup] Attempting to delete content of temp dir C:\Users\pauls\AppData\Local\Temp\fooocus
[Cleanup] Cleanup successful
Total VRAM 6144 MB, total RAM 16305 MB
Set vram state to: NORMAL_VRAM
Always offload VRAM
Device: cuda:0 NVIDIA GeForce RTX 2060 : native
VAE dtype: torch.float32
Using pytorch cross attention
Refiner unloaded.
Running on local URL:  http://127.0.0.1:7865

To create a public link, set `share=True` in `launch()`.
model_type EPS
UNet ADM Dimension 2816
Using pytorch attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using pytorch attention in VAE
extra {'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_g.transf
ormer.text_model.embeddings.position_ids'}
Base model loaded: D:\Fooocus\models\checkpoints\realisticStockPhoto_v20.safetensors
Request to load LoRAs [['SDXL_FILM_PHOTOGRAPHY_STYLE_BetaV0.4.safetensors', 0.25], ['None', 1.0], ['None', 1.0], ['None'
, 1.0], ['None', 1.0]] for model [D:\Fooocus\models\checkpoints\realisticStockPhoto_v20.safetensors].
Loaded LoRA [D:\Fooocus\models\loras\SDXL_FILM_PHOTOGRAPHY_STYLE_BetaV0.4.safetensors] for UNet [D:\Fooocus\models\check
points\realisticStockPhoto_v20.safetensors] with 788 keys at weight 0.25.
Loaded LoRA [D:\Fooocus\models\loras\SDXL_FILM_PHOTOGRAPHY_STYLE_BetaV0.4.safetensors] for CLIP [D:\Fooocus\models\check
points\realisticStockPhoto_v20.safetensors] with 264 keys at weight 0.25.
Fooocus V2 Expansion: Vocab with 642 words.
Fooocus Expansion engine loaded for cuda:0, use_fp16 = True.
Requested to load SDXLClipModel
Requested to load GPT2LMHeadModel
Loading 2 new models
[Fooocus Model Management] Moving model(s) has taken 1.81 seconds
Started worker with PID 16148
App started successful. Use the app with http://127.0.0.1:7865/ or 127.0.0.1:7865
[Parameters] Adaptive CFG = 7
[Parameters] Sharpness = 2
[Parameters] ControlNet Softness = 0.25
[Parameters] ADM Scale = 1.5 : 0.8 : 0.3
[Parameters] CFG = 3.0
[Parameters] Seed = 4677161661759711512
[Parameters] Sampler = dpmpp_2m_sde_gpu - karras
[Parameters] Steps = 30 - 15
[Fooocus] Initializing ...
[Fooocus] Loading models ...
Refiner unloaded.
[Fooocus] Processing prompts ...
[Fooocus] Preparing Fooocus text #1 ...
[Prompt Expansion] Photo of crashed computer and frustrated user, beautiful detailed, coherent, vivid color, perfect com
position, aesthetic, shiny, intricate, elegant, highly saturated colors, sharp focus, fine detail, artistic, complex, gl
owing, appealing, bright, unique, cool, cute, illuminated, colorful, extremely scientific, focused, innocent, elite, dec
orated, atmosphere, magic, surreal, vibrant
[Fooocus] Preparing Fooocus text #2 ...
[Prompt Expansion] Photo of crashed computer and frustrated user, elegant, intricate, highly detailed, sharp focus, cine
matic, dynamic light, new, enhanced, bright, best, romantic, cute, creative, cool, lovely, peaceful, unique, beautiful,
charming, symmetry, illuminated, designed, inspired, clear, perfect, pretty, futuristic, professional, trendy, awesome,
colorful, color
[Fooocus] Encoding positive #1 ...
[Fooocus] Encoding positive #2 ...
[Fooocus] Encoding negative #1 ...
[Fooocus] Encoding negative #2 ...
[Parameters] Denoising Strength = 1.0
[Parameters] Initial Latent shape: Image Space (1152, 896)
Preparation time: 3.69 seconds
[Sampler] refiner_swap_method = joint
[Sampler] sigma_min = 0.0291671771556139, sigma_max = 14.614643096923828
Requested to load SDXL
Loading 1 new model
loading in lowvram mode 3113.0277185440063
[Fooocus Model Management] Moving model(s) has taken 12.37 seconds
100%|██████████████████████████████████████████████████████████████████████████████████| 30/30 [00:31<00:00,  1.05s/it]

Additional information

Tried different GPU drivers but no difference.

mashb1t commented 6 months ago

I'm sorry, this is not a driver issue which can be solved by updating. I'm also having this regularly on my Macbook Pro M1 as well as low-end GPUs with 4 or 6GB VRAM. This is normal if your GPU is moving files to memory (or swap) and your memory (or swap) + GPU can't handle both moving and OS output, so your system freezes. Can be mitigated by upgrading your GPU to be able to contain the full 10GB of models or by upgrading thr memory to higher capacity, e.g. 32GB.