tencent-ailab / IP-Adapter

The image prompt adapter is designed to enable a pretrained text-to-image diffusion model to generate images with image prompt.
Apache License 2.0
4.46k stars 289 forks source link

Error : not a safetensors file #344

Open ss216de opened 2 months ago

ss216de commented 2 months ago

I was going to execute stable diffusion WebUI in google colab notebook. I tried to put ip-adapter-faceid-plus_sd15_lora.safetensors into stable-diffusion-webui/models/Lora folder. When I start stable diffusion WebUI, it says that the file is not a safetensors file. May i know how to import ip-adapter-faceid Lora file correctly? Thank you.

p.s. insightful has been installed in notebook

Command

!apt -y update -qq
!wget https://github.com/camenduru/gperftools/releases/download/v1.0/libtcmalloc_minimal.so.4 -O /content/libtcmalloc_minimal.so.4
%env LD_PRELOAD=/content/libtcmalloc_minimal.so.4

!apt -y install -qq aria2 libcairo2-dev pkg-config python3-dev
!pip install -q torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2+cu118 torchtext==0.15.2 torchdata==0.6.1 --extra-index-url https://download.pytorch.org/whl/cu118 -U
!pip install -q xformers==0.0.20 triton==2.0.0 gradio_client==0.2.7 -U
!pip install httpx==0.24.1

!pip install -U insightface

!git clone -b v2.7 https://github.com/camenduru/stable-diffusion-webui
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/h94/IP-Adapter-FaceID/blob/main/ip-adapter-faceid-plus_sd15.bin -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o ip-adapter-faceid-plus_sd15.bin
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/h94/IP-Adapter-FaceID/blob/main/ip-adapter-faceid-plus_sd15_lora.safetensors -d /content/stable-diffusion-webui/models/Lora -o ip-adapter-faceid-plus_sd15_lora.safetensors

!python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue --multiple --disable-model-loading-ram-optimization`

Stacktrace

reading lora /content/stable-diffusion-webui/models/Lora/ip-adapter-faceid-plus_sd15_lora.safetensors: AssertionError
Traceback (most recent call last):
  File "/content/stable-diffusion-webui/extensions-builtin/Lora/network.py", line 35, in __init__
    self.metadata = cache.cached_data_for_file('safetensors-metadata', "lora/" + self.name, filename, read_metadata)
  File "/content/stable-diffusion-webui/modules/cache.py", line 115, in cached_data_for_file
    value = func()
  File "/content/stable-diffusion-webui/extensions-builtin/Lora/network.py", line 28, in read_metadata
    metadata = sd_models.read_metadata_from_safetensors(filename)
  File "/content/stable-diffusion-webui/modules/sd_models.py", line 282, in read_metadata_from_safetensors
    assert metadata_len > 2 and json_start in (b'{"', b"{'"), f"{filename} is not a safetensors file"
AssertionError: /content/stable-diffusion-webui/models/Lora/ip-adapter-faceid-plus_sd15_lora.safetensors is not a safetensors file

reading lora /content/stable-diffusion-webui/models/Lora/ip-adapter-faceid-plusv2_sd15_lora.safetensors: AssertionError
Traceback (most recent call last):
  File "/content/stable-diffusion-webui/extensions-builtin/Lora/network.py", line 35, in __init__
    self.metadata = cache.cached_data_for_file('safetensors-metadata', "lora/" + self.name, filename, read_metadata)
  File "/content/stable-diffusion-webui/modules/cache.py", line 115, in cached_data_for_file
    value = func()
  File "/content/stable-diffusion-webui/extensions-builtin/Lora/network.py", line 28, in read_metadata
    metadata = sd_models.read_metadata_from_safetensors(filename)
  File "/content/stable-diffusion-webui/modules/sd_models.py", line 282, in read_metadata_from_safetensors
    assert metadata_len > 2 and json_start in (b'{"', b"{'"), f"{filename} is not a safetensors file"
AssertionError: /content/stable-diffusion-webui/models/Lora/ip-adapter-faceid-plusv2_sd15_lora.safetensors is not a safetensors file