Skip to content

Commit b3d7ad7

Browse files
mauwiilstein
authored andcommitted
a lot of formatting updates to CLI.md
1 parent cd66b2c commit b3d7ad7

1 file changed

Lines changed: 86 additions & 65 deletions

File tree

docs/features/CLI.md

Lines changed: 86 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,34 @@ file should contain the startup options as you would type them on the
130130
command line (`--steps=10 --grid`), one argument per line, or a
131131
mixture of both using any of the accepted command switch formats:
132132

133-
!!! example ""
133+
!!! example "my unmodified initialization file"
134134

135-
```bash
136-
--web
137-
--steps=28
138-
--grid
139-
-f 0.6 -C 11.0 -A k_euler_a
135+
```bash title="~/.invokeai" linenums="1"
136+
# InvokeAI initialization file
137+
# This is the InvokeAI initialization file, which contains command-line default values.
138+
# Feel free to edit. If anything goes wrong, you can re-initialize this file by deleting
139+
# or renaming it and then running configure_invokeai.py again.
140+
141+
# The --root option below points to the folder in which InvokeAI stores its models, configs and outputs.
142+
--root="/Users/mauwii/invokeai"
143+
144+
# the --outdir option controls the default location of image files.
145+
--outdir="/Users/mauwii/invokeai/outputs"
146+
147+
# You may place other frequently-used startup commands here, one or more per line.
148+
# Examples:
149+
# --web --host=0.0.0.0
150+
# --steps=20
151+
# -Ak_euler_a -C10.0
140152
```
141153

142-
Note that the initialization file only accepts the command line arguments.
143-
There are additional arguments that you can provide on the `invoke>` command
144-
line (such as `-n` or `--iterations`) that cannot be entered into this file.
145-
Also be alert for empty blank lines at the end of the file, which will cause
146-
an arguments error at startup time.
154+
!!! note
155+
156+
The initialization file only accepts the command line arguments.
157+
There are additional arguments that you can provide on the `invoke>` command
158+
line (such as `-n` or `--iterations`) that cannot be entered into this file.
159+
Also be alert for empty blank lines at the end of the file, which will cause
160+
an arguments error at startup time.
147161

148162
## List of prompt arguments
149163

@@ -195,15 +209,17 @@ Here are the invoke> command that apply to txt2img:
195209
| `--with_variations <pattern>` | | `None` | Combine two or more variations. See [Variations](./VARIATIONS.md) for now to use this. |
196210
| `--save_intermediates <n>` | | `None` | Save the image from every nth step into an "intermediates" folder inside the output directory |
197211

198-
Note that the width and height of the image must be multiples of 64. You can
199-
provide different values, but they will be rounded down to the nearest multiple
200-
of 64.
212+
!!! note
201213

202-
### This is an example of img2img:
214+
the width and height of the image must be multiples of 64. You can
215+
provide different values, but they will be rounded down to the nearest multiple
216+
of 64.
203217

204-
```
205-
invoke> waterfall and rainbow -I./vacation-photo.png -W640 -H480 --fit
206-
```
218+
!!! example "This is a example of img2img"
219+
220+
```bash
221+
invoke> waterfall and rainbow -I./vacation-photo.png -W640 -H480 --fit
222+
```
207223

208224
This will modify the indicated vacation photograph by making it more like the
209225
prompt. Results will vary greatly depending on what is in the image. We also ask
@@ -253,7 +269,7 @@ description of the part of the image to replace. For example, if you have an
253269
image of a breakfast plate with a bagel, toast and scrambled eggs, you can
254270
selectively mask the bagel and replace it with a piece of cake this way:
255271

256-
```
272+
```bash
257273
invoke> a piece of cake -I /path/to/breakfast.png -tm bagel
258274
```
259275

@@ -265,7 +281,7 @@ are getting too much or too little masking you can adjust the threshold down (to
265281
get more mask), or up (to get less). In this example, by passing `-tm` a higher
266282
value, we are insisting on a more stringent classification.
267283

268-
```
284+
```bash
269285
invoke> a piece of cake -I /path/to/breakfast.png -tm bagel 0.6
270286
```
271287

@@ -275,16 +291,16 @@ You can load and use hundreds of community-contributed Textual
275291
Inversion models just by typing the appropriate trigger phrase. Please
276292
see [Concepts Library](CONCEPTS.md) for more details.
277293

278-
# Other Commands
294+
## Other Commands
279295

280296
The CLI offers a number of commands that begin with "!".
281297

282-
## Postprocessing images
298+
### Postprocessing images
283299

284300
To postprocess a file using face restoration or upscaling, use the `!fix`
285301
command.
286302

287-
### `!fix`
303+
#### `!fix`
288304

289305
This command runs a post-processor on a previously-generated image. It takes a
290306
PNG filename or path and applies your choice of the `-U`, `-G`, or `--embiggen`
@@ -311,19 +327,19 @@ Some examples:
311327
[1] outputs/img-samples/000017.4829112.gfpgan-00.png: !fix "outputs/img-samples/0000045.4829112.png" -s 50 -S -W 512 -H 512 -C 7.5 -A k_lms -G 0.8
312328
```
313329

314-
### !mask
330+
#### `!mask`
315331

316332
This command takes an image, a text prompt, and uses the `clipseg` algorithm to
317333
automatically generate a mask of the area that matches the text prompt. It is
318334
useful for debugging the text masking process prior to inpainting with the
319335
`--text_mask` argument. See [INPAINTING.md] for details.
320336

321-
## Model selection and importation
337+
### Model selection and importation
322338

323339
The CLI allows you to add new models on the fly, as well as to switch among them
324340
rapidly without leaving the script.
325341

326-
### !models
342+
#### `!models`
327343

328344
This prints out a list of the models defined in `config/models.yaml'. The active
329345
model is bold-faced
@@ -336,7 +352,7 @@ laion400m not loaded <no description>
336352
waifu-diffusion not loaded Waifu Diffusion v1.3
337353
</pre>
338354

339-
### !switch <model>
355+
#### `!switch <model>`
340356

341357
This quickly switches from one model to another without leaving the CLI script.
342358
`invoke.py` uses a memory caching system; once a model has been loaded,
@@ -361,7 +377,7 @@ invoke> !switch waifu-diffusion
361377
| Making attention of type 'vanilla' with 512 in_channels
362378
| Using faster float16 precision
363379
>> Model loaded in 18.24s
364-
>> Max VRAM used to load the model: 2.17G
380+
>> Max VRAM used to load the model: 2.17G
365381
>> Current VRAM usage:2.17G
366382
>> Setting Sampler to k_lms
367383

@@ -381,7 +397,7 @@ laion400m not loaded <no description>
381397
waifu-diffusion cached Waifu Diffusion v1.3
382398
</pre>
383399

384-
### !import_model <path/to/model/weights>
400+
#### `!import_model <path/to/model/weights>`
385401

386402
This command imports a new model weights file into InvokeAI, makes it available
387403
for image generation within the script, and writes out the configuration for the
@@ -428,10 +444,10 @@ OK to import [n]? <b>y</b>
428444
| Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
429445
| Making attention of type 'vanilla' with 512 in_channels
430446
| Using faster float16 precision
431-
invoke>
447+
invoke>
432448
</pre>
433449

434-
###!edit_model <name_of_model>
450+
#### `!edit_model <name_of_model>`
435451

436452
The `!edit_model` command can be used to modify a model that is already defined
437453
in `config/models.yaml`. Call it with the short name of the model you wish to
@@ -468,12 +484,12 @@ text... Outputs: [2] outputs/img-samples/000018.2273800735.embiggen-00.png: !fix
468484
"outputs/img-samples/000017.243781548.gfpgan-00.png" -s 50 -S 2273800735 -W 512
469485
-H 512 -C 7.5 -A k_lms --embiggen 3.0 0.75 0.25 ```
470486

471-
## History processing
487+
### History processing
472488

473489
The CLI provides a series of convenient commands for reviewing previous actions,
474490
retrieving them, modifying them, and re-running them.
475491

476-
### !history
492+
#### `!history`
477493

478494
The invoke script keeps track of all the commands you issue during a session,
479495
allowing you to re-run them. On Mac and Linux systems, it also writes the
@@ -485,20 +501,22 @@ during the session (Windows), or the most recent 1000 commands (Mac|Linux). You
485501
can then repeat a command by using the command `!NNN`, where "NNN" is the
486502
history line number. For example:
487503

488-
```bash
489-
invoke> !history
490-
...
491-
[14] happy woman sitting under tree wearing broad hat and flowing garment
492-
[15] beautiful woman sitting under tree wearing broad hat and flowing garment
493-
[18] beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6
494-
[20] watercolor of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
495-
[21] surrealist painting of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
496-
...
497-
invoke> !20
498-
invoke> watercolor of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
499-
```
504+
!!! example ""
505+
506+
```bash
507+
invoke> !history
508+
...
509+
[14] happy woman sitting under tree wearing broad hat and flowing garment
510+
[15] beautiful woman sitting under tree wearing broad hat and flowing garment
511+
[18] beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6
512+
[20] watercolor of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
513+
[21] surrealist painting of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
514+
...
515+
invoke> !20
516+
invoke> watercolor of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
517+
```
500518

501-
### !fetch
519+
####`!fetch`
502520

503521
This command retrieves the generation parameters from a previously generated
504522
image and either loads them into the command line (Linux|Mac), or prints them
@@ -508,33 +526,36 @@ a folder with image png files, and wildcard \*.png to retrieve the dream command
508526
used to generate the images, and save them to a file commands.txt for further
509527
processing.
510528

511-
This example loads the generation command for a single png file:
529+
!!! example "load the generation command for a single png file"
512530

513-
```bash
514-
invoke> !fetch 0000015.8929913.png
515-
# the script returns the next line, ready for editing and running:
516-
invoke> a fantastic alien landscape -W 576 -H 512 -s 60 -A plms -C 7.5
517-
```
531+
```bash
532+
invoke> !fetch 0000015.8929913.png
533+
# the script returns the next line, ready for editing and running:
534+
invoke> a fantastic alien landscape -W 576 -H 512 -s 60 -A plms -C 7.5
535+
```
518536

519-
This one fetches the generation commands from a batch of files and stores them
520-
into `selected.txt`:
537+
!!! example "fetch the generation commands from a batch of files and store them into `selected.txt`"
521538

522-
```bash
523-
invoke> !fetch outputs\selected-imgs\*.png selected.txt
524-
```
539+
```bash
540+
invoke> !fetch outputs\selected-imgs\*.png selected.txt
541+
```
525542

526-
### !replay
543+
#### `!replay`
527544

528545
This command replays a text file generated by !fetch or created manually
529546

530-
```
531-
invoke> !replay outputs\selected-imgs\selected.txt
532-
```
547+
!!! example
548+
549+
```bash
550+
invoke> !replay outputs\selected-imgs\selected.txt
551+
```
552+
553+
!!! note
533554

534-
Note that these commands may behave unexpectedly if given a PNG file that was
535-
not generated by InvokeAI.
555+
These commands may behave unexpectedly if given a PNG file that was
556+
not generated by InvokeAI.
536557

537-
### !search <search string>
558+
#### `!search <search string>`
538559

539560
This is similar to !history but it only returns lines that contain
540561
`search string`. For example:
@@ -544,7 +565,7 @@ invoke> !search surreal
544565
[21] surrealist painting of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
545566
```
546567

547-
### `!clear`
568+
#### `!clear`
548569

549570
This clears the search history from memory and disk. Be advised that this
550571
operation is irreversible and does not issue any warnings!

0 commit comments

Comments
 (0)