mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'development' of github.com:invoke-ai/InvokeAI into development
This commit is contained in:
commit
5dd9e30c2f
@ -246,10 +246,9 @@ Outputs:
|
|||||||
## !fetch
|
## !fetch
|
||||||
|
|
||||||
This command retrieves the generation parameters from a previously
|
This command retrieves the generation parameters from a previously
|
||||||
generated image and either loads them into the command line
|
generated image and either loads them into the command line. You may
|
||||||
(Linux|Mac), or prints them out in a comment for copy-and-paste
|
provide either the name of a file in the current output directory, or
|
||||||
(Windows). You may provide either the name of a file in the current
|
a full file path.
|
||||||
output directory, or a full file path.
|
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
dream> !fetch 0000015.8929913.png
|
dream> !fetch 0000015.8929913.png
|
||||||
@ -285,10 +284,25 @@ dream> !20
|
|||||||
dream> watercolor of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
|
dream> watercolor of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
## !search <search string>
|
||||||
|
|
||||||
|
This is similar to !history but it only returns lines that contain
|
||||||
|
`search string`. For example:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
dream> !search surreal
|
||||||
|
[21] surrealist painting of beautiful woman sitting under tree wearing broad hat and flowing garment -v0.2 -n6 -S2878767194
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## !clear
|
||||||
|
|
||||||
|
This clears the search history from memory and disk. Be advised that
|
||||||
|
this operation is irreversible and does not issue any warnings!
|
||||||
|
|
||||||
# Command-line editing and completion
|
# Command-line editing and completion
|
||||||
|
|
||||||
If you are on a Macintosh or Linux machine, the command-line offers
|
The command-line offers convenient history tracking, editing, and
|
||||||
convenient history tracking, editing, and command completion.
|
command completion.
|
||||||
|
|
||||||
- To scroll through previous commands and potentially edit/reuse them, use the up and down cursor keys.
|
- To scroll through previous commands and potentially edit/reuse them, use the up and down cursor keys.
|
||||||
- To edit the current command, use the left and right cursor keys to position the cursor, and then backspace, delete or insert characters.
|
- To edit the current command, use the left and right cursor keys to position the cursor, and then backspace, delete or insert characters.
|
||||||
@ -298,7 +312,8 @@ convenient history tracking, editing, and command completion.
|
|||||||
- To paste a cut section back in, position the cursor where you want to paste, and type CTRL-Y
|
- To paste a cut section back in, position the cursor where you want to paste, and type CTRL-Y
|
||||||
|
|
||||||
Windows users can get similar, but more limited, functionality if they
|
Windows users can get similar, but more limited, functionality if they
|
||||||
launch dream.py with the "winpty" program:
|
launch dream.py with the "winpty" program and have the `pyreadline3`
|
||||||
|
library installed:
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
> winpty python scripts\dream.py
|
> winpty python scripts\dream.py
|
||||||
|
@ -23,6 +23,7 @@ dependencies:
|
|||||||
- send2trash==1.8.0
|
- send2trash==1.8.0
|
||||||
- pillow==9.2.0
|
- pillow==9.2.0
|
||||||
- einops==0.3.0
|
- einops==0.3.0
|
||||||
|
- pyreadline3
|
||||||
- torch-fidelity==0.3.0
|
- torch-fidelity==0.3.0
|
||||||
- transformers==4.19.2
|
- transformers==4.19.2
|
||||||
- torchmetrics==0.6.0
|
- torchmetrics==0.6.0
|
||||||
|
@ -193,6 +193,8 @@ class Args(object):
|
|||||||
switches.append('--grid')
|
switches.append('--grid')
|
||||||
if a['seamless']:
|
if a['seamless']:
|
||||||
switches.append('--seamless')
|
switches.append('--seamless')
|
||||||
|
if a['hires_fix']:
|
||||||
|
switches.append('--hires_fix')
|
||||||
|
|
||||||
# img2img generations have parameters relevant only to them and have special handling
|
# img2img generations have parameters relevant only to them and have special handling
|
||||||
if a['init_img'] and len(a['init_img'])>0:
|
if a['init_img'] and len(a['init_img'])>0:
|
||||||
|
@ -10,6 +10,7 @@ from PIL import Image
|
|||||||
from ldm.dream.generator.base import Generator
|
from ldm.dream.generator.base import Generator
|
||||||
from ldm.dream.generator.img2img import Img2Img
|
from ldm.dream.generator.img2img import Img2Img
|
||||||
from ldm.dream.devices import choose_autocast
|
from ldm.dream.devices import choose_autocast
|
||||||
|
from ldm.models.diffusion.ddim import DDIMSampler
|
||||||
|
|
||||||
class Embiggen(Generator):
|
class Embiggen(Generator):
|
||||||
def __init__(self, model, precision):
|
def __init__(self, model, precision):
|
||||||
@ -349,7 +350,7 @@ class Embiggen(Generator):
|
|||||||
prompt,
|
prompt,
|
||||||
iterations = 1,
|
iterations = 1,
|
||||||
seed = seed,
|
seed = seed,
|
||||||
sampler = sampler,
|
sampler = DDIMSampler(self.model, device=self.model.device),
|
||||||
steps = steps,
|
steps = steps,
|
||||||
cfg_scale = cfg_scale,
|
cfg_scale = cfg_scale,
|
||||||
conditioning = conditioning,
|
conditioning = conditioning,
|
||||||
|
@ -17,7 +17,7 @@ from ldm.dream.args import Args
|
|||||||
try:
|
try:
|
||||||
import readline
|
import readline
|
||||||
readline_available = True
|
readline_available = True
|
||||||
except:
|
except (ImportError,ModuleNotFoundError):
|
||||||
readline_available = False
|
readline_available = False
|
||||||
|
|
||||||
IMG_EXTENSIONS = ('.png','.jpg','.jpeg')
|
IMG_EXTENSIONS = ('.png','.jpg','.jpeg')
|
||||||
@ -47,7 +47,7 @@ COMMANDS = (
|
|||||||
'--skip_normalize','-x',
|
'--skip_normalize','-x',
|
||||||
'--log_tokenization','-t',
|
'--log_tokenization','-t',
|
||||||
'--hires_fix',
|
'--hires_fix',
|
||||||
'!fix','!fetch','!history',
|
'!fix','!fetch','!history','!search','!clear',
|
||||||
)
|
)
|
||||||
IMG_PATH_COMMANDS = (
|
IMG_PATH_COMMANDS = (
|
||||||
'--outdir[=\s]',
|
'--outdir[=\s]',
|
||||||
@ -62,7 +62,7 @@ IMG_FILE_COMMANDS=(
|
|||||||
)
|
)
|
||||||
path_regexp = '('+'|'.join(IMG_PATH_COMMANDS+IMG_FILE_COMMANDS) + ')\s*\S*$'
|
path_regexp = '('+'|'.join(IMG_PATH_COMMANDS+IMG_FILE_COMMANDS) + ')\s*\S*$'
|
||||||
|
|
||||||
class Completer:
|
class Completer(object):
|
||||||
def __init__(self, options):
|
def __init__(self, options):
|
||||||
self.options = sorted(options)
|
self.options = sorted(options)
|
||||||
self.seeds = set()
|
self.seeds = set()
|
||||||
@ -111,6 +111,19 @@ class Completer:
|
|||||||
if not self.auto_history_active:
|
if not self.auto_history_active:
|
||||||
readline.add_history(line)
|
readline.add_history(line)
|
||||||
|
|
||||||
|
def clear_history(self):
|
||||||
|
'''
|
||||||
|
Pass clear_history() thru to readline
|
||||||
|
'''
|
||||||
|
readline.clear_history()
|
||||||
|
|
||||||
|
def search_history(self,match:str):
|
||||||
|
'''
|
||||||
|
Like show_history() but only shows items that
|
||||||
|
contain the match string.
|
||||||
|
'''
|
||||||
|
self.show_history(match)
|
||||||
|
|
||||||
def remove_history_item(self,pos):
|
def remove_history_item(self,pos):
|
||||||
readline.remove_history_item(pos)
|
readline.remove_history_item(pos)
|
||||||
|
|
||||||
@ -137,7 +150,7 @@ class Completer:
|
|||||||
def get_history_item(self,index):
|
def get_history_item(self,index):
|
||||||
return readline.get_history_item(index)
|
return readline.get_history_item(index)
|
||||||
|
|
||||||
def show_history(self):
|
def show_history(self,match=None):
|
||||||
'''
|
'''
|
||||||
Print the session history using the pydoc pager
|
Print the session history using the pydoc pager
|
||||||
'''
|
'''
|
||||||
@ -149,7 +162,10 @@ class Completer:
|
|||||||
return
|
return
|
||||||
|
|
||||||
for i in range(0,h_len):
|
for i in range(0,h_len):
|
||||||
lines.append(f'[{i+1}] {self.get_history_item(i+1)}')
|
line = self.get_history_item(i+1)
|
||||||
|
if match and match not in line:
|
||||||
|
continue
|
||||||
|
lines.append(f'[{i+1}] {line}')
|
||||||
pydoc.pager('\n'.join(lines))
|
pydoc.pager('\n'.join(lines))
|
||||||
|
|
||||||
def set_line(self,line)->None:
|
def set_line(self,line)->None:
|
||||||
@ -235,6 +251,9 @@ class DummyCompleter(Completer):
|
|||||||
def add_history(self,line):
|
def add_history(self,line):
|
||||||
self.history.append(line)
|
self.history.append(line)
|
||||||
|
|
||||||
|
def clear_history(self):
|
||||||
|
self.history = list()
|
||||||
|
|
||||||
def get_current_history_length(self):
|
def get_current_history_length(self):
|
||||||
return len(self.history)
|
return len(self.history)
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ pudb
|
|||||||
pytorch-lightning
|
pytorch-lightning
|
||||||
scikit-image>=0.19
|
scikit-image>=0.19
|
||||||
streamlit
|
streamlit
|
||||||
|
pyreadline3
|
||||||
# "CompVis/taming-transformers" IS NOT INSTALLABLE
|
# "CompVis/taming-transformers" IS NOT INSTALLABLE
|
||||||
# This is a drop-in replacement
|
# This is a drop-in replacement
|
||||||
taming-transformers-rom1504
|
taming-transformers-rom1504
|
||||||
|
@ -183,6 +183,15 @@ def main_loop(gen, opt, infile):
|
|||||||
completer.show_history()
|
completer.show_history()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
elif subcommand.startswith('search'):
|
||||||
|
search_str = command.replace('!search ','',1)
|
||||||
|
completer.show_history(search_str)
|
||||||
|
continue
|
||||||
|
|
||||||
|
elif subcommand.startswith('clear'):
|
||||||
|
completer.clear_history()
|
||||||
|
continue
|
||||||
|
|
||||||
elif re.match('^(\d+)',subcommand):
|
elif re.match('^(\d+)',subcommand):
|
||||||
command_no = re.match('^(\d+)',subcommand).groups()[0]
|
command_no = re.match('^(\d+)',subcommand).groups()[0]
|
||||||
command = completer.get_line(int(command_no))
|
command = completer.get_line(int(command_no))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user