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
5.21k stars 337 forks source link

Installation? #9

Open prateekjoshi565 opened 1 year ago

prateekjoshi565 commented 1 year ago

How to install IP-Adapter? Please help.

xiaohu2015 commented 1 year ago

@prateekjoshi565 hi, you can just using the Colab demo in the README (click button with open Colab demo). Or, if you are familiar with https://github.com/comfyanonymous/ComfyUI, you can use the plugin https://github.com/laksjdjf/IPAdapter-ComfyUI.

prateekjoshi565 commented 1 year ago

In the Colab demo, there is no mention of installation.

xiaohu2015 commented 1 year ago

@prateekjoshi565 you need only install diffusers, or you can reference https://github.com/tencent-ailab/IP-Adapter/issues/11

prateekjoshi565 commented 1 year ago

@xiaohu2015 I am still not able to install IPAdapter. diffuserslibrary is already installed.

xiaohu2015 commented 1 year ago

@prateekjoshi565 can you show your errors? Maybe you can use WebUI and ComfyUI.

h3clikejava commented 1 year ago

ModuleNotFoundError Traceback (most recent call last) in <cell line: 5>() 3 from PIL import Image 4 ----> 5 from ip_adapter import IPAdapter

ModuleNotFoundError: No module named 'ip_adapter'

xiaohu2015 commented 1 year ago

@h3clikejava

# Clone the repository
!git clone https://github.com/tencent-ailab/IP-Adapter.git

# Create directories to store the downloaded files
!mkdir -p /content/IP-Adapter/models

# Download IP-Adapter model checkpoints
!wget -P /content/IP-Adapter/models/ https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15.bin
!wget -P /content/IP-Adapter/models/ https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter-plus_sd15.bin

# Create directories to store the downloaded files
!mkdir -p /content/IP-Adapter/models/image_encoder

# Download image_encoder model checkpoints
!wget -O /content/IP-Adapter/models/image_encoder/pytorch_model.bin https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/pytorch_model.bin
!wget -O /content/IP-Adapter/models/image_encoder/config.json https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/config.json
# Add the module's directory to Python path
sys.path.append('/content/IP-Adapter')
doogyhatts commented 1 year ago

Additional dependencies: !apt install python3.10 !pip install diffusers[torch]==0.21.2 transformers xformers==0.0.20

For sys.path.append, need to import sys.

Ok I got it to work!

wilfrediscoming commented 12 months ago

all the examples code won't work.. this is very confusing

xiaohu2015 commented 12 months ago

all the examples code won't work.. this is very confusing

hi, can you show your error messages?

wilfrediscoming commented 12 months ago

all the examples code won't work.. this is very confusing

hi, can you show your error messages?

I tried to follow the installation code you mentioned, but I got


FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-6-e4b1a434845f>](https://localhost:8080/#) in <cell line: 2>()
      1 # load ip-adapter
----> 2 ip_model = IPAdapterXL(pipe, image_encoder_path, ip_ckpt, device)

4 frames
[/usr/local/lib/python3.10/dist-packages/torch/serialization.py](https://localhost:8080/#) in __init__(self, name, mode)
    414 class _open_file(_opener):
    415     def __init__(self, name, mode):
--> 416         super().__init__(open(name, mode))
    417 
    418     def __exit__(self, *args):

FileNotFoundError: [Errno 2] No such file or directory: '/content/IP-Adapter/models/ip-adapter_sdxl_vit-h.bin'
xiaohu2015 commented 12 months ago

all the examples code won't work.. this is very confusing

hi, can you show your error messages?

I tried to follow the installation code you mentioned, but I got

FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-6-e4b1a434845f>](https://localhost:8080/#) in <cell line: 2>()
      1 # load ip-adapter
----> 2 ip_model = IPAdapterXL(pipe, image_encoder_path, ip_ckpt, device)

4 frames
[/usr/local/lib/python3.10/dist-packages/torch/serialization.py](https://localhost:8080/#) in __init__(self, name, mode)
    414 class _open_file(_opener):
    415     def __init__(self, name, mode):
--> 416         super().__init__(open(name, mode))
    417 
    418     def __exit__(self, *args):

FileNotFoundError: [Errno 2] No such file or directory: '/content/IP-Adapter/models/ip-adapter_sdxl_vit-h.bin'

you should download the models https://huggingface.co/h94/IP-Adapter you can refer to this https://github.com/tencent-ailab/IP-Adapter/issues/9#issuecomment-1713982322

xiaohu2015 commented 12 months ago

@all please refer to https://github.com/tencent-ailab/IP-Adapter#installation

mtaher852 commented 5 months ago

Run this:

pip install git+https://github.com/tencent-ailab/IP-Adapter.git

---------- Source ----------- https://github.com/tencent-ailab/IP-Adapter

harishraman94 commented 4 months ago

I'm not sure if this is getting installed. All i get is this from the console when running

pip install git+https://github.com/tencent-ailab/IP-Adapter.git Cloning https://github.com/tencent-ailab/IP-Adapter.git to c:\users\harish\appdata\local\temp\pip-req-build-z698p_85 Running command git clone -q https://github.com/tencent-ailab/IP-Adapter.git 'C:\Users\Harish\AppData\Local\Temp\pip-req-build-z698p_85' Resolved https://github.com/tencent-ailab/IP-Adapter.git to commit 62e4af9d0c1ac7d5f8dd386a0ccf2211346af1a2 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done

After this, i'm still getting an error saying:

No module named ip-adapter, while using musev

can someone help?