Skip to content

Commit ed51339

Browse files
authored
Allow configuration of which SD model to use (#263)
* Allow configuration of which SD model to use Closes #49 The syntax isn't quite the same (opting for --weights over --model), although --weights is more in-line with the existing naming convention. This method also locks us into models in the models/ldm/stable-diffusion-v1/ directory. Personally, I'm not averse to this, although a secondary solution may be necessary if we wish to supply weights from an external directory. * Fix typo * Allow either filename OR filepath input for arg This approach allows both --weights SD13 --weights C:/StableDiffusion/models/ldm/stable-diffusion-v1/SD13.ckpt
1 parent c52ba1b commit ed51339

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

scripts/dream.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ def main():
2929
width = 512
3030
height = 512
3131
config = 'configs/stable-diffusion/v1-inference.yaml'
32-
weights = 'models/ldm/stable-diffusion-v1/model.ckpt'
32+
if '.ckpt' in opt.weights:
33+
weights = opt.weights
34+
else:
35+
weights = f'models/ldm/stable-diffusion-v1/{opt.weights}.ckpt'
3336

3437
print('* Initializing, be patient...\n')
3538
sys.path.append('.')
@@ -418,6 +421,11 @@ def create_argv_parser():
418421
action='store_true',
419422
help='Start in web server mode.',
420423
)
424+
parser.add_argument(
425+
'--weights',
426+
default='model',
427+
help='Indicates the Stable Diffusion model to use.',
428+
)
421429
return parser
422430

423431

0 commit comments

Comments
 (0)