magicfixeseverything commited on
Commit
af0780d
1 Parent(s): 185d7e2

Upload 10 files

Browse files
Instructions.txt CHANGED
@@ -1,60 +1,114 @@
1
  --------------------------------------------------------------------------------
2
- --------------------------------------------------------------------------------
3
  --------------------------------------------------------------------------------
4
 
5
- AI Image Creation Offline on Windows using NVIDIA GPU
6
 
7
- About installing Diffusers in a virtual environment:
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
23
- be used on my Windows computer using the GPU. This script will not work
24
- using a CPU. While there is code in the script for CPU usage, it doesn't
25
- work on a Windows computer. It might be related to the Triton module not
26
- being available in Windows. There seem to be something that might work, but
27
- it would have meant installing something from elsewhere that I was not
28
- willing to try.
29
 
30
- The version of CUDA might matter. If you have one that doesn't work, you
31
- might have to install a different version of CUDA.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- If you have installed Automatic1111, you don't need to do step 1 and 2 as
34
- that program required Python and Git. You don't need Automatic1111 installed
35
- to use this program.
36
 
37
- About Automatic1111:
 
 
 
 
 
 
 
38
 
39
- https://github.com/AUTOMATIC1111/stable-diffusion-webui#installation-and-running
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- Your Antivirus/Firewall software will need to be set to allow the command
42
- prompt to download and install these programs. What you allow or don't allow
43
- is up to you. You may need to reinstall some of it if you don't allow it
44
- through the first time and it doesn't work for you. I don't know what the
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:
@@ -63,28 +117,37 @@
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
@@ -94,19 +157,22 @@ 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
@@ -116,7 +182,9 @@ cd C:\Diffusers && py -m venv .venv && .venv\Scripts\activate.bat
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.
@@ -124,13 +192,15 @@ cd C:\Diffusers && .venv\Scripts\activate.bat
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.
@@ -139,24 +209,23 @@ cd C:\Diffusers && .venv\Scripts\activate.bat
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:
@@ -186,8 +255,10 @@ nvidia-smi
186
 
187
  The text output now looks different.
188
 
 
189
  --------------------
190
 
 
191
  Step 7:
192
 
193
  You need to install PyTorch.
@@ -206,7 +277,9 @@ nvidia-smi
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
@@ -214,8 +287,10 @@ cd C:\Diffusers && .venv\Scripts\activate.bat && pip3 install -U xformers --inde
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.
@@ -235,18 +310,22 @@ cd C:\Diffusers && .venv\Scripts\activate.bat && pip3 install -U xformers --inde
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 gradio 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 different version of Gradio.
244
- I used version 4.11.0 in testing. In some versions before that there was
245
- a bug that made dropdown menus not work properly. Another bug was that
246
- an image couldn't be downloaded using the download button when viewing a
247
- gallery. This worked for me:
 
 
 
248
 
249
- cd C:\Diffusers && .venv\Scripts\activate.bat && pip install https://gradio-builds.s3.amazonaws.com/d4068557953746662235d595ec435c42ceb24414/gradio-4.11.0-py3-none-any.whl
250
 
251
  That was found here:
252
 
@@ -260,58 +339,94 @@ cd C:\Diffusers && .venv\Scripts\activate.bat && pip install https://gradio-buil
260
 
261
  When complete, move on to the next step.
262
 
 
263
  --------------------
264
 
265
- Step 9:
266
 
267
- Download the following file:
268
 
269
- https://huggingface.co/spaces/magicfixeseverything/ai_image_creation/raw/main/app.py
270
 
271
- Add it into a folder you create here:
 
 
272
 
273
- C:/Diffusers/.venv/
274
 
275
- Like this:
276
 
277
- C:/Diffusers/.venv/ai_image_creation/
278
 
279
- Add then add the file here:
280
 
281
- C:/Diffusers/.venv/ai_image_creation/app.py
 
282
 
283
  There are some things you will need to change in that file, most notably
284
- the directory specified in "main_dir"
 
285
 
286
  --------------------
287
 
 
288
  Step 10:
289
 
290
  You're ready to run the script that runs the web interface.
291
 
292
  The first time the models download it will take time as it's gigabytes
293
- of data that you need to download. An individual model file isn't
294
- downloaded until you actually try creating an image for that model. For
295
- all four models, the total size might be about 20 gigabytes if running
296
- on a GPU. It could be twice that size if on a CPU.
297
 
298
  In Command Prompt (that is doing things in your virtual environment),
299
  copy this line and press Enter:
300
 
301
- cd C:\Diffusers && .venv\Scripts\activate.bat && py .venv\ai_image_creation\app.py
 
 
302
 
303
  That will launch the web interface.
304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  Model files are downloaded to:
306
 
307
- C:\Diffusers\model_data
308
 
309
  You should know that this folder can grow considerably. You need to
310
  manually clean it out when you need to get rid of old models.
311
  Occasionally, new versions will be downloaded when you create an image.
312
  When that happens, you may want to remove the old version if the new
313
  version works. Otherwise, you could have 10 to 20 gigabytes of space
314
- added each time.
315
 
316
  You should also know that temporary images created are likely stored here:
317
 
@@ -329,24 +444,13 @@ cd C:\Diffusers && .venv\Scripts\activate.bat && py .venv\ai_image_creation\app.
329
 
330
  Someone offers something there that might work, but I didn't want to
331
  install something from someone randomly. Again, it seems to work without
332
- it when using a GPU. If trying to use a CPU using Windows, then it might
333
- mean you can't use this script.
334
 
335
- When done, you will get a message like this:
336
-
337
- Running on local URL: http://127.0.0.1:7860
338
-
339
- If your browser did not open a web browser, visit the link that was in
340
- the command prompt. If it was not the one above, note it. However, if
341
- you have something like Automatic1111 open already, it will use a
342
- different port, like "7861".
343
-
344
- It might be this:
345
-
346
- http://127.0.0.1:7860
347
 
348
  --------------------
349
 
 
350
  Step 11:
351
 
352
  When you open the link, you'll see the display to create the imagery.
@@ -354,27 +458,27 @@ cd C:\Diffusers && .venv\Scripts\activate.bat && py .venv\ai_image_creation\app.
354
  command prompt will tell you the progress of what you are creating and
355
  approximately how long it will take for the step it is on. It will take
356
  longer as there will be things that happen for which there is no
357
- progress indicator.
 
358
 
359
- --------------------
360
 
361
- Step 12:
362
 
363
- To create a shortcut to the command prompt that needs to be launched
364
- every time, download the following file:
365
 
366
- https://huggingface.co/spaces/magicfixeseverything/ai_image_creation/raw/main/ai_image_creation.bat
367
 
368
- Add it into the folder you created:
 
369
 
370
- C:/Diffusers/.venv/ai_image_creation/ai_image_creation.bat
371
 
372
- Next, we will create a shortcut to that, which you could do on the
373
  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
 
@@ -383,7 +487,7 @@ cd C:\Diffusers && .venv\Scripts\activate.bat && py .venv\ai_image_creation\app.
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
 
@@ -391,7 +495,7 @@ cmd
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
 
@@ -399,29 +503,31 @@ C:\Windows\System32\cmd.exe /k C:/Diffusers/.venv/ai_image_creation/ai_image_cre
399
  program to launch it simply opens the command prompt, then you must
400
  enter 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
- Please note that if you don't use "ai_image_creation.bat" you will need
409
- to set "HF_HUB_OFFLINE" manually if you want to change it. (this is
410
- discussed in next step)
411
 
412
  --------------------
413
 
 
414
  Step 13 (Important):
415
 
416
  I feel this is a very important step. After you have created model data
417
  for each base model, as well as have used the refiner and upscaler, data
418
- will then have been downloaded. This could be 40 gigabytes or more of
419
- data. I strongly recommend that you then disable the script from
420
- downloading updates to the model data. It will not automatically delete
421
- old data. If you didn't manually go through and delete the older data,
422
- eventually the model data would use all of the space on your computer.
423
-
424
- If you use "ai_image_creation.bat" to launch the script, you can set
 
425
  "HF_HUB_OFFLINE" in that file to 1 to not download data again.
426
 
427
  That is the easiest way that doesn't impact other installations. If you
@@ -436,7 +542,7 @@ cd C:\Diffusers && .venv\Scripts\activate.bat && py .venv\ai_image_creation\app.
436
  In regard to Hugging Face caching things, you can learn more on this
437
  page:
438
 
439
- https://huggingface.co/docs/huggingface_hub/how-to-cachehttps://huggingface.co/docs/huggingface_hub/how-to-cache#limitations
440
 
441
  The first time you use the script you will need to set HF_HUB_OFFLINE to
442
  0 like this there:
@@ -445,33 +551,69 @@ set HF_HUB_OFFLINE=0
445
 
446
  Do not include any spaces before or after the equals sign.
447
 
 
 
448
  The script will not work otherwise. Because of the importance of this
449
- variable, I prefer to not have the script work until someone changes
450
- that value themselves.
451
 
452
- --------------------------------------------------------------------------------
453
- --------------------------------------------------------------------------------
454
- --------------------------------------------------------------------------------
455
 
456
- Other Information
457
 
458
- --------------------------------------------------------------------------------
459
- --------------------------------------------------------------------------------
460
- --------------------------------------------------------------------------------
461
 
462
- File Sizes
463
 
464
- For perspective, on my computer the ".venv" folder has just over 50,000
465
- files, and nearly 6,000 folders, and is nearly 6 gigabytes. The model
466
- data folder ("model_data") has the following folders and these are their
467
- sizes:
468
 
469
- 5.10 GB models--circulus--canvers-realistic-v3.6
470
- 5.10 GB models--circulus--canvers-real-v3.7.5
471
- 3.97 GB models--circulus--canvers-real-v3.8
472
- 3.97 GB models--circulus--canvers-real-v3.8.1
473
- 1.98 GB models--runwayml--stable-diffusion-v1-5
474
- 2.15 GB models--stabilityai--sd-x2-latent-upscaler
475
- 12.50 GB models--stabilityai--sdxl-turbo
476
- 6.62 GB models--stabilityai--stable-diffusion-xl-base-1.0
477
- 5.81 GB models--stabilityai--stable-diffusion-xl-refiner-1.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  --------------------------------------------------------------------------------
 
2
  --------------------------------------------------------------------------------
3
 
 
4
 
5
+ Spaghetti AI for Windows using NVIDIA GPU
 
 
6
 
7
+ December 28th, 2023 - This app remains a work in progress.
8
+
9
+
10
+ I wanted to come up with a unique name for the app, so I chose something
11
+ silly.
12
+
13
+
14
+ --------------------------------------------------------------------------------
15
+ --------------------------------------------------------------------------------
16
+ --------------------------------------------------------------------------------
17
+
18
+ Important Information
19
 
20
  --------------------------------------------------------------------------------
21
  --------------------------------------------------------------------------------
22
  --------------------------------------------------------------------------------
23
 
 
 
 
 
 
 
 
 
24
 
25
+ Storage Requirements
26
+
27
+
28
+ You should make sure that you have at least 10 gigabytes of space,
29
+ perhaps more, before installing this initially. However, you should make
30
+ sure you have at least 50 gigabytes more of space before downloading
31
+ model data.
32
+
33
+ For perspective, on my computer the ".venv" folder has just over 50,000
34
+ files, and nearly 6,000 folders, and is nearly 6 gigabytes. The model
35
+ data folder ("model_data") has the following folders and these are
36
+ their sizes:
37
+
38
+ 5.10 GB models--circulus--canvers-realistic-v3.6
39
+ 5.10 GB models--circulus--canvers-real-v3.7.5
40
+ 3.97 GB models--circulus--canvers-real-v3.8
41
+ 3.97 GB models--circulus--canvers-real-v3.8.1
42
+ 1.98 GB models--runwayml--stable-diffusion-v1-5
43
+ 2.15 GB models--stabilityai--sd-x2-latent-upscaler
44
+ 12.50 GB models--stabilityai--sdxl-turbo
45
+ 6.62 GB models--stabilityai--stable-diffusion-xl-base-1.0
46
+ 5.81 GB models--stabilityai--stable-diffusion-xl-refiner-1.0
47
+
48
+
49
+ General Requirements
50
 
 
 
 
51
 
52
+ You must have a NVIDIA graphics card with Cuda installed. I already had
53
+ Cuda installed. If you need Cuda, it's in a step below. This script is
54
+ written to be used on my Windows computer using the GPU. This script
55
+ will not work using a CPU. While there is code in the script for CPU
56
+ usage, it doesn't work on a Windows computer. It might be related to the
57
+ Triton module not being available in Windows. There seem to be something
58
+ that might work, but it would have meant installing something from
59
+ elsewhere that I was not willing to try.
60
 
61
+ The version of CUDA might matter. If you have one that doesn't work, you
62
+ might have to install a different version of CUDA.
63
+
64
+ If you have installed Automatic1111, you don't need to do step 1 and 2
65
+ as that program required Python and Git. You don't need Automatic1111
66
+ installed to use this app.
67
+
68
+ About Automatic1111:
69
+ https://github.com/AUTOMATIC1111/stable-diffusion-webui#installation-and-running
70
+
71
+
72
+ Antivirus/Firewall Issues
73
+
74
+
75
+ Your Antivirus/Firewall software will need to be set to allow the
76
+ command prompt to download and install Python components, as well as run
77
+ the app. What you allow or don't allow is up to you. You may need to
78
+ reinstall some of it if you don't allow it through the first time and it
79
+ doesn't work for you. I don't know what the minimum you need to allow
80
+ would be, or if some or all of it can operate in a sandboxed
81
+ environment. It is important to remember that security settings by your
82
+ firewall and antivirus program may prevent the app from installing
83
+ and/or functioning properly. I use Comodo and I had to allow everything,
84
+ and install it more than once, to get it to install properly. In
85
+ Advanced View, I had to set files to trusted in Contained Apps and
86
+ unblock files in Blocked Applications. When popup alerts came up, I had
87
+ to allow the files, have it remember my answer and have it install as an
88
+ installer or updater. I also had to go to
89
+ "Tasks > Containment Tasks > Reset the Container" in order to have the
90
+ files not install in a sandboxed environment. Then I had to install it
91
+ again.
92
+
93
+ It is also important to note that you should not have any other programs
94
+ opened while installing this app. Until I had fully allowed the app
95
+ through my firewall and antivirus program, at times my computer
96
+ completely froze up. You don't want to lose any work you are working on.
97
 
 
 
 
 
 
 
98
 
99
  --------------------------------------------------------------------------------
100
  --------------------------------------------------------------------------------
101
  --------------------------------------------------------------------------------
102
 
103
+
104
  Instructions
105
 
106
+
107
  --------------------------------------------------------------------------------
108
  --------------------------------------------------------------------------------
109
  --------------------------------------------------------------------------------
110
 
111
+
112
  Step 1 (if you haven't done already):
113
 
114
  Install Python 3.10.6:
 
117
 
118
  Make sure to check "Add Python to PATH"
119
 
120
+
121
  --------------------
122
 
123
+
124
  Step 2 (if you haven't done already):
125
 
126
+ I'm not certain if you need this. You might not. I already had it
127
+ installed on my system.
128
+
129
  Install git
130
 
131
  https://git-scm.com/download/win
132
 
133
+
134
  --------------------
135
 
136
+
137
  Step 3:
138
 
139
  Create directory manually:
140
 
141
+ C:/Spaghetti_AI
142
+
143
+ This can be anywhere, and the directory can be named anything, but if
144
+ you change it here you need to change it in all the other places in
145
+ these instructions and in some of the files you download.
146
 
 
 
 
147
 
148
  --------------------
149
 
150
+
151
  Step 4:
152
 
153
  You need to open a regular Command Prompt. You can press Win key + R to
 
157
 
158
  In Command Prompt, copy this line and press Enter:
159
 
160
+
161
+ cd C:/Spaghetti_AI && py -m venv .venv && .venv\Scripts\activate.bat
162
+
163
 
164
  This will change the directory of the command prompt to the directory
165
  you created. Next, it creates a virtual environment for Python as
166
  described here:
167
 
168
  https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/
169
+ https://huggingface.co/docs/diffusers/installation
170
 
171
  Finally, it activates that virtual environment as also described there.
172
 
173
  The command prompt will now look like this:
174
 
175
+ (.venv) C:/Spaghetti_AI>
176
 
177
  You don't need to reopen the Command Prompt each time. Wait until a task
178
  finishes and then you will be able to enter the next command. It's best
 
182
  and activate the virtual environment like this, by copying this and
183
  pressing Enter:
184
 
185
+
186
+ cd C:/Spaghetti_AI && .venv\Scripts\activate.bat
187
+
188
 
189
  You do not want to install Python packages outside of the virtual
190
  environment as it would replace the packages in your main installation.
 
192
 
193
  Always make sure you have:
194
 
195
+ (.venv) C:/Spaghetti_AI>
196
 
197
  In future steps. (though I have added the code to activate it every time
198
  as a precaution)
199
 
200
+
201
  --------------------
202
 
203
+
204
  Step 5 (optional):
205
 
206
  pip is the package installer for Python.
 
209
  doing things in your virtual environment), copy this line and press
210
  Enter:
211
 
 
212
 
213
+ cd C:/Spaghetti_AI && .venv\Scripts\activate.bat && py -m pip install --upgrade pip
 
214
 
 
215
 
216
  Since you are using a virtual environment, packages that are installed
217
  will be installed into this folder rather than into Python's main
218
  program:
219
 
220
+ C:/Spaghetti_AI/.venv/Lib/site-packages
221
 
222
  That way you don't cause issues updating things you may not want to have
223
  updated.
224
 
225
+
226
  --------------------
227
 
228
+
229
  Step 6 (if needed; unsure of this step, I didn't do it):
230
 
231
  If you don't have Cuda and need to get it, it's here:
 
255
 
256
  The text output now looks different.
257
 
258
+
259
  --------------------
260
 
261
+
262
  Step 7:
263
 
264
  You need to install PyTorch.
 
277
  To install PyTorch in Command Prompt (that is doing things in your
278
  virtual environment), copy this line and press Enter:
279
 
280
+
281
+ cd C:/Spaghetti_AI && .venv\Scripts\activate.bat && pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121
282
+
283
 
284
  A lot of things will download and install, including any packages needed
285
  to run this. When complete, move on to the next step. (when the command
 
287
 
288
  The torch file alone is over 2 gigabytes.
289
 
290
+
291
  --------------------
292
 
293
+
294
  Step 8:
295
 
296
  This step installs the rest of what you need.
 
310
  virtual environment), all you need to do is copy this line and press
311
  Enter:
312
 
313
+
314
+ cd C:/Spaghetti_AI && .venv\Scripts\activate.bat && pip install diffusers transformers accelerate ftfy modin[all] invisible_watermark torchsde
315
+
316
 
317
  A whole bunch of things, what might be 100 packages or more, will
318
  download and install, including any packages needed to run these.
319
 
320
+ As of writing this, the script needs version 4.11.0 of Gradio. In some
321
+ versions before that there was a bug that made dropdown menus not work
322
+ properly. Another bug was that an image couldn't be downloaded using the
323
+ download button when viewing a gallery. Even older versions simply won't
324
+ work at all with this app. This worked for me:
325
+
326
+
327
+ cd C:/Spaghetti_AI && .venv\Scripts\activate.bat && pip install https://gradio-builds.s3.amazonaws.com/d4068557953746662235d595ec435c42ceb24414/gradio-4.11.0-py3-none-any.whl
328
 
 
329
 
330
  That was found here:
331
 
 
339
 
340
  When complete, move on to the next step.
341
 
342
+
343
  --------------------
344
 
 
345
 
346
+ Step 9:
347
 
348
+ Add these files:
349
 
350
+ spaghetti_ai_install.bat
351
+ spaghetti_ai_launcher.bat
352
+ spaghetti_ai_script.py
353
 
354
+ To this folder:
355
 
356
+ C:/Spaghetti_AI/.venv/app_files/
357
 
358
+ So that a file is here for example:
359
 
360
+ C:/Spaghetti_AI/.venv/app_files/spaghetti_ai_script.py
361
 
362
+ That's really the most important one that needs to be there as those two
363
+ .bat files call it.
364
 
365
  There are some things you will need to change in that file, most notably
366
+ the directory specified in "main_dir".
367
+
368
 
369
  --------------------
370
 
371
+
372
  Step 10:
373
 
374
  You're ready to run the script that runs the web interface.
375
 
376
  The first time the models download it will take time as it's gigabytes
377
+ of data that you need to download. By default, an individual model file
378
+ isn't downloaded until you actually try creating an image for that
379
+ model. You can change that however which we will get to in a moment.
 
380
 
381
  In Command Prompt (that is doing things in your virtual environment),
382
  copy this line and press Enter:
383
 
384
+
385
+ cd C:/Spaghetti_AI && .venv\Scripts\activate.bat && py .venv\app_files\spaghetti_ai_script.py
386
+
387
 
388
  That will launch the web interface.
389
 
390
+ When done, you will get a message like this:
391
+
392
+ Running on local URL: http://127.0.0.1:7860
393
+
394
+ If your browser did not open a web browser, visit the link that was in
395
+ the command prompt. If it was not the one above, note it. However, if
396
+ you have something like Automatic1111 open already, it will use a
397
+ different port, like "7861".
398
+
399
+ It might be this:
400
+
401
+ http://127.0.0.1:7860
402
+
403
+ To download a lot of data at once rather than waiting until you use each
404
+ model, you can add this at the end of the URL that opens after your
405
+ browser opens:
406
+
407
+ ?download_data=1
408
+
409
+ It will download dozens of gigabytes of data, so you may not want to do
410
+ that. A "1" will download only the default model configuration for each
411
+ main model, as well as refiner and upscaler data. A "2" will download
412
+ all model data needed in "model_configuration_links_object", including
413
+ online configurations you may not want.
414
+
415
+ Or you can just download it as you use each model.
416
+
417
+ Downloading all the model data will mean downloading dozens of gigabytes
418
+ of data.
419
+
420
  Model files are downloaded to:
421
 
422
+ C:/Spaghetti_AI/model_data
423
 
424
  You should know that this folder can grow considerably. You need to
425
  manually clean it out when you need to get rid of old models.
426
  Occasionally, new versions will be downloaded when you create an image.
427
  When that happens, you may want to remove the old version if the new
428
  version works. Otherwise, you could have 10 to 20 gigabytes of space
429
+ added each time you use a model that updates.
430
 
431
  You should also know that temporary images created are likely stored here:
432
 
 
444
 
445
  Someone offers something there that might work, but I didn't want to
446
  install something from someone randomly. Again, it seems to work without
447
+ it when using a GPU. If trying to use a CPU using Windows, that might be
448
+ what prevents the app from being able work.
449
 
 
 
 
 
 
 
 
 
 
 
 
 
450
 
451
  --------------------
452
 
453
+
454
  Step 11:
455
 
456
  When you open the link, you'll see the display to create the imagery.
 
458
  command prompt will tell you the progress of what you are creating and
459
  approximately how long it will take for the step it is on. It will take
460
  longer as there will be things that happen for which there is no
461
+ progress indicator, either in the command prompt or the progress shown
462
+ in the browser.
463
 
 
464
 
465
+ --------------------
466
 
 
 
467
 
468
+ Step 12:
469
 
470
+ To create a shortcut to the command that needs to be launched every
471
+ time, use:
472
 
473
+ spaghetti_ai_launcher.bat
474
 
475
+ You can then create a shortcut to that, which you could add to the
476
  desktop.
477
 
478
+ You can follow the instructions below or use the shortcut that comes
479
+ with this app:
480
 
481
+ Spaghetti AI.lnk
482
 
483
  Right click on your desktop and then click on "New > Shortcut".
484
 
 
487
  cmd
488
 
489
  Then click "Next". You can name the shortcut whatever you want, like
490
+ "Spaghetti AI".
491
 
492
  Then click "Finish".
493
 
 
495
 
496
  In "Target", replace what is there with the following:
497
 
498
+ C:\Windows\System32\cmd.exe /k C:/Spaghetti_AI/.venv/app_files/spaghetti_ai_launcher.bat
499
 
500
  That will execute that file each time you click on it.
501
 
 
503
  program to launch it simply opens the command prompt, then you must
504
  enter this each time in the command prompt:
505
 
506
+
507
+ cd C:/Spaghetti_AI && .venv\Scripts\activate.bat && py .venv\app_files\spaghetti_ai_script.py
508
+
509
 
510
  You might also not be able to use a shortcut. If so, just copy
511
+ "spaghetti_ai_launcher.bat" and put it on your desktop and name it what
512
+ you want. The downside, if you do that, would be reconfiguring your
513
+ firewall to use it from that location too.
514
 
 
 
 
515
 
516
  --------------------
517
 
518
+
519
  Step 13 (Important):
520
 
521
  I feel this is a very important step. After you have created model data
522
  for each base model, as well as have used the refiner and upscaler, data
523
+ will then have been downloaded. (or you use the method to download the
524
+ data at the same time) This could be 40 gigabytes or more of data. I
525
+ strongly recommend that you then disable the script from downloading
526
+ updates to the model data. It will not automatically delete old data. If
527
+ you didn't manually go through and delete the older data, eventually the
528
+ model data would use all of the space on your computer.
529
+
530
+ If you use "spaghetti_ai_launcher.bat" to launch the script, you can set
531
  "HF_HUB_OFFLINE" in that file to 1 to not download data again.
532
 
533
  That is the easiest way that doesn't impact other installations. If you
 
542
  In regard to Hugging Face caching things, you can learn more on this
543
  page:
544
 
545
+ https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations
546
 
547
  The first time you use the script you will need to set HF_HUB_OFFLINE to
548
  0 like this there:
 
551
 
552
  Do not include any spaces before or after the equals sign.
553
 
554
+ Or access the app from the command line when you want to download data.
555
+
556
  The script will not work otherwise. Because of the importance of this
557
+ variable, I prefer to not have the script work with the .bat file until
558
+ someone changes that value themselves.
559
 
 
 
 
560
 
561
+ --------------------
562
 
 
 
 
563
 
564
+ File List
565
 
566
+ You can add all of these files to:
567
+ C:\Spaghetti_AI\.venv\app_files
568
+ Although some of these files are not needed.
 
569
 
570
+
571
+ - Instructions.txt
572
+
573
+ This file. Instructions on how to install the app.
574
+
575
+ - README.md
576
+ - requirements.txt
577
+
578
+ These files are for use on HuggingFace. They are not otherwise
579
+ needed.
580
+
581
+ - spaghetti_ai_install.txt
582
+
583
+ You should avoid using this. I wanted to create an easier way to
584
+ install it, but it's best to read the instructions.
585
+
586
+ "C:/Spaghetti_AI" needs to be set in "main_dir" in this file if
587
+ you change the path and use this file.
588
+
589
+ - spaghetti_ai_launcher.bat
590
+
591
+ This is the file that launches "spaghetti_ai_script.py". This sets
592
+ some variables that need to be set there, like disabling the
593
+ automatic downloading of model data and turning off telemetry. The
594
+ shortcuts in this section should point to this.
595
+
596
+ "C:/Spaghetti_AI" needs to be set in "main_dir" in this file if
597
+ you change the path.
598
+
599
+ - spaghetti_ai_script.py
600
+
601
+ The main script.
602
+
603
+ "C:/Spaghetti_AI" needs to be set in "main_dir" in this file if
604
+ you change the path.
605
+
606
+ - Spaghetti AI (no icon).lnk
607
+ - Spaghetti AI.lnk
608
+ - spaghetti_ai_icon_for_shortcut.ico
609
+
610
+ These files are simply to provide a shortcut to the app. I created
611
+ a .ico file to have a nice icon that you can use with the
612
+ shortcut. Using a custom icon in a shortcut might not work, unless
613
+ you do it yourself, so I also included one that does not have a
614
+ custom icon. In Windows, you can right click on the shortcut and
615
+ then click "Properties". On the "Shortcut" tab you can then click
616
+ "Change Icon". You can then browse to the location of the icon
617
+ provided or another. If you change the path from
618
+ "C:/Spaghetti_AI", the shortcut will have to be edited in the
619
+ "Target" field of the "Shortcut" tab.
README.md CHANGED
@@ -1,11 +1,11 @@
1
  ---
2
- title: AI Image Creation
3
  emoji: 💻
4
  colorFrom: blue
5
  colorTo: blue
6
  sdk: gradio
7
  sdk_version: 4.11.0
8
- app_file: app.py
9
  pinned: false
10
  license: mit
11
  ---
 
1
  ---
2
+ title: Spaghetti AI
3
  emoji: 💻
4
  colorFrom: blue
5
  colorTo: blue
6
  sdk: gradio
7
  sdk_version: 4.11.0
8
+ app_file: spaghetti_ai_script.py
9
  pinned: false
10
  license: mit
11
  ---
Spaghetti AI (no icon).lnk ADDED
Binary file (1.41 kB). View file
 
Spaghetti AI.lnk ADDED
Binary file (2.33 kB). View file
 
spaghetti_ai.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6665e5f0fe2b256e3c5e021b0807e757400a1f807e4b369a5c42655b254cfa40
3
+ size 86301
spaghetti_ai_icon_for_shortcut.ico ADDED
spaghetti_ai_install.txt ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ REM ############################################################################
4
+ REM
5
+ REM
6
+ REM Install Spaghetti AI for Windows using NVIDIA GPU
7
+ REM
8
+ REM December 28th, 2023 - This app remains a work in progress.
9
+ REM
10
+ REM
11
+ REM Before running this script, you need to complete the following steps.
12
+ REM
13
+ REM I don't recommend using this file. I was trying to make it easier to
14
+ REM install, but it's best to read Instructions.txt. You need to
15
+ REM configure your firewall and antivirus program. You may have to
16
+ REM install the app several times.
17
+ REM
18
+ REM It is also important to note that you should not have any other
19
+ REM programs opened while installing this app. Until I had fully allowed
20
+ REM the app through my firewall and antivirus program, at times my
21
+ REM computer completely froze up. You don't want to lose any work you are
22
+ REM working on.
23
+ REM
24
+ REM
25
+ REM ############################################################################
26
+ REM
27
+ REM
28
+ REM Step 1 (if you haven't done already):
29
+ REM
30
+ REM Install Python 3.10.6:
31
+ REM
32
+ REM https://www.python.org/ftp/python/3.10.6/python-3.10.6-amd64.exe
33
+ REM
34
+ REM Make sure to check "Add Python to PATH"
35
+ REM
36
+ REM
37
+ REM #####################
38
+ REM
39
+ REM
40
+ REM Step 2 (if you haven't done already):
41
+ REM
42
+ REM I'm not certain if you need this. You might not. I already had it
43
+ REM installed on my system.
44
+ REM
45
+ REM Install git
46
+ REM
47
+ REM https://git-scm.com/download/win
48
+ REM
49
+ REM
50
+ REM #####################
51
+ REM
52
+ REM
53
+ REM Step 3:
54
+ REM
55
+ REM Create directory manually:
56
+ REM
57
+ REM C:/Spaghetti_AI
58
+ REM
59
+ REM This can be anywhere, but if you change it here you need to change it
60
+ REM in this script and in the other places that use it.
61
+ REM
62
+ REM Move these files into that folder:
63
+ REM
64
+ REM C:/Spaghetti_AI/.venv/app_files/spaghetti_ai_launcher.bat
65
+ REM C:/Spaghetti_AI/.venv/app_files/spaghetti_ai_script.py
66
+ REM
67
+ REM
68
+ REM #####################
69
+ REM
70
+ REM
71
+ REM Step 4
72
+ REM
73
+ REM You can either follow the instructions in Instructions.txt or use
74
+ REM this file to install this app on Windows to try to do everything at
75
+ REM once.
76
+ REM
77
+ REM To use this easier method, rename this file from ".txt" to ".bat".
78
+ REM Then double click this file to install the many packages, well over
79
+ REM 100, that will be needed to run this app. They will install into the
80
+ REM virtual environment that the longer set of instructions covers. It
81
+ REM will download several gigabytes of data.
82
+ REM
83
+ REM You should only need to run this file once.
84
+ REM
85
+ REM Once everything is installed, your browser will automatically launch
86
+ REM the app.
87
+ REM
88
+ REM
89
+ REM #####################
90
+ REM
91
+ REM
92
+ REM Step 5
93
+ REM
94
+ REM To download a lot of data at once rather than waiting until you use
95
+ REM each model, you can add this at the end of the URL:
96
+ REM
97
+ REM ?download_data=1
98
+ REM
99
+ REM It will download dozens of gigabytes of data, so you may not want to
100
+ REM do that. If you do it while using this script, you can do it without
101
+ REM updating "HF_HUB_OFFLINE" in "spaghetti_ai_launcher.bat".
102
+ REM
103
+ REM
104
+ REM #####################
105
+ REM
106
+ REM
107
+ REM Step 6
108
+ REM
109
+ REM Normal access of the app should be done using
110
+ REM "spaghetti_ai_launcher.bat", not this file. This file checks to make
111
+ REM sure everything is installed each time. While that is okay, it's not
112
+ REM necessary.
113
+ REM
114
+ REM
115
+ REM ############################################################################
116
+
117
+ set HF_HUB_OFFLINE=0
118
+ set HF_HUB_DISABLE_TELEMETRY=1
119
+
120
+ cd C:/Spaghetti_AI
121
+
122
+ call py -m venv .venv
123
+
124
+ call .venv\Scripts\activate.bat
125
+
126
+ call py -m pip install --upgrade pip
127
+
128
+ call pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121
129
+
130
+ call pip install diffusers transformers accelerate ftfy modin[all] invisible_watermark torchsde
131
+
132
+ REM Version 4.11.0 of Gradio works
133
+
134
+ call pip install https://gradio-builds.s3.amazonaws.com/d4068557953746662235d595ec435c42ceb24414/gradio-4.11.0-py3-none-any.whl
135
+
136
+ call py .venv/app_files/spaghetti_ai_script.py
137
+
138
+ cmd /k
spaghetti_ai_launcher.bat ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ REM ############################################################################
4
+ REM
5
+ REM
6
+ REM Install Spaghetti AI for Windows using NVIDIA GPU
7
+ REM
8
+ REM December 28th, 2023 - This app remains a work in progress.
9
+ REM
10
+ REM
11
+ REM Instructions for this file
12
+ REM
13
+ REM This is the file you should launch once the app is installed. You can
14
+ REM create a shortcut to this file to use it.
15
+ REM
16
+ REM
17
+ REM ############################################################################
18
+
19
+ REM
20
+ REM HF_HUB_OFFLINE
21
+ REM
22
+ REM To allow data to download, set HF_HUB_OFFLINE to 0. Do not include
23
+ REM any spaces before or after the equals sign. Once you have used each
24
+ REM model, the refiner, and the upscaler, I recommend setting this back
25
+ REM to 1. If you don't, model data will often download even though you
26
+ REM don't need an updated version. The older versions will not be deleted
27
+ REM automatically. That means your drive would eventually run out of
28
+ REM space if you never deleted older versions.
29
+ REM
30
+
31
+ set HF_HUB_OFFLINE=1
32
+
33
+ REM
34
+ REM HF_HUB_DISABLE_TELEMETRY
35
+ REM
36
+ REM This disables telemetry.
37
+ REM
38
+ REM About:
39
+ REM https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhubdisabletelemetry
40
+ REM
41
+
42
+ set HF_HUB_DISABLE_TELEMETRY=1
43
+
44
+ REM ############################################################################
45
+
46
+ cd C:/Spaghetti_AI
47
+
48
+ call .venv/Scripts/activate.bat
49
+
50
+ call py .venv/app_files/spaghetti_ai_script.py
51
+
52
+ cmd /k
spaghetti_ai_script.py ADDED
The diff for this file is too large to render. See raw diff