magicfixeseverything commited on
Commit
ffdd869
1 Parent(s): b8e37f1

Upload 4 files

Browse files
Files changed (4) hide show
  1. Instructions.txt +278 -257
  2. ai_image_creation.bat +31 -1
  3. app.py +0 -0
  4. requirements.txt +2 -1
Instructions.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
 
2
  AI Image Creation Offline on Windows using NVIDIA GPU
3
 
@@ -5,12 +8,15 @@
5
  https://huggingface.co/docs/diffusers/installation
6
  But I include the instructions on what you need to do below.
7
 
8
- ---
 
 
 
 
9
 
10
- I am still working on this. (note added December 7th, 2023) I am very new to
11
- this, so I'm sure there are many ways this could be done better.
12
-
13
- ---
14
 
15
  You must have a NVIDIA graphics card with Cuda installed. I already had Cuda
16
  installed. If you need Cuda, it's in a step below. This script is written to
@@ -39,425 +45,440 @@
39
  minimum you need to allow would be, or if some or all of it can operate in a
40
  sandboxed environment.
41
 
42
- ---
 
 
 
 
 
 
 
 
43
 
44
- Step 1 (if you haven't done already):
45
 
46
- Install Python 3.10.6:
47
 
48
- https://www.python.org/ftp/python/3.10.6/python-3.10.6-amd64.exe
49
 
50
- Make sure to check "Add Python to PATH"
51
 
52
- ---
53
 
54
- Step 2 (if you haven't done already):
55
 
56
- Install git
57
 
58
- https://git-scm.com/download/win
59
 
60
- ---
61
 
62
- Step 3:
63
 
64
- Create directory manually:
65
 
66
- C:/Diffusers
67
 
68
- This can be anywhere, but if you change it here you need to change it in all
69
- the other places in these instructions and in some of the files you
70
- download.
71
 
72
- ---
73
 
74
- Step 4:
75
 
76
- You need to open a regular Command Prompt. You can press Win key + R to get
77
- "Run" window. In that, enter:
78
 
79
  cmd
80
 
81
- In Command Prompt, copy this line and press Enter:
82
 
83
  cd C:\Diffusers && py -m venv .venv && .venv\Scripts\activate.bat
84
 
85
- This will change the directory of the command prompt to the directory you
86
- created. Next, it creates a virtual environment for Python as described
87
- here:
88
 
89
- https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/
90
 
91
- Finally, it activates that virtual environment as also described there.
92
 
93
- The command prompt will now look like this:
94
 
95
- (.venv) C:\Diffusers>
96
 
97
- You don't need to reopen the Command Prompt each time. Wait until a task
98
- finishes and then you will be able to enter the next command. It's best you
99
- do not close it.
100
 
101
- If you do close it, you will need to go to the directory again each time and
102
- activate the virtual environment like this, by copying this and pressing
103
- Enter:
104
 
105
  cd C:\Diffusers && .venv\Scripts\activate.bat
106
 
107
- You do not want to install Python packages outside of the virtual
108
- environment as it would replace the packages in your main installation. That
109
- could cause conflicts in other programs.
110
 
111
- Always make sure you have:
112
 
113
- (.venv) C:\Diffusers>
114
 
115
- In future steps. (though I have added the code to activate it every time as
116
- a precaution)
117
 
118
- ---
119
 
120
- Step 5 (optional):
121
 
122
- pip is the package installer for Python.
123
 
124
- If you want to make sure pip is up-to-date, in Command Prompt (that is doing
125
- things in your virtual environment), copy this line and press Enter:
 
126
 
127
  cd C:\Diffusers && .venv\Scripts\activate.bat && py -m pip install --upgrade pip
128
 
129
- If you want to then verify it updated, you could optionally do this, in
130
- Command Prompt, copy this line and press Enter:
131
 
132
  cd C:\Diffusers && .venv\Scripts\activate.bat && py -m pip --version
133
 
134
- Since you are using a virtual environment, packages that are installed will
135
- be installed into this folder rather than into Python's main program:
 
136
 
137
- C:/Diffusers/.venv/Lib/site-packages
138
 
139
- That way you don't cause issues updating things you may not want to have
140
- updated.
141
 
142
- ---
143
 
144
- Step 6 (if needed; unsure of this step, I didn't do it):
145
 
146
- If you don't have Cuda and need to get it, it's here:
147
 
148
- https://developer.nvidia.com/cuda-toolkit-archive
149
 
150
- I have 12.2 installed. Some things mention needing 12.1. In Step 8, as of
151
- writing this, it specifically mentions Cuda 12.1. You may want to check the
152
- PyTorch website first in Step 8 if you need to install Cuda to see what
153
- version it is compatible with or you will not get past that step.
 
154
 
155
- That link above has a list of prior versions. As packages update, you might
156
- need something even newer.
157
 
158
- To see what version of Cuda you have, in Command Prompt, copy this
159
- line and press Enter:
160
 
161
  nvidia-smi
162
 
163
- In the top right corner of the text output that is displayed, your Cuda
164
- version will be displayed.
165
 
166
- An older page on this command is here:
167
 
168
- https://developer.nvidia.com/nvidia-system-management-interface
169
 
170
- The text output now looks different.
171
 
172
- ---
173
 
174
- Step 7:
175
 
176
- You need to install PyTorch.
177
 
178
- You should visit their website and see what version they recommend based on
179
- the version of Cuda you have.
180
 
181
- https://pytorch.org/
182
 
183
- As of writing this, in the "INSTALL PYTORCH" section I selected the Stable
184
- PyTorch build, Windows, Pip, Python and Cuda 12.1.
185
 
186
- That generated in the "Run this Command" section the command you see below.
187
- (with the added code to do this in the virtual environment)
188
 
189
- To install PyTorch in Command Prompt (that is doing things in your virtual
190
- environment), copy this line and press Enter:
191
 
192
  cd C:\Diffusers && .venv\Scripts\activate.bat && pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121
193
 
194
- A lot of things will download and install, including any packages needed to
195
- run this. When complete, move on to the next step. (when the command prompt
196
- returns to where you can paste into it again)
197
 
198
- The torch file alone is over 2 gigabytes.
199
 
200
- ---
201
 
202
- Step 8:
203
 
204
- This step installs the rest of what you need.
205
 
206
- You can read about them if you want:
207
 
208
- https://huggingface.co/docs/diffusers/index
209
- https://huggingface.co/docs/transformers/index
210
- https://huggingface.co/docs/accelerate/index
211
- https://pypi.org/project/ftfy/
212
- https://github.com/modin-project/modin
213
- https://pypi.org/project/invisible-watermark/
214
- https://github.com/gradio-app/gradio
 
215
 
216
- To install these, in Command Prompt (that is doing things in your virtual
217
- environment), all you need to do is copy this line and press Enter:
 
218
 
219
- cd C:\Diffusers && .venv\Scripts\activate.bat && pip install diffusers transformers accelerate ftfy modin[all] invisible_watermark
220
 
221
- A whole bunch of things, what might be 100 packages or more, will download
222
- and install, including any packages needed to run these.
223
 
224
- When complete, you might need to install a later version of Gradio. A later
225
- version fixes a bug that is needed for the menus to work properly. This
226
- worked for me:
227
 
228
  cd C:\Diffusers && .venv\Scripts\activate.bat && pip install https://gradio-builds.s3.amazonaws.com/6b1401c514c2ec012b0a50c72a6ec81cb673bf1d/gradio-4.8.0-py3-none-any.whl
229
 
230
- That was found here:
231
 
232
- https://www.gradio.app/docs/blocks
233
 
234
- After selecting "main" from the version number dropdown in the left column.
235
- The link changes. If you don't want to doit that way, just do this instead
236
- to see if the dropdown menus work:
237
 
238
  cd C:\Diffusers && .venv\Scripts\activate.bat && pip install gradio
239
 
240
- The gallery feature doesn't allow images to be downloaded using the download
241
- button in the current version above. Hopefully that will work in a later
242
- version. (so eventually you will need to try another Gradio version)
 
243
 
244
- When a later version is eventually called, "gradio" will eventually be added
245
- to the original command rather than having to specify it separately.
 
246
 
247
- When complete, move on to the next step.
248
 
249
- ---
250
 
251
- Step 9:
252
 
253
- Download the following file:
254
 
255
- https://huggingface.co/spaces/magicfixeseverything/ai_image_creation/raw/main/app.py
256
 
257
- Add it into a folder you create here:
258
 
259
- C:/Diffusers/.venv/
260
 
261
- Like this:
262
 
263
- C:/Diffusers/.venv/ai_image_creation/
264
 
265
- Add then add the file here:
266
 
267
- C:/Diffusers/.venv/ai_image_creation/app.py
268
 
269
- There are some things you will need to change in that file, most notably the
270
- directory specified in "main_dir"
271
 
272
- ---
273
 
274
- Step 10:
275
 
276
- You're ready to run the script that runs the web interface.
277
 
278
- The first time the models download it will take time as it's gigabytes of
279
- data that you need to download. An individual model file isn't downloaded
280
- until you actually try creating an image for that model. For all four
281
- models, the total size might be about 20 gigabytes if running on a GPU. It
282
- could be twice that size if on a CPU.
283
 
284
- In Command Prompt (that is doing things in your virtual environment), copy
285
- this line and press Enter:
286
 
287
  cd C:\Diffusers && .venv\Scripts\activate.bat && py .venv\ai_image_creation\app.py
288
 
289
- That will launch the web interface.
290
-
291
- Model files are downloaded to:
292
-
293
- C:\Diffusers\model_data
294
-
295
- You should know that this folder can grow considerably. You need to manually
296
- clean it out when you need to get rid of old models. Occasionally, new
297
- versions will be downloaded when you create an image. When that happens, you
298
- may want to remove the old version if the new version works. Otherwise, you
299
- could have 10 to 20 gigabytes of space added each time.
300
-
301
- You should also know that temporary images created are likely stored here:
302
-
303
- %USERPROFILE%/AppData/Local/Temp/gradio
304
-
305
- Those however are likely cleaned out automatically by your computer.
306
-
307
- A package called Triton apparently can't be installed on Windows so you will
308
- see an error in the Command Prompt go by about that every time you launch
309
- the web interface. It doesn't seem to impact anything when using a GPU on
310
- Windows.
311
 
312
- https://github.com/openai/triton/issues/1057
313
- https://github.com/openai/triton/issues/1640
314
 
315
- Someone offers something there that might work, but I didn't want to install
316
- something from someone randomly. Again, it seems to work without it when
317
- using a GPU. If trying to use a CPU using Windows, then it might mean you
318
- can't use this script.
319
 
320
- When done, you will get a message like this:
 
 
 
 
 
321
 
322
- Running on local URL: http://127.0.0.1:7860
323
 
324
- If your browser did not open a web browser, visit the link that was in the
325
- command prompt. If it was not the one above, note it. However, if you have
326
- something like Automatic1111 open already, it will use a different port,
327
- like "7861".
328
 
329
- It might be this:
330
 
331
- http://127.0.0.1:7860
 
 
 
332
 
333
- ---
 
334
 
335
- Step 11:
 
 
 
336
 
337
- When you open the link, you'll see the display to create the imagery. You
338
- must leave the command prompt open. When you process an image, the command
339
- prompt will tell you the progress of what you are creating and approximately
340
- how long it will take for the step it is on. It will take longer as there
341
- will be things that happen for which there is no progress indicator.
342
 
343
- ---
344
 
345
- Step 12:
 
 
 
346
 
347
- To create a shortcut to the command prompt that needs to be launched every
348
- time, download the following file:
349
 
350
- https://huggingface.co/spaces/magicfixeseverything/ai_image_creation/raw/main/ai_image_creation.bat
351
 
352
- Add it into the folder you created:
353
 
354
- C:/Diffusers/.venv/ai_image_creation/ai_image_creation.bat
355
 
356
- The content of that file is the following:
 
 
 
 
 
357
 
 
358
 
359
- @echo off
360
 
361
- cd C:\Diffusers
362
- call .venv\Scripts\activate.bat
363
- timeout /t 0 >nul
364
- py .venv\ai_image_creation\app.py
365
 
366
- cmd /k
367
 
 
368
 
369
- For whatever reason, sometimes a shortcut from the desktop doesn't execute.
370
- I am seeing if a timeout for zero seconds works. (>nul makes the delay
371
- message not appear)
372
 
373
- Next, we will create a shortcut to that, which you could do on the desktop.
 
374
 
375
- You can follow the instructions below or download this file instead:
376
 
377
- https://huggingface.co/spaces/magicfixeseverything/ai_image_creation/resolve/main/AI%20Image%20Creation.lnk
378
 
379
- Right click on your desktop and then click on "New > Shortcut".
380
 
381
- For "Type the location of the item", enter:
382
 
383
  cmd
384
 
385
- Then click "Next". You can name the shortcut whatever you want, like
386
- "AI Image Creation".
387
 
388
- Then click "Finish".
389
 
390
- Then right click on the shortcut you created and click "Properties".
391
 
392
- In "Target", replace what is there with the following:
393
 
394
  C:\Windows\System32\cmd.exe /k C:/Diffusers/.venv/ai_image_creation/ai_image_creation.bat
395
 
396
- That will execute that file each time you click on it.
397
 
398
- If for some reason that doesn't work sometimes, and rather than get the
399
- program to launch it simply opens the command prompt, then you must enter
400
- this each time in the command prompt:
401
 
402
  cd C:\Diffusers && .venv\Scripts\activate.bat && py .venv\ai_image_creation\app.py
403
 
404
- You might also not be able to use a shortcut. If so, just copy
405
- "ai_image_creation.bat" and put it on your desktop and name it what you
406
- want.
407
 
408
- ---
 
 
409
 
410
- Step 13 (Important):
411
 
412
- I feel this is a very important step. After you have created model data for
413
- each base model, as well as have used the refiner and upscaler, data will
414
- then have been downloaded. This could be 30 gigabytes or more of data. I
415
- strongly recommend that you then disable the script from downloading updates
416
- to the model data. It will not automatically delete old data. If you didn't
417
- manually go through and delete the older data, eventually the model data
418
- would use all of the space on your computer.
419
 
420
- There is something that is very important to note however. If you do this,
421
- other installations that use Hugging Face for example, like Automatic1111,
422
- will not be able to download data and will not work properly.
 
 
 
 
423
 
424
- Once you have downloaded the model data for each model, you can disable
425
- updating by doing the following in a command prompt:
426
 
427
- setx HF_HUB_OFFLINE "1"
 
 
 
428
 
429
- It doesn't matter if it is in your virtual environment or not as it will be
430
- stored with all your environment variables.
431
 
432
- To view where this variable goes, in the search bar in Windows you can look
433
- for:
434
 
435
- edit environment variables
 
436
 
437
- And it will be listed.
438
 
439
- If you need to once again download model data, you can delete it there or
440
- enter the following in the command prompt:
441
 
442
- setx HF_HUB_OFFLINE "0" && REG DELETE HKEY_CURRENT_USER\Environment /v HF_HUB_OFFLINE /f
443
 
444
- In my testing, setting it to 0 and then deleting it made it immediately take
445
- effect, once you restart the script, to be able to download model data
446
- again.
447
 
448
- You can read about environment variables here at Hugging Face:
449
- https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhuboffline
 
450
 
451
- In regard to Hugging Face caching things, you can learn more on this page:
452
- https://huggingface.co/docs/huggingface_hub/how-to-cachehttps://huggingface.co/docs/huggingface_hub/how-to-cache#limitations
 
453
 
454
- This is just my preferred way of handling it.
455
 
456
- Optionally, you can disable telemetry by entering this in the command
457
- prompt:
 
458
 
459
- setx HF_HUB_DISABLE_TELEMETRY "1"
460
 
461
- And to turn it back on:
 
 
 
462
 
463
- setx HF_HUB_DISABLE_TELEMETRY "0" && REG DELETE HKEY_CURRENT_USER\Environment /v HF_HUB_DISABLE_TELEMETRY /f
 
 
 
 
 
 
 
 
 
1
+ --------------------------------------------------------------------------------
2
+ --------------------------------------------------------------------------------
3
+ --------------------------------------------------------------------------------
4
 
5
  AI Image Creation Offline on Windows using NVIDIA GPU
6
 
 
8
  https://huggingface.co/docs/diffusers/installation
9
  But I include the instructions on what you need to do below.
10
 
11
+ You should make sure that you have at least 10 gigabytes of space,
12
+ perhaps more, before installing this. You should make sure you have at
13
+ least 50 gigabytes more of space before downloading model data. For
14
+ information about the space this installation will use, go to the end
15
+ of the file first.
16
 
17
+ --------------------------------------------------------------------------------
18
+ --------------------------------------------------------------------------------
19
+ --------------------------------------------------------------------------------
 
20
 
21
  You must have a NVIDIA graphics card with Cuda installed. I already had Cuda
22
  installed. If you need Cuda, it's in a step below. This script is written to
 
45
  minimum you need to allow would be, or if some or all of it can operate in a
46
  sandboxed environment.
47
 
48
+ --------------------------------------------------------------------------------
49
+ --------------------------------------------------------------------------------
50
+ --------------------------------------------------------------------------------
51
+
52
+ Instructions
53
+
54
+ --------------------------------------------------------------------------------
55
+ --------------------------------------------------------------------------------
56
+ --------------------------------------------------------------------------------
57
 
58
+ Step 1 (if you haven't done already):
59
 
60
+ Install Python 3.10.6:
61
 
62
+ https://www.python.org/ftp/python/3.10.6/python-3.10.6-amd64.exe
63
 
64
+ Make sure to check "Add Python to PATH"
65
 
66
+ --------------------
67
 
68
+ Step 2 (if you haven't done already):
69
 
70
+ Install git
71
 
72
+ https://git-scm.com/download/win
73
 
74
+ --------------------
75
 
76
+ Step 3:
77
 
78
+ Create directory manually:
79
 
80
+ C:/Diffusers
81
 
82
+ This can be anywhere, but if you change it here you need to change it in
83
+ all the other places in these instructions and in some of the files you
84
+ download.
85
 
86
+ --------------------
87
 
88
+ Step 4:
89
 
90
+ You need to open a regular Command Prompt. You can press Win key + R to
91
+ get "Run" window. In that, enter:
92
 
93
  cmd
94
 
95
+ In Command Prompt, copy this line and press Enter:
96
 
97
  cd C:\Diffusers && py -m venv .venv && .venv\Scripts\activate.bat
98
 
99
+ This will change the directory of the command prompt to the directory
100
+ you created. Next, it creates a virtual environment for Python as
101
+ described here:
102
 
103
+ https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/
104
 
105
+ Finally, it activates that virtual environment as also described there.
106
 
107
+ The command prompt will now look like this:
108
 
109
+ (.venv) C:\Diffusers>
110
 
111
+ You don't need to reopen the Command Prompt each time. Wait until a task
112
+ finishes and then you will be able to enter the next command. It's best
113
+ you do not close it.
114
 
115
+ If you do close it, you will need to go to the directory again each time
116
+ and activate the virtual environment like this, by copying this and
117
+ pressing Enter:
118
 
119
  cd C:\Diffusers && .venv\Scripts\activate.bat
120
 
121
+ You do not want to install Python packages outside of the virtual
122
+ environment as it would replace the packages in your main installation.
123
+ That could cause conflicts in other programs.
124
 
125
+ Always make sure you have:
126
 
127
+ (.venv) C:\Diffusers>
128
 
129
+ In future steps. (though I have added the code to activate it every time
130
+ as a precaution)
131
 
132
+ --------------------
133
 
134
+ Step 5 (optional):
135
 
136
+ pip is the package installer for Python.
137
 
138
+ If you want to make sure pip is up-to-date, in Command Prompt (that is
139
+ doing things in your virtual environment), copy this line and press
140
+ Enter:
141
 
142
  cd C:\Diffusers && .venv\Scripts\activate.bat && py -m pip install --upgrade pip
143
 
144
+ If you want to then verify it updated, you could optionally do this, in
145
+ Command Prompt, copy this line and press Enter:
146
 
147
  cd C:\Diffusers && .venv\Scripts\activate.bat && py -m pip --version
148
 
149
+ Since you are using a virtual environment, packages that are installed
150
+ will be installed into this folder rather than into Python's main
151
+ program:
152
 
153
+ C:/Diffusers/.venv/Lib/site-packages
154
 
155
+ That way you don't cause issues updating things you may not want to have
156
+ updated.
157
 
158
+ --------------------
159
 
160
+ Step 6 (if needed; unsure of this step, I didn't do it):
161
 
162
+ If you don't have Cuda and need to get it, it's here:
163
 
164
+ https://developer.nvidia.com/cuda-toolkit-archive
165
 
166
+ I have 12.2 installed. Some things mention needing 12.1. In Step 8, as
167
+ of writing this, it specifically mentions Cuda 12.1. You may want to
168
+ check the PyTorch website first in Step 8 if you need to install Cuda to
169
+ see what version it is compatible with or you will not get past that
170
+ step.
171
 
172
+ That link above has a list of prior versions. As packages update, you
173
+ might need something even newer.
174
 
175
+ To see what version of Cuda you have, in Command Prompt, copy this line
176
+ and press Enter:
177
 
178
  nvidia-smi
179
 
180
+ In the top right corner of the text output that is displayed, your Cuda
181
+ version will be displayed.
182
 
183
+ An older page on this command is here:
184
 
185
+ https://developer.nvidia.com/nvidia-system-management-interface
186
 
187
+ The text output now looks different.
188
 
189
+ --------------------
190
 
191
+ Step 7:
192
 
193
+ You need to install PyTorch.
194
 
195
+ You should visit their website and see what version they recommend based
196
+ on the version of Cuda you have.
197
 
198
+ https://pytorch.org/
199
 
200
+ As of writing this, in the "INSTALL PYTORCH" section I selected the
201
+ Stable PyTorch build, Windows, Pip, Python and Cuda 12.1.
202
 
203
+ That generated in the "Run this Command" section the command you see
204
+ below. (with the added code to do this in the virtual environment)
205
 
206
+ To install PyTorch in Command Prompt (that is doing things in your
207
+ virtual environment), copy this line and press Enter:
208
 
209
  cd C:\Diffusers && .venv\Scripts\activate.bat && pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121
210
 
211
+ A lot of things will download and install, including any packages needed
212
+ to run this. When complete, move on to the next step. (when the command
213
+ prompt returns to where you can paste into it again)
214
 
215
+ The torch file alone is over 2 gigabytes.
216
 
217
+ --------------------
218
 
219
+ Step 8:
220
 
221
+ This step installs the rest of what you need.
222
 
223
+ You can read about them if you want:
224
 
225
+ https://huggingface.co/docs/diffusers/index
226
+ https://huggingface.co/docs/transformers/index
227
+ https://huggingface.co/docs/accelerate/index
228
+ https://pypi.org/project/ftfy/
229
+ https://github.com/modin-project/modin
230
+ https://pypi.org/project/invisible-watermark/
231
+ https://pypi.org/project/torchsde/
232
+ https://github.com/gradio-app/gradio
233
 
234
+ To install these, in Command Prompt (that is doing things in your
235
+ virtual environment), all you need to do is copy this line and press
236
+ Enter:
237
 
238
+ cd C:\Diffusers && .venv\Scripts\activate.bat && pip install diffusers transformers accelerate ftfy modin[all] invisible_watermark torchsde
239
 
240
+ A whole bunch of things, what might be 100 packages or more, will
241
+ download and install, including any packages needed to run these.
242
 
243
+ When complete, you might need to install a later version of Gradio. A
244
+ later version fixes a bug that is needed for the menus to work properly.
245
+ This worked for me:
246
 
247
  cd C:\Diffusers && .venv\Scripts\activate.bat && pip install https://gradio-builds.s3.amazonaws.com/6b1401c514c2ec012b0a50c72a6ec81cb673bf1d/gradio-4.8.0-py3-none-any.whl
248
 
249
+ That was found here:
250
 
251
+ https://www.gradio.app/docs/blocks
252
 
253
+ After selecting "main" from the version number dropdown in the left
254
+ column. The link changes. If you don't want to do it that way, just do
255
+ this instead to see if the dropdown menus work:
256
 
257
  cd C:\Diffusers && .venv\Scripts\activate.bat && pip install gradio
258
 
259
+ The gallery feature doesn't allow images to be downloaded using the
260
+ download button in the current version above. Hopefully that will work
261
+ in a later version. (so eventually you will need to try another Gradio
262
+ version)
263
 
264
+ When a later version is eventually called, "gradio" will eventually be
265
+ added to the original command rather than having to specify it
266
+ separately.
267
 
268
+ When complete, move on to the next step.
269
 
270
+ --------------------
271
 
272
+ Step 9:
273
 
274
+ Download the following file:
275
 
276
+ https://huggingface.co/spaces/magicfixeseverything/ai_image_creation/raw/main/app.py
277
 
278
+ Add it into a folder you create here:
279
 
280
+ C:/Diffusers/.venv/
281
 
282
+ Like this:
283
 
284
+ C:/Diffusers/.venv/ai_image_creation/
285
 
286
+ Add then add the file here:
287
 
288
+ C:/Diffusers/.venv/ai_image_creation/app.py
289
 
290
+ There are some things you will need to change in that file, most notably
291
+ the directory specified in "main_dir"
292
 
293
+ --------------------
294
 
295
+ Step 10:
296
 
297
+ You're ready to run the script that runs the web interface.
298
 
299
+ The first time the models download it will take time as it's gigabytes
300
+ of data that you need to download. An individual model file isn't
301
+ downloaded until you actually try creating an image for that model. For
302
+ all four models, the total size might be about 20 gigabytes if running
303
+ on a GPU. It could be twice that size if on a CPU.
304
 
305
+ In Command Prompt (that is doing things in your virtual environment),
306
+ copy this line and press Enter:
307
 
308
  cd C:\Diffusers && .venv\Scripts\activate.bat && py .venv\ai_image_creation\app.py
309
 
310
+ That will launch the web interface.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
 
312
+ Model files are downloaded to:
 
313
 
314
+ C:\Diffusers\model_data
 
 
 
315
 
316
+ You should know that this folder can grow considerably. You need to
317
+ manually clean it out when you need to get rid of old models.
318
+ Occasionally, new versions will be downloaded when you create an image.
319
+ When that happens, you may want to remove the old version if the new
320
+ version works. Otherwise, you could have 10 to 20 gigabytes of space
321
+ added each time.
322
 
323
+ You should also know that temporary images created are likely stored here:
324
 
325
+ %USERPROFILE%/AppData/Local/Temp/gradio
 
 
 
326
 
327
+ Those however are likely cleaned out automatically by your computer.
328
 
329
+ A package called Triton apparently can't be installed on Windows so you
330
+ will see an error in the Command Prompt go by about that every time you
331
+ launch the web interface. It doesn't seem to impact anything when using
332
+ a GPU on Windows.
333
 
334
+ https://github.com/openai/triton/issues/1057
335
+ https://github.com/openai/triton/issues/1640
336
 
337
+ Someone offers something there that might work, but I didn't want to
338
+ install something from someone randomly. Again, it seems to work without
339
+ it when using a GPU. If trying to use a CPU using Windows, then it might
340
+ mean you can't use this script.
341
 
342
+ When done, you will get a message like this:
 
 
 
 
343
 
344
+ Running on local URL: http://127.0.0.1:7860
345
 
346
+ If your browser did not open a web browser, visit the link that was in
347
+ the command prompt. If it was not the one above, note it. However, if
348
+ you have something like Automatic1111 open already, it will use a
349
+ different port, like "7861".
350
 
351
+ It might be this:
 
352
 
353
+ http://127.0.0.1:7860
354
 
355
+ --------------------
356
 
357
+ Step 11:
358
 
359
+ When you open the link, you'll see the display to create the imagery.
360
+ You must leave the command prompt open. When you process an image, the
361
+ command prompt will tell you the progress of what you are creating and
362
+ approximately how long it will take for the step it is on. It will take
363
+ longer as there will be things that happen for which there is no
364
+ progress indicator.
365
 
366
+ --------------------
367
 
368
+ Step 12:
369
 
370
+ To create a shortcut to the command prompt that needs to be launched
371
+ every time, download the following file:
 
 
372
 
373
+ https://huggingface.co/spaces/magicfixeseverything/ai_image_creation/raw/main/ai_image_creation.bat
374
 
375
+ Add it into the folder you created:
376
 
377
+ C:/Diffusers/.venv/ai_image_creation/ai_image_creation.bat
 
 
378
 
379
+ Next, we will create a shortcut to that, which you could do on the
380
+ desktop.
381
 
382
+ You can follow the instructions below or download this file instead:
383
 
384
+ https://huggingface.co/spaces/magicfixeseverything/ai_image_creation/resolve/main/AI%20Image%20Creation.lnk
385
 
386
+ Right click on your desktop and then click on "New > Shortcut".
387
 
388
+ For "Type the location of the item", enter:
389
 
390
  cmd
391
 
392
+ Then click "Next". You can name the shortcut whatever you want, like
393
+ "AI Image Creation".
394
 
395
+ Then click "Finish".
396
 
397
+ Then right click on the shortcut you created and click "Properties".
398
 
399
+ In "Target", replace what is there with the following:
400
 
401
  C:\Windows\System32\cmd.exe /k C:/Diffusers/.venv/ai_image_creation/ai_image_creation.bat
402
 
403
+ That will execute that file each time you click on it.
404
 
405
+ If for some reason that doesn't work sometimes, and rather than get the
406
+ program to launch it simply opens the command prompt, then you must
407
+ enter this each time in the command prompt:
408
 
409
  cd C:\Diffusers && .venv\Scripts\activate.bat && py .venv\ai_image_creation\app.py
410
 
411
+ You might also not be able to use a shortcut. If so, just copy
412
+ "ai_image_creation.bat" and put it on your desktop and name it what you
413
+ want.
414
 
415
+ Please note that if you don't use "ai_image_creation.bat" you will need
416
+ to set "HF_HUB_OFFLINE" manually if you want to change it. (this is
417
+ discussed in next step)
418
 
419
+ --------------------
420
 
421
+ Step 13 (Important):
 
 
 
 
 
 
422
 
423
+ I feel this is a very important step. After you have created model data
424
+ for each base model, as well as have used the refiner and upscaler, data
425
+ will then have been downloaded. This could be 40 gigabytes or more of
426
+ data. I strongly recommend that you then disable the script from
427
+ downloading updates to the model data. It will not automatically delete
428
+ old data. If you didn't manually go through and delete the older data,
429
+ eventually the model data would use all of the space on your computer.
430
 
431
+ If you use "ai_image_creation.bat" to launch the script, you can set
432
+ "HF_HUB_OFFLINE" in that file to 1 to not download data again.
433
 
434
+ That is the easiest way that doesn't impact other installations. If you
435
+ wanted to permanently store that environment variable in Windows, which
436
+ I don't recommend, it would impact other installations that use Hugging
437
+ Face. This only has it apply when using the script.
438
 
439
+ You can read about environment variables here at Hugging Face:
 
440
 
441
+ https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhuboffline
 
442
 
443
+ In regard to Hugging Face caching things, you can learn more on this
444
+ page:
445
 
446
+ https://huggingface.co/docs/huggingface_hub/how-to-cachehttps://huggingface.co/docs/huggingface_hub/how-to-cache#limitations
447
 
448
+ The first time you use the script you will need to set HF_HUB_OFFLINE to
449
+ 0 like this there:
450
 
451
+ set HF_HUB_OFFLINE=0
452
 
453
+ Do not include any spaces before or after the equals sign.
 
 
454
 
455
+ The script will not work otherwise. Because of the importance of this
456
+ variable, I prefer to not have the script work until someone changes
457
+ that value themselves.
458
 
459
+ --------------------------------------------------------------------------------
460
+ --------------------------------------------------------------------------------
461
+ --------------------------------------------------------------------------------
462
 
463
+ Other Information
464
 
465
+ --------------------------------------------------------------------------------
466
+ --------------------------------------------------------------------------------
467
+ --------------------------------------------------------------------------------
468
 
469
+ File Sizes
470
 
471
+ For perspective, on my computer the ".venv" folder has just over 50,000
472
+ files, and nearly 6,000 folders, and is nearly 6 gigabytes. The model
473
+ data folder ("model_data") has the following folders and these are their
474
+ sizes:
475
 
476
+ 5.10 GB models--circulus--canvers-realistic-v3.6
477
+ 5.10 GB models--circulus--canvers-real-v3.7.5
478
+ 3.97 GB models--circulus--canvers-real-v3.8
479
+ 3.97 GB models--circulus--canvers-real-v3.8.1
480
+ 1.98 GB models--runwayml--stable-diffusion-v1-5
481
+ 2.15 GB models--stabilityai--sd-x2-latent-upscaler
482
+ 12.50 GB models--stabilityai--sdxl-turbo
483
+ 6.62 GB models--stabilityai--stable-diffusion-xl-base-1.0
484
+ 5.81 GB models--stabilityai--stable-diffusion-xl-refiner-1.0
ai_image_creation.bat CHANGED
@@ -1,8 +1,38 @@
1
  @echo off
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  cd C:\Diffusers
4
  call .venv\Scripts\activate.bat
5
- timeout /t 0 >nul
6
  py .venv\ai_image_creation\app.py
7
 
8
  cmd /k
 
1
  @echo off
2
 
3
+ REM ############################################################################
4
+ REM
5
+ REM Instructions
6
+ REM
7
+ REM ############################################################################
8
+ REM
9
+ REM HF_HUB_OFFLINE
10
+ REM
11
+ REM To allow data to download, set HF_HUB_OFFLINE to 0. Do not include
12
+ REM any spaces before or after the equals sign. Once you have used each
13
+ REM model, the refiner, and the upscaler, I recommend setting this back
14
+ REM to 1. If you don't, model data will often download even though you
15
+ REM don't need an updated version. The older versions will not be deleted
16
+ REM automatically. That means your drive would eventually run out of
17
+ REM space if you never deleted older versions.
18
+
19
+ set HF_HUB_OFFLINE=1
20
+
21
+ REM HF_HUB_DISABLE_TELEMETRY
22
+ REM
23
+ REM This disables telemetry.
24
+ REM
25
+ REM About:
26
+ REM
27
+ REM https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhubdisabletelemetry
28
+
29
+ set HF_HUB_DISABLE_TELEMETRY=1
30
+
31
+ REM ############################################################################
32
+
33
  cd C:\Diffusers
34
  call .venv\Scripts\activate.bat
35
+ REM timeout /t 0 >nul
36
  py .venv\ai_image_creation\app.py
37
 
38
  cmd /k
app.py CHANGED
The diff for this file is too large to render. See raw diff
 
requirements.txt CHANGED
@@ -5,4 +5,5 @@ torch
5
  ftfy
6
  modin[all]
7
  xformers
8
- invisible_watermark
 
 
5
  ftfy
6
  modin[all]
7
  xformers
8
+ invisible_watermark
9
+ torchsde