captainzero93 / extract-unet-safetensor

Processes SafeTensors files for Stable Diffusion 1.5 (SD 1.5), Stable Diffusion XL (SDXL), and FLUX models. It extracts the UNet into a separate file and creates a new file with the remaining model components (without the UNet).
MIT License
43 stars 4 forks source link

Why do i only get a 16Ko file with flux checkpoint? #1

Closed ali0une closed 3 months ago

ali0une commented 3 months ago

Hi there. Very interesting project!

i've just tested and the code works fine with no error at all but something is bugging me.

Could someone please explain why i do only get a 16Ko flux1-dev-fp8_unet.safetensors file with flux1-dev-fp8.safetensors checkpoint? Am i misunderstanding and doing something wrong? i'm pretty sure flux1-dev-fp8.safetensors comes as a checkpoint with Unet and VAE in it ... is it because it's FP8 quantized?

(venv) user@box:~/whatever/extract-unet-safetensor$ python UNetExtractor.py /whatever/sdxl_model.safetensors ./outputs/sdxl_model_unet.safetensors ./outputs/sdxl_model_no_unet.safetensors --model_type sdxl
Processing /whatever/sdxl_model.safetensors on cuda
Saving extracted UNet to ./outputs/sdxl_model_unet.safetensors
Saving model without UNet to ./outputs/sdxl_model_no_unet.safetensors
Processing complete!
(venv) user@box:~/whatever/extract-unet-safetensor$ ls -la outputs/
total 6,5G
drwxr-xr-x 2 user user 4,0K 2024-08-17 18:56:41 .
drwxr-xr-x 5 user user 4,0K 2024-08-17 18:24:31 ..
-rw-r--r-- 1 user user 1,7G 2024-08-17 18:56:41 sdxl_model_no_unet.safetensors
-rw-r--r-- 1 user user 4,8G 2024-08-17 18:56:40 sdxl_model_unet.safetensors

(venv) user@box:~/whatever/extract-unet-safetensor$ python UNetExtractor.py /whatever/flux1-dev-fp8.safetensors ./outputs/flux1-dev-fp8_unet.safetensors ./outputs/flux1-dev-fp8_no_unet.safetensors --model_type flux
Processing /whatever/flux1-dev-fp8.safetensors on cuda
Saving extracted UNet to ./outputs/flux1-dev-fp8_unet.safetensors
Saving model without UNet to ./outputs/flux1-dev-fp8_no_unet.safetensors
Processing complete!
(venv) user@box:~/whatever/extract-unet-safetensor$ ls -la outputs/
total 17G
drwxr-xr-x 2 user user 4,0K 2024-08-17 18:59:30 .
drwxr-xr-x 5 user user 4,0K 2024-08-17 18:24:31 ..
-rw-r--r-- 1 user user  17G 2024-08-17 18:59:34 flux1-dev-fp8_no_unet.safetensors
-rw-r--r-- 1 user user   16 2024-08-17 18:59:26 flux1-dev-fp8_unet.safetensors
captainzero93 commented 3 months ago

fixed detection for flux unet, please update

ali0une commented 3 months ago

Many thanks!

captainzero93 commented 3 months ago

I will leave this issue open so you can tell me if you still have issues

please note; if you have low VRAM / ram it will take a LONG time if the model is large - I have done everything I can to speed it up I can think of right now.