codeShare commited on
Commit
636ddcc
·
verified ·
1 Parent(s): 60ccd04

Delete lora_merge.ipynb

Browse files
Files changed (1) hide show
  1. lora_merge.ipynb +0 -724
lora_merge.ipynb DELETED
@@ -1,724 +0,0 @@
1
- {
2
- "nbformat": 4,
3
- "nbformat_minor": 0,
4
- "metadata": {
5
- "colab": {
6
- "provenance": []
7
- },
8
- "kernelspec": {
9
- "name": "python3",
10
- "display_name": "Python 3"
11
- },
12
- "language_info": {
13
- "name": "python"
14
- }
15
- },
16
- "cells": [
17
- {
18
- "cell_type": "markdown",
19
- "source": [
20
- "# Cast civitai trained LoRa in torch.bfloat16 to Tensor Art Compatible torch.float16 dtype\n",
21
- "\n",
22
- "Created by Adcom: https://tensor.art/u/743241123023077878"
23
- ],
24
- "metadata": {
25
- "id": "YDCnQpDdqDe4"
26
- }
27
- },
28
- {
29
- "cell_type": "code",
30
- "source": [
31
- "#initialize\n",
32
- "import torch\n",
33
- "from safetensors.torch import load_file\n",
34
- "from google.colab import drive\n",
35
- "drive.mount('/content/drive')"
36
- ],
37
- "metadata": {
38
- "id": "1oxeJYHRqxQC",
39
- "outputId": "5397ceb1-cd98-4477-f472-d766beac79fb",
40
- "colab": {
41
- "base_uri": "https://localhost:8080/"
42
- }
43
- },
44
- "execution_count": 1,
45
- "outputs": [
46
- {
47
- "output_type": "stream",
48
- "name": "stdout",
49
- "text": [
50
- "Mounted at /content/drive\n"
51
- ]
52
- }
53
- ]
54
- },
55
- {
56
- "cell_type": "code",
57
- "source": [
58
- "cgi = load_file('/content/drive/MyDrive/Saved from Chrome/cgi_style.safetensors')"
59
- ],
60
- "metadata": {
61
- "id": "JuGDCX5272Bh"
62
- },
63
- "execution_count": 10,
64
- "outputs": []
65
- },
66
- {
67
- "cell_type": "code",
68
- "source": [
69
- "cgi = load_file('/content/drive/MyDrive/Saved from Chrome/cgi_style.safetensors')\n",
70
- "iris = load_file('/content/drive/MyDrive/Saved from Chrome/proud_iris.safetensors')\n",
71
- "nudism = load_file('/content/drive/MyDrive/Saved from Chrome/nudism.safetensors')"
72
- ],
73
- "metadata": {
74
- "id": "FftDdBRG7su6"
75
- },
76
- "execution_count": 107,
77
- "outputs": []
78
- },
79
- {
80
- "cell_type": "code",
81
- "source": [
82
- "for key in cgi:\n",
83
- " cgi[f'{key}'] = cgi[f'{key}'].to(dtype=torch.float16)\n",
84
- " iris[f'{key}'] = iris[f'{key}'].to(dtype=torch.float16)\n",
85
- " nudism[f'{key}'] = nudism[f'{key}'].to(dtype=torch.float16)"
86
- ],
87
- "metadata": {
88
- "id": "RII9SEqh8KH2"
89
- },
90
- "execution_count": 108,
91
- "outputs": []
92
- },
93
- {
94
- "cell_type": "code",
95
- "source": [
96
- "import torch\n",
97
- "import torch.nn as nn\n",
98
- "#define metric for similarity\n",
99
- "tgt_dim = torch.Size([64, 3072])\n",
100
- "cos0 = nn.CosineSimilarity(dim=1)\n",
101
- "cos = nn.CosineSimilarity(dim=1)\n",
102
- "\n",
103
- "\n",
104
- "def sim(tgt , ref ,key):\n",
105
- " return torch.sum(torch.abs(cos(tgt, ref[f'{key}']))) + torch.sum(torch.abs(cos0(tgt, ref[f'{key}'])))\n",
106
- "#-----#\n",
107
- "\n",
108
- "from torch import linalg as LA\n",
109
- "def rand_search(A , B , key , iters):\n",
110
- " tgt_norm = (LA.matrix_norm(A[f'{key}']) + LA.matrix_norm(B[f'{key}']))/2\n",
111
- " tgt_avg = (A[f'{key}'] + B[f'{key}'])/2\n",
112
- "\n",
113
- " max_sim = (sim(tgt_avg , A , key) + sim(tgt_avg , B , key))\n",
114
- " cand = tgt_avg\n",
115
- "\n",
116
- " for iter in range(iters):\n",
117
- " rand = torch.ones(tgt_dim)*(-0.5) + torch.rand(tgt_dim)\n",
118
- " rand = rand * (tgt_norm/LA.matrix_norm(rand))\n",
119
- " #rand = (rand + tgt_avg)/2\n",
120
- " #rand = rand * (tgt_norm/LA.matrix_norm(rand))\n",
121
- "\n",
122
- " tmp = sim(rand,A, key) + sim(rand , B, key)\n",
123
- " if (tmp > max_sim):\n",
124
- " max_sim = tmp\n",
125
- " cand = rand\n",
126
- " print('found!')\n",
127
- " break\n",
128
- " #------#\n",
129
- " print('returning')\n",
130
- " return cand , max_sim\n",
131
- "#-----#"
132
- ],
133
- "metadata": {
134
- "id": "hJL6QEclHdHn"
135
- },
136
- "execution_count": 104,
137
- "outputs": []
138
- },
139
- {
140
- "cell_type": "code",
141
- "source": [
142
- "cand , max_sim = rand_search(cgi , iris , 'lora_unet_double_blocks_0_img_attn_proj.lora_down.weight' , 1000)\n",
143
- "print(sim(cand , iris , key))\n",
144
- "print(sim(cand , cgi , key))"
145
- ],
146
- "metadata": {
147
- "id": "ckyBSQi5Ll4F",
148
- "outputId": "341f7192-083d-4423-f61f-4f49d5756e79",
149
- "colab": {
150
- "base_uri": "https://localhost:8080/"
151
- }
152
- },
153
- "execution_count": 106,
154
- "outputs": [
155
- {
156
- "output_type": "stream",
157
- "name": "stdout",
158
- "text": [
159
- "returning\n",
160
- "tensor(91.1875, dtype=torch.float16)\n",
161
- "tensor(90.2500, dtype=torch.float16)\n"
162
- ]
163
- }
164
- ]
165
- },
166
- {
167
- "cell_type": "code",
168
- "source": [
169
- "from safetensors.torch import load_file , save_file\n",
170
- "\n",
171
- "merge = load_file('/content/drive/MyDrive/Saved from Chrome/cgi_style.safetensors')\n",
172
- "for key in cgi:\n",
173
- " if cgi[f'{key}'].shape == torch.Size([]): continue\n",
174
- " merge[f'{key}'] = (cgi[f'{key}'] + iris[f'{key}'])/2\n",
175
- "\n",
176
- "%cd /content/\n",
177
- "save_file(merge , 'cgi_iris_1_1_1_merge.safetensors')"
178
- ],
179
- "metadata": {
180
- "id": "9L_g5Zp9Du2E",
181
- "outputId": "38661765-461a-42c3-8480-38fe7f1abe3e",
182
- "colab": {
183
- "base_uri": "https://localhost:8080/"
184
- }
185
- },
186
- "execution_count": 113,
187
- "outputs": [
188
- {
189
- "output_type": "stream",
190
- "name": "stdout",
191
- "text": [
192
- "/content\n"
193
- ]
194
- }
195
- ]
196
- },
197
- {
198
- "cell_type": "code",
199
- "source": [
200
- "tgt_dim = torch.Size([64, 3072])\n",
201
- "cosa = nn.CosineSimilarity(dim=0)\n",
202
- "cos_dim1 = nn.CosineSimilarity(dim=1)\n",
203
- "\n",
204
- "for key in cgi:\n",
205
- " if not cgi[f'{key}'].shape == torch.Size([64, 3072]): continue\n",
206
- " print(f'{key} : ')\n",
207
- " print(torch.sum(torch.abs(cos_dim1(cgi[f'{key}'] , iris[f'{key}']))))"
208
- ],
209
- "metadata": {
210
- "id": "VFNw0Nck8V6Q",
211
- "outputId": "e48bab98-18f7-43bb-d1cf-89f3e00f7ccf",
212
- "colab": {
213
- "base_uri": "https://localhost:8080/"
214
- }
215
- },
216
- "execution_count": 39,
217
- "outputs": [
218
- {
219
- "output_type": "stream",
220
- "name": "stdout",
221
- "text": [
222
- "lora_unet_double_blocks_0_img_attn_proj.lora_down.weight : \n",
223
- "tensor(1.6982, dtype=torch.float16)\n",
224
- "lora_unet_double_blocks_0_img_attn_qkv.lora_down.weight : \n",
225
- "tensor(1.8145, dtype=torch.float16)\n",
226
- "lora_unet_double_blocks_0_img_mlp_0.lora_down.weight : \n",
227
- "tensor(1.6309, dtype=torch.float16)\n",
228
- "lora_unet_double_blocks_0_img_mod_lin.lora_down.weight : \n",
229
- "tensor(2.6211, dtype=torch.float16)\n",
230
- "lora_unet_double_blocks_0_txt_attn_proj.lora_down.weight : \n",
231
- "tensor(2.3203, dtype=torch.float16)\n",
232
- "lora_unet_double_blocks_0_txt_attn_qkv.lora_down.weight : \n",
233
- "tensor(2.3027, dtype=torch.float16)\n",
234
- "lora_unet_double_blocks_0_txt_mlp_0.lora_down.weight : \n",
235
- "tensor(2.5898, dtype=torch.float16)\n",
236
- "lora_unet_double_blocks_0_txt_mod_lin.lora_down.weight : \n",
237
- "tensor(2.7402, dtype=torch.float16)\n",
238
- "lora_unet_double_blocks_10_img_attn_proj.lora_down.weight : \n",
239
- "tensor(2.0410, dtype=torch.float16)\n",
240
- "lora_unet_double_blocks_10_img_attn_qkv.lora_down.weight : \n",
241
- "tensor(1.3350, dtype=torch.float16)\n",
242
- "lora_unet_double_blocks_10_img_mlp_0.lora_down.weight : \n",
243
- "tensor(2.0020, dtype=torch.float16)\n",
244
- "lora_unet_double_blocks_10_img_mod_lin.lora_down.weight : \n",
245
- "tensor(2.6562, dtype=torch.float16)\n",
246
- "lora_unet_double_blocks_10_txt_attn_proj.lora_down.weight : \n",
247
- "tensor(1.1816, dtype=torch.float16)\n",
248
- "lora_unet_double_blocks_10_txt_attn_qkv.lora_down.weight : \n",
249
- "tensor(1.1348, dtype=torch.float16)\n",
250
- "lora_unet_double_blocks_10_txt_mlp_0.lora_down.weight : \n",
251
- "tensor(3.0156, dtype=torch.float16)\n",
252
- "lora_unet_double_blocks_10_txt_mod_lin.lora_down.weight : \n",
253
- "tensor(1.4746, dtype=torch.float16)\n",
254
- "lora_unet_double_blocks_11_img_attn_proj.lora_down.weight : \n",
255
- "tensor(1.8359, dtype=torch.float16)\n",
256
- "lora_unet_double_blocks_11_img_attn_qkv.lora_down.weight : \n",
257
- "tensor(1.5312, dtype=torch.float16)\n",
258
- "lora_unet_double_blocks_11_img_mlp_0.lora_down.weight : \n",
259
- "tensor(2.1465, dtype=torch.float16)\n",
260
- "lora_unet_double_blocks_11_img_mod_lin.lora_down.weight : \n",
261
- "tensor(3.9277, dtype=torch.float16)\n",
262
- "lora_unet_double_blocks_11_txt_attn_proj.lora_down.weight : \n",
263
- "tensor(1.7246, dtype=torch.float16)\n",
264
- "lora_unet_double_blocks_11_txt_attn_qkv.lora_down.weight : \n",
265
- "tensor(1.8594, dtype=torch.float16)\n",
266
- "lora_unet_double_blocks_11_txt_mlp_0.lora_down.weight : \n",
267
- "tensor(3.6465, dtype=torch.float16)\n",
268
- "lora_unet_double_blocks_11_txt_mod_lin.lora_down.weight : \n",
269
- "tensor(2.6152, dtype=torch.float16)\n",
270
- "lora_unet_double_blocks_12_img_attn_proj.lora_down.weight : \n",
271
- "tensor(1.7295, dtype=torch.float16)\n",
272
- "lora_unet_double_blocks_12_img_attn_qkv.lora_down.weight : \n",
273
- "tensor(1.4795, dtype=torch.float16)\n",
274
- "lora_unet_double_blocks_12_img_mlp_0.lora_down.weight : \n",
275
- "tensor(3.4043, dtype=torch.float16)\n",
276
- "lora_unet_double_blocks_12_img_mod_lin.lora_down.weight : \n",
277
- "tensor(2.0137, dtype=torch.float16)\n",
278
- "lora_unet_double_blocks_12_txt_attn_proj.lora_down.weight : \n",
279
- "tensor(1.4375, dtype=torch.float16)\n",
280
- "lora_unet_double_blocks_12_txt_attn_qkv.lora_down.weight : \n",
281
- "tensor(1.8994, dtype=torch.float16)\n",
282
- "lora_unet_double_blocks_12_txt_mlp_0.lora_down.weight : \n",
283
- "tensor(2.1152, dtype=torch.float16)\n",
284
- "lora_unet_double_blocks_12_txt_mod_lin.lora_down.weight : \n",
285
- "tensor(1.2744, dtype=torch.float16)\n",
286
- "lora_unet_double_blocks_13_img_attn_proj.lora_down.weight : \n",
287
- "tensor(3.0742, dtype=torch.float16)\n",
288
- "lora_unet_double_blocks_13_img_attn_qkv.lora_down.weight : \n",
289
- "tensor(1.4980, dtype=torch.float16)\n",
290
- "lora_unet_double_blocks_13_img_mlp_0.lora_down.weight : \n",
291
- "tensor(1.9609, dtype=torch.float16)\n",
292
- "lora_unet_double_blocks_13_img_mod_lin.lora_down.weight : \n",
293
- "tensor(2.6133, dtype=torch.float16)\n",
294
- "lora_unet_double_blocks_13_txt_attn_proj.lora_down.weight : \n",
295
- "tensor(1.6904, dtype=torch.float16)\n",
296
- "lora_unet_double_blocks_13_txt_attn_qkv.lora_down.weight : \n",
297
- "tensor(2.1680, dtype=torch.float16)\n",
298
- "lora_unet_double_blocks_13_txt_mlp_0.lora_down.weight : \n",
299
- "tensor(2.8574, dtype=torch.float16)\n",
300
- "lora_unet_double_blocks_13_txt_mod_lin.lora_down.weight : \n",
301
- "tensor(1.9053, dtype=torch.float16)\n",
302
- "lora_unet_double_blocks_14_img_attn_proj.lora_down.weight : \n",
303
- "tensor(1.8135, dtype=torch.float16)\n",
304
- "lora_unet_double_blocks_14_img_attn_qkv.lora_down.weight : \n",
305
- "tensor(1.4033, dtype=torch.float16)\n",
306
- "lora_unet_double_blocks_14_img_mlp_0.lora_down.weight : \n",
307
- "tensor(1.5547, dtype=torch.float16)\n",
308
- "lora_unet_double_blocks_14_img_mod_lin.lora_down.weight : \n",
309
- "tensor(2.8906, dtype=torch.float16)\n",
310
- "lora_unet_double_blocks_14_txt_attn_proj.lora_down.weight : \n",
311
- "tensor(1.1328, dtype=torch.float16)\n",
312
- "lora_unet_double_blocks_14_txt_attn_qkv.lora_down.weight : \n",
313
- "tensor(1.3701, dtype=torch.float16)\n",
314
- "lora_unet_double_blocks_14_txt_mlp_0.lora_down.weight : \n",
315
- "tensor(3.3145, dtype=torch.float16)\n",
316
- "lora_unet_double_blocks_14_txt_mod_lin.lora_down.weight : \n",
317
- "tensor(1.2031, dtype=torch.float16)\n",
318
- "lora_unet_double_blocks_15_img_attn_proj.lora_down.weight : \n",
319
- "tensor(1.5137, dtype=torch.float16)\n",
320
- "lora_unet_double_blocks_15_img_attn_qkv.lora_down.weight : \n",
321
- "tensor(1.3809, dtype=torch.float16)\n",
322
- "lora_unet_double_blocks_15_img_mlp_0.lora_down.weight : \n",
323
- "tensor(1.4834, dtype=torch.float16)\n",
324
- "lora_unet_double_blocks_15_img_mod_lin.lora_down.weight : \n",
325
- "tensor(1.6465, dtype=torch.float16)\n",
326
- "lora_unet_double_blocks_15_txt_attn_proj.lora_down.weight : \n",
327
- "tensor(1.7256, dtype=torch.float16)\n",
328
- "lora_unet_double_blocks_15_txt_attn_qkv.lora_down.weight : \n",
329
- "tensor(2.8672, dtype=torch.float16)\n",
330
- "lora_unet_double_blocks_15_txt_mlp_0.lora_down.weight : \n",
331
- "tensor(2.1953, dtype=torch.float16)\n",
332
- "lora_unet_double_blocks_15_txt_mod_lin.lora_down.weight : \n",
333
- "tensor(0.9858, dtype=torch.float16)\n",
334
- "lora_unet_double_blocks_16_img_attn_proj.lora_down.weight : \n",
335
- "tensor(1.5703, dtype=torch.float16)\n",
336
- "lora_unet_double_blocks_16_img_attn_qkv.lora_down.weight : \n",
337
- "tensor(1.4648, dtype=torch.float16)\n",
338
- "lora_unet_double_blocks_16_img_mlp_0.lora_down.weight : \n",
339
- "tensor(1.5537, dtype=torch.float16)\n",
340
- "lora_unet_double_blocks_16_img_mod_lin.lora_down.weight : \n",
341
- "tensor(2.6133, dtype=torch.float16)\n",
342
- "lora_unet_double_blocks_16_txt_attn_proj.lora_down.weight : \n",
343
- "tensor(2.2559, dtype=torch.float16)\n",
344
- "lora_unet_double_blocks_16_txt_attn_qkv.lora_down.weight : \n",
345
- "tensor(1.9365, dtype=torch.float16)\n",
346
- "lora_unet_double_blocks_16_txt_mlp_0.lora_down.weight : \n",
347
- "tensor(2.7891, dtype=torch.float16)\n",
348
- "lora_unet_double_blocks_16_txt_mod_lin.lora_down.weight : \n",
349
- "tensor(1.3174, dtype=torch.float16)\n",
350
- "lora_unet_double_blocks_17_img_attn_proj.lora_down.weight : \n",
351
- "tensor(2.4609, dtype=torch.float16)\n",
352
- "lora_unet_double_blocks_17_img_attn_qkv.lora_down.weight : \n",
353
- "tensor(1.6240, dtype=torch.float16)\n",
354
- "lora_unet_double_blocks_17_img_mlp_0.lora_down.weight : \n",
355
- "tensor(3.1406, dtype=torch.float16)\n",
356
- "lora_unet_double_blocks_17_img_mod_lin.lora_down.weight : \n",
357
- "tensor(2.1055, dtype=torch.float16)\n",
358
- "lora_unet_double_blocks_17_txt_attn_proj.lora_down.weight : \n",
359
- "tensor(1.7480, dtype=torch.float16)\n",
360
- "lora_unet_double_blocks_17_txt_attn_qkv.lora_down.weight : \n",
361
- "tensor(1.6436, dtype=torch.float16)\n",
362
- "lora_unet_double_blocks_17_txt_mlp_0.lora_down.weight : \n",
363
- "tensor(1.9688, dtype=torch.float16)\n",
364
- "lora_unet_double_blocks_17_txt_mod_lin.lora_down.weight : \n",
365
- "tensor(1.8184, dtype=torch.float16)\n",
366
- "lora_unet_double_blocks_18_img_attn_proj.lora_down.weight : \n",
367
- "tensor(2.3887, dtype=torch.float16)\n",
368
- "lora_unet_double_blocks_18_img_attn_qkv.lora_down.weight : \n",
369
- "tensor(1.6738, dtype=torch.float16)\n",
370
- "lora_unet_double_blocks_18_img_mlp_0.lora_down.weight : \n",
371
- "tensor(3.7500, dtype=torch.float16)\n",
372
- "lora_unet_double_blocks_18_img_mod_lin.lora_down.weight : \n",
373
- "tensor(2.7285, dtype=torch.float16)\n",
374
- "lora_unet_double_blocks_18_txt_attn_proj.lora_down.weight : \n",
375
- "tensor(2.0410, dtype=torch.float16)\n",
376
- "lora_unet_double_blocks_18_txt_attn_qkv.lora_down.weight : \n",
377
- "tensor(2.0586, dtype=torch.float16)\n",
378
- "lora_unet_double_blocks_18_txt_mlp_0.lora_down.weight : \n",
379
- "tensor(2.0801, dtype=torch.float16)\n",
380
- "lora_unet_double_blocks_18_txt_mod_lin.lora_down.weight : \n",
381
- "tensor(1.5684, dtype=torch.float16)\n",
382
- "lora_unet_double_blocks_1_img_attn_proj.lora_down.weight : \n",
383
- "tensor(4.9844, dtype=torch.float16)\n",
384
- "lora_unet_double_blocks_1_img_attn_qkv.lora_down.weight : \n",
385
- "tensor(1.8613, dtype=torch.float16)\n",
386
- "lora_unet_double_blocks_1_img_mlp_0.lora_down.weight : \n",
387
- "tensor(2.2266, dtype=torch.float16)\n",
388
- "lora_unet_double_blocks_1_img_mod_lin.lora_down.weight : \n",
389
- "tensor(2.8164, dtype=torch.float16)\n",
390
- "lora_unet_double_blocks_1_txt_attn_proj.lora_down.weight : \n",
391
- "tensor(1.7500, dtype=torch.float16)\n",
392
- "lora_unet_double_blocks_1_txt_attn_qkv.lora_down.weight : \n",
393
- "tensor(2.3105, dtype=torch.float16)\n",
394
- "lora_unet_double_blocks_1_txt_mlp_0.lora_down.weight : \n",
395
- "tensor(1.9639, dtype=torch.float16)\n",
396
- "lora_unet_double_blocks_1_txt_mod_lin.lora_down.weight : \n",
397
- "tensor(2.6504, dtype=torch.float16)\n",
398
- "lora_unet_double_blocks_2_img_attn_proj.lora_down.weight : \n",
399
- "tensor(4.6367, dtype=torch.float16)\n",
400
- "lora_unet_double_blocks_2_img_attn_qkv.lora_down.weight : \n",
401
- "tensor(1.7988, dtype=torch.float16)\n",
402
- "lora_unet_double_blocks_2_img_mlp_0.lora_down.weight : \n",
403
- "tensor(4.6758, dtype=torch.float16)\n",
404
- "lora_unet_double_blocks_2_img_mod_lin.lora_down.weight : \n",
405
- "tensor(3.1445, dtype=torch.float16)\n",
406
- "lora_unet_double_blocks_2_txt_attn_proj.lora_down.weight : \n",
407
- "tensor(2.2285, dtype=torch.float16)\n",
408
- "lora_unet_double_blocks_2_txt_attn_qkv.lora_down.weight : \n",
409
- "tensor(1.4990, dtype=torch.float16)\n",
410
- "lora_unet_double_blocks_2_txt_mlp_0.lora_down.weight : \n",
411
- "tensor(2.3984, dtype=torch.float16)\n",
412
- "lora_unet_double_blocks_2_txt_mod_lin.lora_down.weight : \n",
413
- "tensor(1.4443, dtype=torch.float16)\n",
414
- "lora_unet_double_blocks_3_img_attn_proj.lora_down.weight : \n",
415
- "tensor(3.6855, dtype=torch.float16)\n",
416
- "lora_unet_double_blocks_3_img_attn_qkv.lora_down.weight : \n",
417
- "tensor(1.9971, dtype=torch.float16)\n",
418
- "lora_unet_double_blocks_3_img_mlp_0.lora_down.weight : \n",
419
- "tensor(3.3301, dtype=torch.float16)\n",
420
- "lora_unet_double_blocks_3_img_mod_lin.lora_down.weight : \n",
421
- "tensor(2.3379, dtype=torch.float16)\n",
422
- "lora_unet_double_blocks_3_txt_attn_proj.lora_down.weight : \n",
423
- "tensor(2.0117, dtype=torch.float16)\n",
424
- "lora_unet_double_blocks_3_txt_attn_qkv.lora_down.weight : \n",
425
- "tensor(2.1621, dtype=torch.float16)\n",
426
- "lora_unet_double_blocks_3_txt_mlp_0.lora_down.weight : \n",
427
- "tensor(2.7676, dtype=torch.float16)\n",
428
- "lora_unet_double_blocks_3_txt_mod_lin.lora_down.weight : \n",
429
- "tensor(3.1895, dtype=torch.float16)\n",
430
- "lora_unet_double_blocks_4_img_attn_proj.lora_down.weight : \n",
431
- "tensor(2.3848, dtype=torch.float16)\n",
432
- "lora_unet_double_blocks_4_img_attn_qkv.lora_down.weight : \n",
433
- "tensor(1.7783, dtype=torch.float16)\n",
434
- "lora_unet_double_blocks_4_img_mlp_0.lora_down.weight : \n",
435
- "tensor(2.0234, dtype=torch.float16)\n",
436
- "lora_unet_double_blocks_4_img_mod_lin.lora_down.weight : \n",
437
- "tensor(1.9082, dtype=torch.float16)\n",
438
- "lora_unet_double_blocks_4_txt_attn_proj.lora_down.weight : \n",
439
- "tensor(1.7588, dtype=torch.float16)\n",
440
- "lora_unet_double_blocks_4_txt_attn_qkv.lora_down.weight : \n",
441
- "tensor(2.9902, dtype=torch.float16)\n",
442
- "lora_unet_double_blocks_4_txt_mlp_0.lora_down.weight : \n",
443
- "tensor(1.5859, dtype=torch.float16)\n",
444
- "lora_unet_double_blocks_4_txt_mod_lin.lora_down.weight : \n",
445
- "tensor(1.5654, dtype=torch.float16)\n",
446
- "lora_unet_double_blocks_5_img_attn_proj.lora_down.weight : \n",
447
- "tensor(2.7402, dtype=torch.float16)\n",
448
- "lora_unet_double_blocks_5_img_attn_qkv.lora_down.weight : \n",
449
- "tensor(1.6221, dtype=torch.float16)\n",
450
- "lora_unet_double_blocks_5_img_mlp_0.lora_down.weight : \n",
451
- "tensor(1.6318, dtype=torch.float16)\n",
452
- "lora_unet_double_blocks_5_img_mod_lin.lora_down.weight : \n",
453
- "tensor(1.7988, dtype=torch.float16)\n",
454
- "lora_unet_double_blocks_5_txt_attn_proj.lora_down.weight : \n",
455
- "tensor(1.1699, dtype=torch.float16)\n",
456
- "lora_unet_double_blocks_5_txt_attn_qkv.lora_down.weight : \n",
457
- "tensor(3.5566, dtype=torch.float16)\n",
458
- "lora_unet_double_blocks_5_txt_mlp_0.lora_down.weight : \n",
459
- "tensor(1.5791, dtype=torch.float16)\n",
460
- "lora_unet_double_blocks_5_txt_mod_lin.lora_down.weight : \n",
461
- "tensor(1.5547, dtype=torch.float16)\n",
462
- "lora_unet_double_blocks_6_img_attn_proj.lora_down.weight : \n",
463
- "tensor(1.7988, dtype=torch.float16)\n",
464
- "lora_unet_double_blocks_6_img_attn_qkv.lora_down.weight : \n",
465
- "tensor(1.4531, dtype=torch.float16)\n",
466
- "lora_unet_double_blocks_6_img_mlp_0.lora_down.weight : \n",
467
- "tensor(2.4141, dtype=torch.float16)\n",
468
- "lora_unet_double_blocks_6_img_mod_lin.lora_down.weight : \n",
469
- "tensor(6.0234, dtype=torch.float16)\n",
470
- "lora_unet_double_blocks_6_txt_attn_proj.lora_down.weight : \n",
471
- "tensor(1.0068, dtype=torch.float16)\n",
472
- "lora_unet_double_blocks_6_txt_attn_qkv.lora_down.weight : \n",
473
- "tensor(2.0098, dtype=torch.float16)\n",
474
- "lora_unet_double_blocks_6_txt_mlp_0.lora_down.weight : \n",
475
- "tensor(4.0312, dtype=torch.float16)\n",
476
- "lora_unet_double_blocks_6_txt_mod_lin.lora_down.weight : \n",
477
- "tensor(2.6309, dtype=torch.float16)\n",
478
- "lora_unet_double_blocks_7_img_attn_proj.lora_down.weight : \n",
479
- "tensor(1.4814, dtype=torch.float16)\n",
480
- "lora_unet_double_blocks_7_img_attn_qkv.lora_down.weight : \n",
481
- "tensor(1.4854, dtype=torch.float16)\n",
482
- "lora_unet_double_blocks_7_img_mlp_0.lora_down.weight : \n",
483
- "tensor(1.3877, dtype=torch.float16)\n",
484
- "lora_unet_double_blocks_7_img_mod_lin.lora_down.weight : \n",
485
- "tensor(2.3125, dtype=torch.float16)\n",
486
- "lora_unet_double_blocks_7_txt_attn_proj.lora_down.weight : \n",
487
- "tensor(3.4746, dtype=torch.float16)\n",
488
- "lora_unet_double_blocks_7_txt_attn_qkv.lora_down.weight : \n",
489
- "tensor(2.0430, dtype=torch.float16)\n",
490
- "lora_unet_double_blocks_7_txt_mlp_0.lora_down.weight : \n",
491
- "tensor(1.8018, dtype=torch.float16)\n",
492
- "lora_unet_double_blocks_7_txt_mod_lin.lora_down.weight : \n",
493
- "tensor(1.1709, dtype=torch.float16)\n",
494
- "lora_unet_double_blocks_8_img_attn_proj.lora_down.weight : \n",
495
- "tensor(1.8857, dtype=torch.float16)\n",
496
- "lora_unet_double_blocks_8_img_attn_qkv.lora_down.weight : \n",
497
- "tensor(1.8848, dtype=torch.float16)\n",
498
- "lora_unet_double_blocks_8_img_mlp_0.lora_down.weight : \n",
499
- "tensor(1.7627, dtype=torch.float16)\n",
500
- "lora_unet_double_blocks_8_img_mod_lin.lora_down.weight : \n",
501
- "tensor(4.2852, dtype=torch.float16)\n",
502
- "lora_unet_double_blocks_8_txt_attn_proj.lora_down.weight : \n",
503
- "tensor(1.3887, dtype=torch.float16)\n",
504
- "lora_unet_double_blocks_8_txt_attn_qkv.lora_down.weight : \n",
505
- "tensor(1.6289, dtype=torch.float16)\n",
506
- "lora_unet_double_blocks_8_txt_mlp_0.lora_down.weight : \n",
507
- "tensor(2.2188, dtype=torch.float16)\n",
508
- "lora_unet_double_blocks_8_txt_mod_lin.lora_down.weight : \n",
509
- "tensor(1.5742, dtype=torch.float16)\n",
510
- "lora_unet_double_blocks_9_img_attn_proj.lora_down.weight : \n",
511
- "tensor(2.3125, dtype=torch.float16)\n",
512
- "lora_unet_double_blocks_9_img_attn_qkv.lora_down.weight : \n",
513
- "tensor(1.4854, dtype=torch.float16)\n",
514
- "lora_unet_double_blocks_9_img_mlp_0.lora_down.weight : \n",
515
- "tensor(1.9492, dtype=torch.float16)\n",
516
- "lora_unet_double_blocks_9_img_mod_lin.lora_down.weight : \n",
517
- "tensor(2.2949, dtype=torch.float16)\n",
518
- "lora_unet_double_blocks_9_txt_attn_proj.lora_down.weight : \n",
519
- "tensor(2.0781, dtype=torch.float16)\n",
520
- "lora_unet_double_blocks_9_txt_attn_qkv.lora_down.weight : \n",
521
- "tensor(2.6172, dtype=torch.float16)\n",
522
- "lora_unet_double_blocks_9_txt_mlp_0.lora_down.weight : \n",
523
- "tensor(3.1367, dtype=torch.float16)\n",
524
- "lora_unet_double_blocks_9_txt_mod_lin.lora_down.weight : \n",
525
- "tensor(1.2451, dtype=torch.float16)\n",
526
- "lora_unet_single_blocks_0_linear1.lora_down.weight : \n",
527
- "tensor(2.4375, dtype=torch.float16)\n",
528
- "lora_unet_single_blocks_0_modulation_lin.lora_down.weight : \n",
529
- "tensor(3.5684, dtype=torch.float16)\n",
530
- "lora_unet_single_blocks_10_linear1.lora_down.weight : \n",
531
- "tensor(2.6328, dtype=torch.float16)\n",
532
- "lora_unet_single_blocks_10_modulation_lin.lora_down.weight : \n",
533
- "tensor(2.9961, dtype=torch.float16)\n",
534
- "lora_unet_single_blocks_11_linear1.lora_down.weight : \n",
535
- "tensor(3.1211, dtype=torch.float16)\n",
536
- "lora_unet_single_blocks_11_modulation_lin.lora_down.weight : \n",
537
- "tensor(3.3672, dtype=torch.float16)\n",
538
- "lora_unet_single_blocks_12_linear1.lora_down.weight : \n",
539
- "tensor(3.0293, dtype=torch.float16)\n",
540
- "lora_unet_single_blocks_12_modulation_lin.lora_down.weight : \n",
541
- "tensor(3.6602, dtype=torch.float16)\n",
542
- "lora_unet_single_blocks_13_linear1.lora_down.weight : \n",
543
- "tensor(2.5918, dtype=torch.float16)\n",
544
- "lora_unet_single_blocks_13_modulation_lin.lora_down.weight : \n",
545
- "tensor(4.6367, dtype=torch.float16)\n",
546
- "lora_unet_single_blocks_14_linear1.lora_down.weight : \n",
547
- "tensor(2.0215, dtype=torch.float16)\n",
548
- "lora_unet_single_blocks_14_modulation_lin.lora_down.weight : \n",
549
- "tensor(3.5371, dtype=torch.float16)\n",
550
- "lora_unet_single_blocks_15_linear1.lora_down.weight : \n",
551
- "tensor(2.1719, dtype=torch.float16)\n",
552
- "lora_unet_single_blocks_15_modulation_lin.lora_down.weight : \n",
553
- "tensor(4.2812, dtype=torch.float16)\n",
554
- "lora_unet_single_blocks_16_linear1.lora_down.weight : \n",
555
- "tensor(2.1992, dtype=torch.float16)\n",
556
- "lora_unet_single_blocks_16_modulation_lin.lora_down.weight : \n",
557
- "tensor(4.1094, dtype=torch.float16)\n",
558
- "lora_unet_single_blocks_17_linear1.lora_down.weight : \n",
559
- "tensor(2.0703, dtype=torch.float16)\n",
560
- "lora_unet_single_blocks_17_modulation_lin.lora_down.weight : \n",
561
- "tensor(2.9277, dtype=torch.float16)\n",
562
- "lora_unet_single_blocks_18_linear1.lora_down.weight : \n",
563
- "tensor(2.0371, dtype=torch.float16)\n",
564
- "lora_unet_single_blocks_18_modulation_lin.lora_down.weight : \n",
565
- "tensor(2.6133, dtype=torch.float16)\n",
566
- "lora_unet_single_blocks_19_linear1.lora_down.weight : \n",
567
- "tensor(2.0723, dtype=torch.float16)\n",
568
- "lora_unet_single_blocks_19_modulation_lin.lora_down.weight : \n",
569
- "tensor(3.4980, dtype=torch.float16)\n",
570
- "lora_unet_single_blocks_1_linear1.lora_down.weight : \n",
571
- "tensor(1.7432, dtype=torch.float16)\n",
572
- "lora_unet_single_blocks_1_modulation_lin.lora_down.weight : \n",
573
- "tensor(2.3848, dtype=torch.float16)\n",
574
- "lora_unet_single_blocks_20_linear1.lora_down.weight : \n",
575
- "tensor(2.0137, dtype=torch.float16)\n",
576
- "lora_unet_single_blocks_20_modulation_lin.lora_down.weight : \n",
577
- "tensor(2.8203, dtype=torch.float16)\n",
578
- "lora_unet_single_blocks_21_linear1.lora_down.weight : \n",
579
- "tensor(1.8955, dtype=torch.float16)\n",
580
- "lora_unet_single_blocks_21_modulation_lin.lora_down.weight : \n",
581
- "tensor(2.7305, dtype=torch.float16)\n",
582
- "lora_unet_single_blocks_22_linear1.lora_down.weight : \n",
583
- "tensor(2.7559, dtype=torch.float16)\n",
584
- "lora_unet_single_blocks_22_modulation_lin.lora_down.weight : \n",
585
- "tensor(4.6133, dtype=torch.float16)\n",
586
- "lora_unet_single_blocks_23_linear1.lora_down.weight : \n",
587
- "tensor(2.5508, dtype=torch.float16)\n",
588
- "lora_unet_single_blocks_23_modulation_lin.lora_down.weight : \n",
589
- "tensor(4.4180, dtype=torch.float16)\n",
590
- "lora_unet_single_blocks_24_linear1.lora_down.weight : \n",
591
- "tensor(1.9219, dtype=torch.float16)\n",
592
- "lora_unet_single_blocks_24_modulation_lin.lora_down.weight : \n",
593
- "tensor(2.9453, dtype=torch.float16)\n",
594
- "lora_unet_single_blocks_25_linear1.lora_down.weight : \n",
595
- "tensor(2.7539, dtype=torch.float16)\n",
596
- "lora_unet_single_blocks_25_modulation_lin.lora_down.weight : \n",
597
- "tensor(4.5938, dtype=torch.float16)\n",
598
- "lora_unet_single_blocks_26_linear1.lora_down.weight : \n",
599
- "tensor(3.3750, dtype=torch.float16)\n",
600
- "lora_unet_single_blocks_26_modulation_lin.lora_down.weight : \n",
601
- "tensor(4.7344, dtype=torch.float16)\n",
602
- "lora_unet_single_blocks_27_linear1.lora_down.weight : \n",
603
- "tensor(2.3809, dtype=torch.float16)\n",
604
- "lora_unet_single_blocks_27_modulation_lin.lora_down.weight : \n",
605
- "tensor(4.9883, dtype=torch.float16)\n",
606
- "lora_unet_single_blocks_28_linear1.lora_down.weight : \n",
607
- "tensor(3.0859, dtype=torch.float16)\n",
608
- "lora_unet_single_blocks_28_modulation_lin.lora_down.weight : \n",
609
- "tensor(5.7539, dtype=torch.float16)\n",
610
- "lora_unet_single_blocks_29_linear1.lora_down.weight : \n",
611
- "tensor(2.3242, dtype=torch.float16)\n",
612
- "lora_unet_single_blocks_29_modulation_lin.lora_down.weight : \n",
613
- "tensor(3.9160, dtype=torch.float16)\n",
614
- "lora_unet_single_blocks_2_linear1.lora_down.weight : \n",
615
- "tensor(2.1406, dtype=torch.float16)\n",
616
- "lora_unet_single_blocks_2_modulation_lin.lora_down.weight : \n",
617
- "tensor(2.1621, dtype=torch.float16)\n",
618
- "lora_unet_single_blocks_30_linear1.lora_down.weight : \n",
619
- "tensor(2.1211, dtype=torch.float16)\n",
620
- "lora_unet_single_blocks_30_modulation_lin.lora_down.weight : \n",
621
- "tensor(4.8516, dtype=torch.float16)\n",
622
- "lora_unet_single_blocks_31_linear1.lora_down.weight : \n",
623
- "tensor(2.2773, dtype=torch.float16)\n",
624
- "lora_unet_single_blocks_31_modulation_lin.lora_down.weight : \n",
625
- "tensor(4.1367, dtype=torch.float16)\n",
626
- "lora_unet_single_blocks_32_linear1.lora_down.weight : \n",
627
- "tensor(2.5273, dtype=torch.float16)\n",
628
- "lora_unet_single_blocks_32_modulation_lin.lora_down.weight : \n",
629
- "tensor(5.0508, dtype=torch.float16)\n",
630
- "lora_unet_single_blocks_33_linear1.lora_down.weight : \n",
631
- "tensor(2.7051, dtype=torch.float16)\n",
632
- "lora_unet_single_blocks_33_modulation_lin.lora_down.weight : \n",
633
- "tensor(5.2930, dtype=torch.float16)\n",
634
- "lora_unet_single_blocks_34_linear1.lora_down.weight : \n",
635
- "tensor(2.6738, dtype=torch.float16)\n",
636
- "lora_unet_single_blocks_34_modulation_lin.lora_down.weight : \n",
637
- "tensor(4.7852, dtype=torch.float16)\n",
638
- "lora_unet_single_blocks_35_linear1.lora_down.weight : \n",
639
- "tensor(2.5117, dtype=torch.float16)\n",
640
- "lora_unet_single_blocks_35_modulation_lin.lora_down.weight : \n",
641
- "tensor(6.7734, dtype=torch.float16)\n",
642
- "lora_unet_single_blocks_36_linear1.lora_down.weight : \n",
643
- "tensor(1.8418, dtype=torch.float16)\n",
644
- "lora_unet_single_blocks_36_modulation_lin.lora_down.weight : \n",
645
- "tensor(6.5859, dtype=torch.float16)\n",
646
- "lora_unet_single_blocks_37_linear1.lora_down.weight : \n",
647
- "tensor(2.4473, dtype=torch.float16)\n",
648
- "lora_unet_single_blocks_37_modulation_lin.lora_down.weight : \n",
649
- "tensor(2.5742, dtype=torch.float16)\n",
650
- "lora_unet_single_blocks_3_linear1.lora_down.weight : \n",
651
- "tensor(2.5566, dtype=torch.float16)\n",
652
- "lora_unet_single_blocks_3_modulation_lin.lora_down.weight : \n",
653
- "tensor(4.7148, dtype=torch.float16)\n",
654
- "lora_unet_single_blocks_4_linear1.lora_down.weight : \n",
655
- "tensor(2.2832, dtype=torch.float16)\n",
656
- "lora_unet_single_blocks_4_modulation_lin.lora_down.weight : \n",
657
- "tensor(2.0566, dtype=torch.float16)\n",
658
- "lora_unet_single_blocks_5_linear1.lora_down.weight : \n",
659
- "tensor(2.2109, dtype=torch.float16)\n",
660
- "lora_unet_single_blocks_5_modulation_lin.lora_down.weight : \n",
661
- "tensor(2.7793, dtype=torch.float16)\n",
662
- "lora_unet_single_blocks_6_linear1.lora_down.weight : \n",
663
- "tensor(3.0176, dtype=torch.float16)\n",
664
- "lora_unet_single_blocks_6_modulation_lin.lora_down.weight : \n",
665
- "tensor(2.9180, dtype=torch.float16)\n",
666
- "lora_unet_single_blocks_7_linear1.lora_down.weight : \n",
667
- "tensor(2.2461, dtype=torch.float16)\n",
668
- "lora_unet_single_blocks_7_modulation_lin.lora_down.weight : \n",
669
- "tensor(2.1074, dtype=torch.float16)\n",
670
- "lora_unet_single_blocks_8_linear1.lora_down.weight : \n",
671
- "tensor(3.0391, dtype=torch.float16)\n",
672
- "lora_unet_single_blocks_8_modulation_lin.lora_down.weight : \n",
673
- "tensor(2.0039, dtype=torch.float16)\n",
674
- "lora_unet_single_blocks_9_linear1.lora_down.weight : \n",
675
- "tensor(3.8789, dtype=torch.float16)\n",
676
- "lora_unet_single_blocks_9_modulation_lin.lora_down.weight : \n",
677
- "tensor(4.0547, dtype=torch.float16)\n"
678
- ]
679
- }
680
- ]
681
- },
682
- {
683
- "cell_type": "markdown",
684
- "source": [
685
- "<---- Upload your civiai trained .safetensor file to Google Colab before running the next cell\n",
686
- "\n"
687
- ],
688
- "metadata": {
689
- "id": "oDAUwfFzqzgj"
690
- }
691
- },
692
- {
693
- "cell_type": "code",
694
- "execution_count": null,
695
- "metadata": {
696
- "id": "WQZ3BZn1p-pw"
697
- },
698
- "outputs": [],
699
- "source": [
700
- "civiai_lora = '' # @param {type:'string' ,placeholder:'ex. civitai_trained_e19.safetensors'}\n",
701
- "tensor_art_filename = '' # @param {type:'string' ,placeholder:'ex. e19.safetensors'}\n",
702
- "%cd /content/\n",
703
- "tgt = load_file(f'{civiai_lora}')\n",
704
- "for key in tgt:\n",
705
- " tgt[f'{key}'] = tgt[f'{key}'].to(dtype=torch.float16)\n",
706
- "%cd /content/\n",
707
- "save_file(tgt , f'{tensor_art_filename}')"
708
- ]
709
- },
710
- {
711
- "cell_type": "markdown",
712
- "source": [
713
- "Download the new .safetensor file to your device.\n",
714
- "\n",
715
- "Downloading from CoLab Notebook will seemingly do nothing for ~5min. Then the file will download , so be patient.\n",
716
- "\n",
717
- "For faster/more consistent downloads , download your .safetensor file from your Google Drive"
718
- ],
719
- "metadata": {
720
- "id": "blnBW-U4rAS7"
721
- }
722
- }
723
- ]
724
- }