mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Reference model from configs/models.yaml
By supplying --model (defaulting to stable-diffusion-1.4) a user can specify which model to load. Width/Height/Config Location/Weights Location are referenced from configs/models.yaml
This commit is contained in:
parent
db580ccefd
commit
d319b8a762
@ -13,11 +13,13 @@ import ldm.dream.readline
|
|||||||
from ldm.dream.pngwriter import PngWriter, PromptFormatter
|
from ldm.dream.pngwriter import PngWriter, PromptFormatter
|
||||||
from ldm.dream.server import DreamServer, ThreadingDreamServer
|
from ldm.dream.server import DreamServer, ThreadingDreamServer
|
||||||
from ldm.dream.image_util import make_grid
|
from ldm.dream.image_util import make_grid
|
||||||
|
from omegaconf import OmegaConf
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Initialize command-line parsers and the diffusion model"""
|
"""Initialize command-line parsers and the diffusion model"""
|
||||||
arg_parser = create_argv_parser()
|
arg_parser = create_argv_parser()
|
||||||
opt = arg_parser.parse_args()
|
opt = arg_parser.parse_args()
|
||||||
|
"""
|
||||||
if opt.laion400m:
|
if opt.laion400m:
|
||||||
# defaults suitable to the older latent diffusion weights
|
# defaults suitable to the older latent diffusion weights
|
||||||
width = 256
|
width = 256
|
||||||
@ -33,6 +35,15 @@ def main():
|
|||||||
weights = opt.weights
|
weights = opt.weights
|
||||||
else:
|
else:
|
||||||
weights = f'models/ldm/stable-diffusion-v1/{opt.weights}.ckpt'
|
weights = f'models/ldm/stable-diffusion-v1/{opt.weights}.ckpt'
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
models = OmegaConf.load('configs/models.yaml')
|
||||||
|
width = models[opt.model].width
|
||||||
|
height = models[opt.model].height
|
||||||
|
config = models[opt.model].config
|
||||||
|
weights = models[opt.model].weights
|
||||||
|
except (FileNotFoundError, IOError, KeyError) as e:
|
||||||
|
print(f'{e}. Aborting.')
|
||||||
|
|
||||||
print('* Initializing, be patient...\n')
|
print('* Initializing, be patient...\n')
|
||||||
sys.path.append('.')
|
sys.path.append('.')
|
||||||
@ -426,6 +437,11 @@ def create_argv_parser():
|
|||||||
default='model',
|
default='model',
|
||||||
help='Indicates the Stable Diffusion model to use.',
|
help='Indicates the Stable Diffusion model to use.',
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--model',
|
||||||
|
default='stable-diffusion-1.4',
|
||||||
|
help='Indicates which Diffusion model to load.',
|
||||||
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user