mshuvi commited on
Commit
fbeed9d
1 Parent(s): 7a76f9a

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ flagged/pil_image/ae09a27c2631fdd526eb28377e9b429645f64794/tmpcc5knpm1.jpg filter=lfs diff=lfs merge=lfs -text
.ipynb_checkpoints/maayan_face_similarity-checkpoint.json ADDED
The diff for this file is too large to render. See raw diff
 
README.md CHANGED
@@ -1,12 +1,127 @@
1
  ---
2
- title: IP Adapter
3
- emoji: 📈
4
- colorFrom: red
5
- colorTo: indigo
6
  sdk: gradio
7
- sdk_version: 3.50.2
8
- app_file: app.py
9
- pinned: false
10
  ---
 
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: IP-Adapter
3
+ app_file: webui.ipynb
 
 
4
  sdk: gradio
5
+ sdk_version: 3.37.0
 
 
6
  ---
7
+ # IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models
8
 
9
+ <div align="center">
10
+
11
+ [**Project Page**](https://ip-adapter.github.io) **|** [**Paper (ArXiv)**](https://arxiv.org/abs/2308.06721)
12
+ </div>
13
+
14
+ ---
15
+
16
+
17
+ ## Introduction
18
+
19
+ we present IP-Adapter, an effective and lightweight adapter to achieve image prompt capability for the pre-trained text-to-image diffusion models. An IP-Adapter with only 22M parameters can achieve comparable or even better performance to a fine-tuned image prompt model. IP-Adapter can be generalized not only to other custom models fine-tuned from the same base model, but also to controllable generation using existing controllable tools. Moreover, the image prompt can also work well with the text prompt to accomplish multimodal image generation.
20
+
21
+ ![arch](assets/figs/fig1.png)
22
+
23
+ ## Release
24
+ - [2023/9/08] 🔥 Update a new version of IP-Adapter with SDXL_1.0. More information can be found [here](#sdxl_10).
25
+ - [2023/9/05] 🔥🔥🔥 IP-Adapter is supported in [WebUI](https://github.com/Mikubill/sd-webui-controlnet/discussions/2039) and [ComfyUI](https://github.com/laksjdjf/IPAdapter-ComfyUI) (or [ComfyUI_IPAdapter_plus](https://github.com/cubiq/ComfyUI_IPAdapter_plus)).
26
+ - [2023/8/30] 🔥 Add an IP-Adapter with face image as prompt. The demo is [here](ip_adapter-plus-face_demo.ipynb).
27
+ - [2023/8/29] 🔥 Release the training code.
28
+ - [2023/8/23] 🔥 Add code and models of IP-Adapter with fine-grained features. The demo is [here](ip_adapter-plus_demo.ipynb).
29
+ - [2023/8/18] 🔥 Add code and models for [SDXL 1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0). The demo is [here](ip_adapter_sdxl_demo.ipynb).
30
+ - [2023/8/16] 🔥 We release the code and models.
31
+
32
+
33
+ ## Dependencies
34
+ - diffusers >= 0.19.3
35
+
36
+ ## Download Models
37
+
38
+ you can download models from [here](https://huggingface.co/h94/IP-Adapter). To run the demo, you should also download the following models:
39
+ - [runwayml/stable-diffusion-v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5)
40
+ - [stabilityai/sd-vae-ft-mse](https://huggingface.co/stabilityai/sd-vae-ft-mse)
41
+ - [SG161222/Realistic_Vision_V4.0_noVAE](https://huggingface.co/SG161222/Realistic_Vision_V4.0_noVAE)
42
+ - [ControlNet models](https://huggingface.co/lllyasviel)
43
+
44
+ ## How to Use
45
+
46
+ ### SD_1.5
47
+
48
+ - [**ip_adapter_demo**](ip_adapter_demo.ipynb): image variations, image-to-image, and inpainting with image prompt.
49
+ - [![**ip_adapter_demo**](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/tencent-ailab/IP-Adapter/blob/main/ip_adapter_demo.ipynb)
50
+
51
+ ![image variations](assets/demo/image_variations.jpg)
52
+
53
+ ![image-to-image](assets/demo/image-to-image.jpg)
54
+
55
+ ![inpainting](assets/demo/inpainting.jpg)
56
+
57
+ - [**ip_adapter_controlnet_demo**](ip_adapter_controlnet_demo_new.ipynb), [**ip_adapter_t2i-adapter**](ip_adapter_t2i-adapter_demo.ipynb): structural generation with image prompt.
58
+ - [![**ip_adapter_controlnet_demo**](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/tencent-ailab/IP-Adapter/blob/main/ip_adapter_controlnet_demo.ipynb)
59
+
60
+ ![structural_cond](assets/demo/structural_cond.jpg)
61
+ ![structural_cond2](assets/demo/t2i-adapter_demo.jpg)
62
+
63
+ - [**ip_adapter_multimodal_prompts_demo**](ip_adapter_multimodal_prompts_demo.ipynb): generation with multimodal prompts.
64
+ - [![**ip_adapter_multimodal_prompts_demo**](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/tencent-ailab/IP-Adapter/blob/main/ip_adapter_multimodal_prompts_demo.ipynb)
65
+
66
+ ![multi_prompts](assets/demo/multi_prompts.jpg)
67
+
68
+ - [**ip_adapter-plus_demo**](ip_adapter-plus_demo.ipynb): the demo of IP-Adapter with fine-grained features.
69
+
70
+ ![ip_adpter_plus_image_variations](assets/demo/ip_adpter_plus_image_variations.jpg)
71
+ ![ip_adpter_plus_multi](assets/demo/ip_adpter_plus_multi.jpg)
72
+
73
+ - [**ip_adapter-plus-face_demo**](ip_adapter-plus-face_demo.ipynb): generation with face image as prompt.
74
+
75
+ ![ip_adpter_plus_face](assets/demo/sd15_face.jpg)
76
+
77
+ **Best Practice**
78
+ - If you only use the image prompt, you can set the `scale=1.0` and `text_prompt=""`(or some generic text prompts, e.g. "best quality", you can also use any negative text prompt). If you lower the `scale`, more diverse images can be generated, but they may not be as consistent with the image prompt.
79
+ - For multimodal prompts, you can adjust the `scale` to get the best results. In most cases, setting `scale=0.5` can get good results. For the version of SD 1.5, we recommend using community models to generate good images.
80
+
81
+ ### SDXL_1.0
82
+
83
+ - [**ip_adapter_sdxl_demo**](ip_adapter_sdxl_demo.ipynb): image variations with image prompt.
84
+ - [**ip_adapter_sdxl_controlnet_demo**](ip_adapter_sdxl_controlnet_demo.ipynb): structural generation with image prompt.
85
+
86
+ The comparison of **IP-Adapter_XL** with [Reimagine XL](https://clipdrop.co/stable-diffusion-reimagine) is shown as follows:
87
+
88
+ ![sdxl_demo](assets/demo/sdxl_cmp.jpg)
89
+
90
+ **Improvements in new version (2023.9.8)**:
91
+ - **Switch to CLIP-ViT-H**: we trained the new IP-Adapter with [OpenCLIP-ViT-H-14](https://huggingface.co/laion/CLIP-ViT-H-14-laion2B-s32B-b79K) instead of [OpenCLIP-ViT-bigG-14](https://huggingface.co/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k). Although ViT-bigG is much larger than ViT-H, our experimental results did not find a significant difference, and the smaller model can reduce the memory usage in the inference phase.
92
+ - **A Faster and better training recipe**: In our previous version, training directly at a resolution of 1024x1024 proved to be highly inefficient. However, in the new version, we have implemented a more effective two-stage training strategy. Firstly, we perform pre-training at a resolution of 512x512. Then, we employ a multi-scale strategy for fine-tuning. (Maybe this training strategy can also be used to speed up the training of controlnet).
93
+
94
+ ## How to Train
95
+ For training, you should install [accelerate](https://github.com/huggingface/accelerate) and make your own dataset into a json file.
96
+
97
+ ```
98
+ accelerate launch --num_processes 8 --multi_gpu --mixed_precision "fp16" \
99
+ tutorial_train.py \
100
+ --pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5/" \
101
+ --image_encoder_path="{image_encoder_path}" \
102
+ --data_json_file="{data.json}" \
103
+ --data_root_path="{image_path}" \
104
+ --mixed_precision="fp16" \
105
+ --resolution=512 \
106
+ --train_batch_size=8 \
107
+ --dataloader_num_workers=4 \
108
+ --learning_rate=1e-04 \
109
+ --weight_decay=0.01 \
110
+ --output_dir="{output_dir}" \
111
+ --save_steps=10000
112
+ ```
113
+
114
+ ## Disclaimer
115
+
116
+ This project strives to positively impact the domain of AI-driven image generation. Users are granted the freedom to create images using this tool, but they are expected to comply with local laws and utilize it in a responsible manner. **The developers do not assume any responsibility for potential misuse by users.**
117
+
118
+ ## Citation
119
+ If you find IP-Adapter useful for your research and applications, please cite using this BibTeX:
120
+ ```bibtex
121
+ @article{ye2023ip-adapter,
122
+ title={IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models},
123
+ author={Ye, Hu and Zhang, Jun and Liu, Sibo and Han, Xiao and Yang, Wei},
124
+ booktitle={arXiv preprint arxiv:2308.06721},
125
+ year={2023}
126
+ }
127
+ ```
amir_face/00001.jpg ADDED
amir_face/00002.jpg ADDED
amir_face/00003.jpg ADDED
amir_face/00004.jpg ADDED
amir_face/00005.jpg ADDED
amir_face/00006.jpg ADDED
amir_face/00007.jpg ADDED
amir_face/00008.jpg ADDED
amir_face/00009.jpg ADDED
amir_face/00010.jpg ADDED
amir_face/00011.jpg ADDED
amir_face/00012.jpg ADDED
amir_face/00013.jpg ADDED
amir_face/00014.jpg ADDED
amir_face/00015.jpg ADDED
amir_face/00016.jpg ADDED
amir_face/00017.jpg ADDED
amir_face/00018.jpg ADDED
amir_face/00019.jpg ADDED
amir_face/00020.jpg ADDED
amir_face/00021.jpg ADDED
amir_face/00022.jpg ADDED
amir_face/00023.jpg ADDED
amir_face/00024.jpg ADDED
amir_face/00025.jpg ADDED
amir_face/00026.jpg ADDED
amir_face/00027.jpg ADDED
amir_face/00028.jpg ADDED
amir_face/00029.jpg ADDED
amir_face/00030.jpg ADDED
amir_face/00031.jpg ADDED
amir_face/00032.jpg ADDED
amir_face/00033.jpg ADDED
amir_face/00034.jpg ADDED
amir_face/00035.jpg ADDED
amir_face/00036.jpg ADDED
amir_face/00037.jpg ADDED
amir_face/00038.jpg ADDED
amir_face/00039.jpg ADDED
amir_face/00040.jpg ADDED
amir_face/00041.jpg ADDED
amir_face/00042.jpg ADDED
amir_face/00043.jpg ADDED
amir_face/00044.jpg ADDED
amir_face/00045.jpg ADDED
amir_face/00046.jpg ADDED
amir_face/00047.jpg ADDED