File size: 861 Bytes
baa8e90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
## plusかどうか
`state_dict["image_proj"]["lantents"]`の存在で判断

## テキストエンコーダの隠れ状態次元数:
keyの入力次元で判断

`cross_attention_dim = state_dict["ip_adapter"]["1.to_k_ip.weight"].shape[1]`

## SDXLかどうか
`sdxl = self.cross_attention_dim == 2048`

## IP-Adapterのトークン数
plusでない場合image_projの出力次元からcross_attention_dimを割る

`clip_extra_context_tokens = state_dict["image_proj"]["proj.weight"].shape[0] // cross_attention_dim`

plusの場合latentsのトークン数で判断

`self.clip_extra_context_tokens = ip_state_dict["image_proj"]["latents"].shape[1]`

## CLIP特徴量の次元数
実際の出力で判断

`clip_embeddings_dim = cond.shape[-1]`

## 残り
plusの場合のresamplerの設定は保留・・・

```
depth=4
dim_head=64
heads=12
ff_mult=4
```