ZennyKenny commited on
Commit
aec8a4d
1 Parent(s): 90ad348

first-commit

Browse files
Files changed (2) hide show
  1. README.md +6 -0
  2. training-notebook.ipynb +296 -0
README.md CHANGED
@@ -1,3 +1,9 @@
1
  ---
2
  license: mit
3
  ---
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
  ---
4
+
5
+ # UNet2DModel-NatalieDiffusion
6
+
7
+ ## Model Summary and Intended Use
8
+
9
+ NatalieDiffusion is a finetune of [UNet2DModel](https://huggingface.co/docs/diffusers/v0.26.3/en/api/models/unet2d#diffusers.UNet2DModel) to aid a [particular graphic artist](https://www.behance.net/nataliKav) in quickly generating meaningful mock-ups and similar draft content for her work on an ongoing project.
training-notebook.ipynb ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 3,
6
+ "id": "9c81b287-de2a-4300-89c5-cd3f0e257ac9",
7
+ "metadata": {
8
+ "tags": []
9
+ },
10
+ "outputs": [
11
+ {
12
+ "data": {
13
+ "application/vnd.jupyter.widget-view+json": {
14
+ "model_id": "a9c3b8941bf44248afbcf0fcad6eec25",
15
+ "version_major": 2,
16
+ "version_minor": 0
17
+ },
18
+ "text/plain": [
19
+ "VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
20
+ ]
21
+ },
22
+ "metadata": {},
23
+ "output_type": "display_data"
24
+ }
25
+ ],
26
+ "source": [
27
+ "from huggingface_hub import notebook_login\n",
28
+ "\n",
29
+ "notebook_login()"
30
+ ]
31
+ },
32
+ {
33
+ "cell_type": "code",
34
+ "execution_count": 2,
35
+ "id": "60423896-b419-4568-9c17-56385bf300e7",
36
+ "metadata": {
37
+ "tags": []
38
+ },
39
+ "outputs": [
40
+ {
41
+ "name": "stderr",
42
+ "output_type": "stream",
43
+ "text": [
44
+ "\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33mkghamilton\u001b[0m. Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n"
45
+ ]
46
+ },
47
+ {
48
+ "data": {
49
+ "text/plain": [
50
+ "True"
51
+ ]
52
+ },
53
+ "execution_count": 2,
54
+ "metadata": {},
55
+ "output_type": "execute_result"
56
+ }
57
+ ],
58
+ "source": [
59
+ "import wandb\n",
60
+ "wandb.login()"
61
+ ]
62
+ },
63
+ {
64
+ "cell_type": "code",
65
+ "execution_count": 5,
66
+ "id": "386b6093-e819-4193-83e9-90619cfbed23",
67
+ "metadata": {
68
+ "tags": []
69
+ },
70
+ "outputs": [
71
+ {
72
+ "data": {
73
+ "text/html": [
74
+ "Finishing last run (ID:fwvb2zyo) before initializing another..."
75
+ ],
76
+ "text/plain": [
77
+ "<IPython.core.display.HTML object>"
78
+ ]
79
+ },
80
+ "metadata": {},
81
+ "output_type": "display_data"
82
+ },
83
+ {
84
+ "data": {
85
+ "application/vnd.jupyter.widget-view+json": {
86
+ "model_id": "",
87
+ "version_major": 2,
88
+ "version_minor": 0
89
+ },
90
+ "text/plain": [
91
+ "VBox(children=(Label(value='0.010 MB of 0.010 MB uploaded\\r'), FloatProgress(value=1.0, max=1.0)))"
92
+ ]
93
+ },
94
+ "metadata": {},
95
+ "output_type": "display_data"
96
+ },
97
+ {
98
+ "data": {
99
+ "text/html": [
100
+ " View run <strong style=\"color:#cdcd00\">fancy-jazz-1</strong> at: <a href='https://wandb.ai/kghamilton/UNet2DModal-NatalieDiffusion/runs/fwvb2zyo' target=\"_blank\">https://wandb.ai/kghamilton/UNet2DModal-NatalieDiffusion/runs/fwvb2zyo</a><br/>Synced 5 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s)"
101
+ ],
102
+ "text/plain": [
103
+ "<IPython.core.display.HTML object>"
104
+ ]
105
+ },
106
+ "metadata": {},
107
+ "output_type": "display_data"
108
+ },
109
+ {
110
+ "data": {
111
+ "text/html": [
112
+ "Find logs at: <code>./wandb/run-20240305_211104-fwvb2zyo/logs</code>"
113
+ ],
114
+ "text/plain": [
115
+ "<IPython.core.display.HTML object>"
116
+ ]
117
+ },
118
+ "metadata": {},
119
+ "output_type": "display_data"
120
+ },
121
+ {
122
+ "data": {
123
+ "text/html": [
124
+ "Successfully finished last run (ID:fwvb2zyo). Initializing new run:<br/>"
125
+ ],
126
+ "text/plain": [
127
+ "<IPython.core.display.HTML object>"
128
+ ]
129
+ },
130
+ "metadata": {},
131
+ "output_type": "display_data"
132
+ },
133
+ {
134
+ "data": {
135
+ "application/vnd.jupyter.widget-view+json": {
136
+ "model_id": "a75bb6ae8d9846e4a6a9050a529f914e",
137
+ "version_major": 2,
138
+ "version_minor": 0
139
+ },
140
+ "text/plain": [
141
+ "VBox(children=(Label(value='Waiting for wandb.init()...\\r'), FloatProgress(value=0.011112306700003198, max=1.0…"
142
+ ]
143
+ },
144
+ "metadata": {},
145
+ "output_type": "display_data"
146
+ },
147
+ {
148
+ "data": {
149
+ "text/html": [
150
+ "Tracking run with wandb version 0.16.3"
151
+ ],
152
+ "text/plain": [
153
+ "<IPython.core.display.HTML object>"
154
+ ]
155
+ },
156
+ "metadata": {},
157
+ "output_type": "display_data"
158
+ },
159
+ {
160
+ "data": {
161
+ "text/html": [
162
+ "Run data is saved locally in <code>/home/studio-lab-user/wandb/run-20240305_211140-1lv0cpao</code>"
163
+ ],
164
+ "text/plain": [
165
+ "<IPython.core.display.HTML object>"
166
+ ]
167
+ },
168
+ "metadata": {},
169
+ "output_type": "display_data"
170
+ },
171
+ {
172
+ "data": {
173
+ "text/html": [
174
+ "Syncing run <strong><a href='https://wandb.ai/kghamilton/UNet2DModal-NatalieDiffusion/runs/1lv0cpao' target=\"_blank\">sunny-plant-2</a></strong> to <a href='https://wandb.ai/kghamilton/UNet2DModal-NatalieDiffusion' target=\"_blank\">Weights & Biases</a> (<a href='https://wandb.me/run' target=\"_blank\">docs</a>)<br/>"
175
+ ],
176
+ "text/plain": [
177
+ "<IPython.core.display.HTML object>"
178
+ ]
179
+ },
180
+ "metadata": {},
181
+ "output_type": "display_data"
182
+ },
183
+ {
184
+ "data": {
185
+ "text/html": [
186
+ " View project at <a href='https://wandb.ai/kghamilton/UNet2DModal-NatalieDiffusion' target=\"_blank\">https://wandb.ai/kghamilton/UNet2DModal-NatalieDiffusion</a>"
187
+ ],
188
+ "text/plain": [
189
+ "<IPython.core.display.HTML object>"
190
+ ]
191
+ },
192
+ "metadata": {},
193
+ "output_type": "display_data"
194
+ },
195
+ {
196
+ "data": {
197
+ "text/html": [
198
+ " View run at <a href='https://wandb.ai/kghamilton/UNet2DModal-NatalieDiffusion/runs/1lv0cpao' target=\"_blank\">https://wandb.ai/kghamilton/UNet2DModal-NatalieDiffusion/runs/1lv0cpao</a>"
199
+ ],
200
+ "text/plain": [
201
+ "<IPython.core.display.HTML object>"
202
+ ]
203
+ },
204
+ "metadata": {},
205
+ "output_type": "display_data"
206
+ },
207
+ {
208
+ "data": {
209
+ "text/html": [
210
+ "<button onClick=\"this.nextSibling.style.display='block';this.style.display='none';\">Display W&B run</button><iframe src='https://wandb.ai/kghamilton/UNet2DModal-NatalieDiffusion/runs/1lv0cpao?jupyter=true' style='border:none;width:100%;height:420px;display:none;'></iframe>"
211
+ ],
212
+ "text/plain": [
213
+ "<wandb.sdk.wandb_run.Run at 0x7fdca5300910>"
214
+ ]
215
+ },
216
+ "execution_count": 5,
217
+ "metadata": {},
218
+ "output_type": "execute_result"
219
+ }
220
+ ],
221
+ "source": [
222
+ "wandb.init(\n",
223
+ " project=\"UNet2DModal-NatalieDiffusion\",\n",
224
+ " config={\n",
225
+ " \"magic\": \"true\",\n",
226
+ " \"dataset\": \"personal-repo\",\n",
227
+ " },\n",
228
+ ")"
229
+ ]
230
+ },
231
+ {
232
+ "cell_type": "code",
233
+ "execution_count": 6,
234
+ "id": "2ee4e1ed-6579-4179-aa8b-80aa4c511385",
235
+ "metadata": {
236
+ "tags": []
237
+ },
238
+ "outputs": [],
239
+ "source": [
240
+ "from dataclasses import dataclass\n",
241
+ "\n",
242
+ "@dataclass\n",
243
+ "class TrainingConfig:\n",
244
+ " image_size = 128\n",
245
+ " train_batch_size = 4\n",
246
+ " eval_batch_size = 16\n",
247
+ " num_epochs = 50\n",
248
+ " gradient_accumulation_steps = 1\n",
249
+ " learning_rate = 1e-4\n",
250
+ " lr_warmup_steps = 500\n",
251
+ " save_image_epochs = 10\n",
252
+ " save_model_epochs = 30\n",
253
+ " mixed_precision = \"fp16\"\n",
254
+ " output_dir = \"UNet2DModal-NatalieDiffusion\"\n",
255
+ "\n",
256
+ " push_to_hub = True\n",
257
+ " hub_model_id = \"ZennyKenny/UNet2DModal-NatalieDiffusion\"\n",
258
+ " hub_private_repo = False\n",
259
+ " overwrite_output_dir = True # overwrite the old model when re-running the notebook\n",
260
+ " seed = 0\n",
261
+ "\n",
262
+ "\n",
263
+ "config = TrainingConfig()"
264
+ ]
265
+ },
266
+ {
267
+ "cell_type": "code",
268
+ "execution_count": null,
269
+ "id": "b6e3aa70-fcdc-4fa4-9e61-fe5788e2ed9c",
270
+ "metadata": {},
271
+ "outputs": [],
272
+ "source": []
273
+ }
274
+ ],
275
+ "metadata": {
276
+ "kernelspec": {
277
+ "display_name": "default:Python",
278
+ "language": "python",
279
+ "name": "conda-env-default-py"
280
+ },
281
+ "language_info": {
282
+ "codemirror_mode": {
283
+ "name": "ipython",
284
+ "version": 3
285
+ },
286
+ "file_extension": ".py",
287
+ "mimetype": "text/x-python",
288
+ "name": "python",
289
+ "nbconvert_exporter": "python",
290
+ "pygments_lexer": "ipython3",
291
+ "version": "3.9.16"
292
+ }
293
+ },
294
+ "nbformat": 4,
295
+ "nbformat_minor": 5
296
+ }